|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.dpml.metro.runtime.DefaultStateMachine
public class DefaultStateMachine
Default state-machine implementation.
Field Summary | |
---|---|
static String |
PROPERTY_NAME
Constant name used to reference a state change in a property event. |
Constructor Summary | |
---|---|
DefaultStateMachine(EventQueue queue,
Logger logger,
State state)
Creation of a new state machine using a state graph. |
Method Summary | |
---|---|
void |
addStateListener(StateListener listener)
Add a state change listener to the state machine. |
State |
apply(String name,
Object object)
Apply a named transition to the target object. |
void |
dispose()
Dispose of the state machine. |
Object |
execute(String name,
Object object,
Object[] args)
Execute a named operation on the supplied object. |
EventListener[] |
getEventListeners()
Return the assigned state event listeners. |
Action |
getInitializationAction()
Locate and return the most immediate initialization action defined relative to the current state. |
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. |
Action |
getTerminationAction()
Locate and return the most immediate termination action defined relative to 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 |
processEvent(EventObject event)
Process the supplied event. |
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. |
static void |
validate(State state)
Validate the state integrity. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String PROPERTY_NAME
Constructor Detail |
---|
public DefaultStateMachine(EventQueue queue, Logger logger, State state) throws RemoteException
queue
- the event queuelogger
- the logging channelstate
- the state graph
RemoteException
- if RMI exception occursMethod Detail |
---|
public static void validate(State state)
state
- the state to validatepublic void addStateListener(StateListener listener)
addStateListener
in interface StateMachine
listener
- the state listenerpublic void removeStateListener(StateListener listener)
removeStateListener
in interface StateMachine
listener
- the state listenerpublic EventListener[] getEventListeners()
getEventListeners
in interface EventHandler
public void processEvent(EventObject event)
processEvent
in interface EventHandler
event
- the event to processpublic State getState()
getState
in interface StateMachine
public Action getInitializationAction()
public Action getTerminationAction()
public State initialize(Object object) throws InvocationTargetException
initialize
in interface StateMachine
object
- the object to initialize
InvocationTargetException
- if an invocation error occurs as a
result of initializationpublic Object execute(String name, Object object, Object[] args) throws UnknownOperationException, InvocationTargetException
execute
in interface StateMachine
name
- an operation nameobject
- the target objectargs
- operation arguments
UnknownOperationException
- if the operation is unknown
InvocationTargetException
- if an invocation error occurs as a
result of operation executionpublic Object invoke(Object object, String method, Object[] args) throws UnknownOperationException, InvocationTargetException, IllegalStateException
invoke
in interface StateMachine
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 executionpublic State apply(String name, Object object) throws UnknownTransitionException, InvocationTargetException
apply
in interface StateMachine
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 invocationpublic Transition[] getTransitions()
getTransitions
in interface StateMachine
public Operation[] getOperations()
getOperations
in interface StateMachine
public Interface[] getInterfaces()
getInterfaces
in interface StateMachine
public State terminate(Object object)
terminate
in interface StateMachine
object
- the object to terminate
public boolean isActive()
isActive
in interface StateMachine
public void dispose()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |