org.hypergraphdb.peer.workflow
Class AbstractActivity<StateType>

java.lang.Object
  extended by org.hypergraphdb.peer.workflow.AbstractActivity<StateType>
Type Parameters:
StateType -
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
Conversation, TaskActivity

public abstract class AbstractActivity<StateType>
extends java.lang.Object
implements java.lang.Runnable

Author:
Cipri Costa This is the superclass of all the work flow like classes. The implementors of this class provide a number of states and functions that move the object from a state to another (usually enums, but not mandatory). Like in the case of an finite state machine, the current state and the external signal will decide which is the next state of the object. Implementors can expose two special states (not mandatory): start and end. The start state is initialized when the activity is started, while reaching the end state will trigger the termination of the run method of the activity.

Constructor Summary
AbstractActivity(StateType start, StateType end)
           
 
Method Summary
 StateType getEndState()
          Return the object indicating an ending state for this activity.
 StateType getStartState()
          Return the object indicating a starting state for this activity.
 void run()
           
 void setStateListener(java.lang.Object state, ActivityStateListener listener)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractActivity

public AbstractActivity(StateType start,
                        StateType end)
Method Detail

run

public void run()
Specified by:
run in interface java.lang.Runnable

setStateListener

public void setStateListener(java.lang.Object state,
                             ActivityStateListener listener)

getStartState

public StateType getStartState()

Return the object indicating a starting state for this activity.


getEndState

public StateType getEndState()

Return the object indicating an ending state for this activity.