org.gcube.common.core.utils.handlers.lifetime
Class State

java.lang.Object
  extended by org.gcube.common.core.utils.handlers.lifetime.State
Direct Known Subclasses:
State.Created, State.Done, State.Failed, State.Running, State.Suspended

public abstract class State
extends Object

Partial implementation for models of distinguished states in the lifetime of a GCUBEIHandler.

A subclass that models a given state:

Author:
Fabio Simeoni (University of Strathclyde)

Nested Class Summary
static class State.Created
          Specialises State for the (private) start state of a handler.
static class State.Done
          Specialises State for the state of a handler that has completed execution.
static class State.Failed
          Specialises State for the state of a handler that has failed prior or during its execution.
static class State.Running
          Specialises State for the state of a handler that is executing.
static class State.Suspended
          Specialises State for the state of a handler that has suspended its execution.
 
Constructor Summary
protected State()
          Creates a new instance.
 
Method Summary
protected abstract  void addPrevious(List<State> previous)
          Adds the states from which a handler may transition to this state.
 boolean equals(Object o)
          
 Event.LifetimeEvent getLifetimeEvent()
          Returns a Event.LifetimeEvent for the transition to this state.
 List<State> getPrevious()
          Returns the states from which a handler may transition to this state.
 int hashCode()
          
 void onEnter()
          Invoked by upon transitioning to this state.
 void onExit()
          Invoked upon transitioning from this state.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

State

protected State()
Creates a new instance.

Method Detail

addPrevious

protected abstract void addPrevious(List<State> previous)
Adds the states from which a handler may transition to this state.

Parameters:
previous - the previous states.

getPrevious

public final List<State> getPrevious()
Returns the states from which a handler may transition to this state.

Returns:
the states.

toString

public String toString()

Overrides:
toString in class Object

onEnter

public void onEnter()
             throws Exception
Invoked by upon transitioning to this state.

Throws:
Exception - if the transition could not occur.

onExit

public void onExit()
            throws Exception
Invoked upon transitioning from this state.

Throws:
Exception - if the transition could not occur.

getLifetimeEvent

public Event.LifetimeEvent getLifetimeEvent()
Returns a Event.LifetimeEvent for the transition to this state.

Return null if the transition should not be notified.

Returns:
the event.

equals

public boolean equals(Object o)

Overrides:
equals in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object


Copyright © 2012. All Rights Reserved.