|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface StateMachine
Defintion of the state machine. The state machine handles the maintenance of a single current state and supports the invocation of transition and operations relative to the current state. Invocation of transiton and operations are handled via two mechansims:
Triggers, Transitions, and Operations may be declared within any state and enter active scope when when the enclosing state is within the current state path (where the current state path is the sequence of state's from the current state to the root state).
Transitions and operations available at any given time are a function of all uniquely named transitions and operations exposed within the current state path. If multiple instances of a transition or operation share the same name, the instance closest to the current state takes precedence and the duplicate instance will not be exposed (equivalent to overriding the characteristics of a super-state).
Triggers are structures that hold a single action (transition or operation) and are invoked automatically by a state machine implementation as a part of initialization and termination requests. If a trigger contains a transition resulting that results in a change to the current state a state-machine will recursively evaluate triggers in the new current state path. The process of recursive evaluation of triggers will continue until a state is reached where no further trigger invocation is possible.
Method Summary | |
---|---|
void |
addStateListener(StateListener listener)
Add a state change listener to the state machine. |
State |
apply(String name,
Object object)
Apply a named state transition. |
Object |
execute(String name,
Object object,
Object[] args)
Execute a named operation on the supplied object. |
Interface[] |
getInterfaces()
Return all of the available interfaces relative to the current state. |
Operation[] |
getOperations()
Return all of the available operations relative to the current state. |
State |
getState()
Return the current state. |
Transition[] |
getTransitions()
Return all of the available transitions relative to the current state. |
State |
initialize(Object object)
Invoke initialization of the supplied object using the initialization action declared under the current state path. |
Object |
invoke(Object object,
String method,
Object[] args)
Invoke a management method on the supplied object. |
boolean |
isActive()
Returns the active status of the state machine. |
void |
removeStateListener(StateListener listener)
Remove a state listener from the state machine. |
State |
terminate(Object object)
Invoke termination of the supplied object using the termination action declared under the current state path. |
Method Detail |
---|
void addStateListener(StateListener listener)
listener
- the state listenervoid removeStateListener(StateListener listener)
listener
- the state listenerState getState()
State initialize(Object object) throws InvocationTargetException
object
- the object to initialize
InvocationTargetException
- if an invocation error occurs as a
result of initializationObject execute(String name, Object object, Object[] args) throws UnknownOperationException, InvocationTargetException
name
- an operation nameobject
- the target objectargs
- operation argument array
UnknownOperationException
- if the operation is unknown
InvocationTargetException
- if an invocation error occurs as a
result of operation executionObject invoke(Object object, String method, Object[] args) throws UnknownOperationException, InvocationTargetException, IllegalStateException
object
- the target objectmethod
- the method nameargs
- method parameter arguments
IllegalStateException
- if the method is recognized but not available
UnknownOperationException
- if the operation is unknown
InvocationTargetException
- if an invocation error occurs as a
result of operation executionState apply(String name, Object object) throws UnknownTransitionException, InvocationTargetException
name
- the transition nameobject
- the object against which any transition handler action are to be applied
UnknownTransitionException
- if the transition is unknown
InvocationTargetException
- if an invocation error occurs as a
result of transition invocationTransition[] getTransitions()
Operation[] getOperations()
Interface[] getInterfaces()
State terminate(Object object)
object
- the object to terminate
boolean isActive()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |