|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hypergraphdb.peer.workflow.Activity
public abstract class Activity
An Activity is some task that a peer is currently working one. An
activity is always currently in some state.
It is possible to directly extend this class and have complete control over the implementation of the activity simply by handling incoming messages and taking some action at that point in time. This recommended either for very simple P2P scenarios where not much state is maintained, or for very complicated ones that do not fit into the provided framework.
For most cases however, it is probably best to implement the activity as an
FSM (a Finite State Machine) that does from state to state based on incoming
messages and/or related sub-activities. In this case, the FSMActivity class
| Constructor Summary | |
|---|---|
Activity(HyperGraphPeer thisPeer)
|
|
Activity(HyperGraphPeer thisPeer,
java.util.UUID id)
|
|
| Method Summary | |
|---|---|
java.util.concurrent.Future<ActivityResult> |
getFuture()
Return the Future object representing the completion
of this activity. |
java.util.UUID |
getId()
|
WorkflowState |
getState()
Return this activity's workflow state. |
java.lang.String |
getType()
Return the type name of this activity. |
abstract void |
handleMessage(Message message)
Handle an incoming that was identified as belonging to this activity. |
abstract void |
initiate()
Called by the framework to initiate a new activity. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Activity(HyperGraphPeer thisPeer)
public Activity(HyperGraphPeer thisPeer,
java.util.UUID id)
| Method Detail |
|---|
public abstract void initiate()
Called by the framework to initiate a new activity. This method is only invoked
at the peer initiating the activity. Once an activity has been initiated, its state
changes to Started.
public abstract void handleMessage(Message message)
Handle an incoming that was identified as belonging to this activity.
message - The full message.public final WorkflowState getState()
Return this activity's workflow state.
public final java.util.concurrent.Future<ActivityResult> getFuture()
Return the Future object representing the completion
of this activity.
public java.lang.String getType()
Return the type name of this activity. By the default to fully-qualified class name is returned. This method can be overridden by sub-classes to provide a short and/or more human-readable type name.
public final java.util.UUID getId()
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||