|
© 2002 BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.beasys.commerce.ebusiness.order.StateMachine
A class for implementing finite state machines. The
state machine is created by parsing an XML document,
classes\orderstatus.xml.
The state machine helps get valid transitions based
on a current transition, so that an Order Status
can be moved to a valid new state.
Constructor Summary | |
StateMachine(java.lang.String domDocFile)
Constructor that takes as a parameter the name of an XML specification for the state machine. |
Method Summary | |
java.lang.String |
getFirstState()
Gets the first state an order can be set to, which should correspond to a SUBMITTED state. |
java.lang.String |
getNextStateName(java.lang.String currStateName,
java.lang.String event)
Gets the state that results from sending a specified event to a specified state. |
java.lang.String[] |
getValidEvents(java.lang.String stateName)
Gets the names of the events associated with transitions that lead from a specified state |
java.lang.String |
handleEvent(java.lang.Object targetObject,
java.lang.String currStateName,
java.lang.String event)
Handles an event for a given object, in particular invokes the onExitMethod, onEntryMethod, and doMethod if they exists |
static void |
main(java.lang.String[] argv)
A testing 'main' that uses the classes\orderstatus.xml and show a tree of the possible transitions |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public StateMachine(java.lang.String domDocFile) throws java.lang.Exception
domDocFile
- The name of the XML file that has the state machine's
specification, residing in the classpathMethod Detail |
public java.lang.String handleEvent(java.lang.Object targetObject, java.lang.String currStateName, java.lang.String event) throws StateTransitionException
targetObject:
- the target of the handlingcurrStateName:
- based on the current state, decides on which action to takeevent,
- based on the event being handled, decides on which action to takepublic java.lang.String getNextStateName(java.lang.String currStateName, java.lang.String event) throws StateTransitionException
currStateName
- The name of the current stateevent
- The event to be sent to the current statepublic java.lang.String[] getValidEvents(java.lang.String stateName)
stateName,
- the name of a state in the machinepublic java.lang.String getFirstState() throws StateTransitionException
public static void main(java.lang.String[] argv)
|
© 2002 BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |