|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | PROPERTY | METHOD | DETAIL: FIELD | PROPERTY | METHOD |
interface StateMachine
Represents the state machine (states, transitions and action to take on each)
Property Summary | |
---|---|
static java.lang.Object |
NONE
|
Method Summary | |
---|---|
java.lang.Object
|
clearError()
|
java.lang.Object
|
executeAction(java.lang.Object action, java.lang.Object closure)
Execute the action: sets the state machine in transition state, execute the closure and then move to the final state. |
java.lang.Object
|
findEndState(java.lang.Object action)
Returns the end state that the state machine would be if the action were to be executed. |
java.lang.Object
|
findPaths(java.lang.Object toState)
Equivalent to |
java.lang.Object
|
findPaths(java.lang.Object fromState, java.lang.Object toState)
Returns a list of paths to go from |
java.lang.Object
|
findShortestPath(java.lang.Object toState)
Equivalent to |
java.lang.Object
|
findShortestPath(java.lang.Object fromState, java.lang.Object toState)
Returns the shortest path (list of transitions) to go from |
void
|
forceChangeState(java.lang.Object currentState, java.lang.Object error)
This method is used to change the state and should be used carefully. |
java.lang.Object
|
getAvailableActions()
Returns all available actions |
java.lang.Object
|
getAvailableStates()
returns all available states |
java.lang.Object
|
getAvailableTransitions()
|
java.lang.Object
|
getCurrentState()
|
java.lang.Object
|
getEndState(java.lang.Object action)
Returns the end state associated to a specific action in the state machine. |
java.lang.Object
|
getError()
|
java.lang.Object
|
getState()
Return a coherent view of the state (like calling each individual methods, but guaranteed to be atomic). |
java.lang.Object
|
getTransitionAction()
|
java.lang.Object
|
getTransitionState()
|
java.lang.Object
|
getTransitions()
|
void
|
setStateChangeListener(StateChangeListener stateChangeListener)
Sets a listener to know when the state changes |
java.lang.Object
|
waitForState(java.lang.Object state, java.lang.Object timeout)
Wait for the state machine to be in the provided state. |
Property Detail |
---|
static java.lang.Object NONE
Method Detail |
---|
java.lang.Object clearError()
java.lang.Object executeAction(java.lang.Object action, java.lang.Object closure)
java.lang.Object findEndState(java.lang.Object action)
java.lang.Object findPaths(java.lang.Object toState)
findPaths(currentState, toState)
java.lang.Object findPaths(java.lang.Object fromState, java.lang.Object toState)
fromState
to toState
. If there
is no paths, then an empty list is returned. There can be mulitple paths, this is why it
returns a list. Each path is a list of transitions (same as what is returned in
getTransitions()).
Example of result: [[[to: 'NONE', action: 'uninstall']], [[to: 'stopped', action: 'configure'], [to: 'NONE', action: 'uninstall']], ...]
java.lang.Object findShortestPath(java.lang.Object toState)
findShortestPath(currentState, toState)
java.lang.Object findShortestPath(java.lang.Object fromState, java.lang.Object toState)
fromState
to
toState
This call returns the shortest path (if there is more than one shortest path, one of them
will be returned. Although no guarantee is made on which one would be returned, the same
one would be returned if you call the method mutliple times)
void forceChangeState(java.lang.Object currentState, java.lang.Object error)
currentState
- the new current state (can be null
in which case we keep
the current one)error
- the new error state
java.lang.Object getAvailableActions()
java.lang.Object getAvailableStates()
java.lang.Object getAvailableTransitions()
java.lang.Object getCurrentState()
java.lang.Object getEndState(java.lang.Object action)
null
if the given action was not found.
java.lang.Object getError()
java.lang.Object getState()
[currentState: x, transitionState: x, transitionAction: x, error: x]
(transition*
and error
are optional)
java.lang.Object getTransitionAction()
java.lang.Object getTransitionState()
java.lang.Object getTransitions()
void setStateChangeListener(StateChangeListener stateChangeListener)
java.lang.Object waitForState(java.lang.Object state, java.lang.Object timeout)
timeout
- may be null
for unlimited waitingtrue
if the state was reached during the timeout,
false
otherwise
Groovy Documentation