public abstract class FSMActivity extends Activity
An activity implementation based on a finite state machine defined through method annotations.
Constructor and Description |
---|
FSMActivity()
Default constructor - thisPeer, ID etc must be set separately.
|
FSMActivity(HyperGraphPeer thisPeer) |
FSMActivity(HyperGraphPeer thisPeer,
java.util.UUID id) |
Modifier and Type | Method and Description |
---|---|
void |
handleMessage(Json message)
Empty method - can't override because message handling for
FSMActivity is automated by the framework. |
void |
initiate()
Empty method - override to implement activity initiation.
|
protected void |
onPeerFailure(Json msg)
Called by default by the framework in case a peer send
a
Failure performative and there's no transition
defined for it. |
protected void |
onPeerNotUnderstand(Json msg)
Called by default by the framework in case a peer send
a
NotUnderstand performative and there's no transition
defined for it. |
public FSMActivity()
Default constructor - thisPeer, ID etc must be set separately.
public FSMActivity(HyperGraphPeer thisPeer)
public FSMActivity(HyperGraphPeer thisPeer, java.util.UUID id)
protected void onPeerFailure(Json msg)
Called by default by the framework in case a peer send
a Failure
performative and there's no transition
defined for it.
The default implementation of this method is to fail the whole
activity. To change this behavior, you can either define appropriate
transition for the Failure
performative or simply
override this method in your activity class.
msg
- The message that is reporting the peer failure.protected void onPeerNotUnderstand(Json msg)
Called by default by the framework in case a peer send
a NotUnderstand
performative and there's no transition
defined for it.
The default implementation of this method is to fail the whole
activity. To change this behavior, you can either define appropriate
transition for the NotUnderstand
performative or simply
override this method in your activity class.
msg
- The message that is reporting the peer failure.public void initiate()
Empty method - override to implement activity initiation.
public final void handleMessage(Json message)
Empty method - can't override because message handling for
FSMActivity
is automated by the framework.
handleMessage
in class Activity
message
- The full message.