com.beasys.commerce.ebusiness.order
Class StateMachine

java.lang.Object
  extended by com.beasys.commerce.ebusiness.order.StateMachine
All Implemented Interfaces
Serializable

Deprecated See BEA Commerce product offering

@Deprecated
public class StateMachine
extends Object
implements Serializable

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.

See Also
Serialized Form

Constructor Summary
StateMachine(String domDocFile)
          Deprecated See BEA Commerce product offering
 
Method Summary
 String getFirstState()
          Deprecated See BEA Commerce product offering
 String getNextStateName(String currStateName, String event)
          Deprecated See BEA Commerce product offering
 String[] getValidEvents(String stateName)
          Deprecated See BEA Commerce product offering
 String handleEvent(Object targetObject, String currStateName, String event)
          Deprecated See BEA Commerce product offering
static void main(String[] argv)
          Deprecated See BEA Commerce product offering
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StateMachine

public StateMachine(String domDocFile)
             throws Exception
Deprecated See BEA Commerce product offering

Constructor that takes as a parameter the name of an XML specification for the state machine.

Parameters
domDocFile - The name of the XML file that has the state machine's specification, residing in the classpath
Throws
Exception
Method Detail

handleEvent

public String handleEvent(Object targetObject,
                          String currStateName,
                          String event)
                   throws StateTransitionException
Deprecated See BEA Commerce product offering

Handles an event for a given object, in particular invokes the onExitMethod, onEntryMethod, and doMethod if they exists

Parameters
targetObject: - the target of the handling
currStateName: - based on the current state, decides on which action to take
event, - based on the event being handled, decides on which action to take
Returns
the new state the object has moved to.
Throws
StateTransitionException

getNextStateName

public String getNextStateName(String currStateName,
                               String event)
                        throws StateTransitionException
Deprecated See BEA Commerce product offering

Gets the state that results from sending a specified event to a specified state.

Parameters
currStateName - The name of the current state
event - The event to be sent to the current state
Returns
The name of the new state
Throws
StateTransitionException

getValidEvents

public String[] getValidEvents(String stateName)
Deprecated See BEA Commerce product offering

Gets the names of the events associated with transitions that lead from a specified state

Parameters
stateName, - the name of a state in the machine
Returns
an array of String, one per reachable events.

getFirstState

public String getFirstState()
                     throws StateTransitionException
Deprecated See BEA Commerce product offering

Gets the first state an order can be set to, which should correspond to a SUBMITTED state.

Returns
the 'first' state, the source of transitions.
Throws
StateTransitionException

main

public static void main(String[] argv)
Deprecated See BEA Commerce product offering

A testing 'main' that uses the classes\orderstatus.xml and show a tree of the possible transitions



Copyright © 2008 BEA Systems, Inc. All Rights Reserved