| java.lang.Object org.apache.commons.scxml.env.AbstractStateMachine
All known Subclasses: org.apache.commons.scxml.env.StopWatch,
AbstractStateMachine | abstract public class AbstractStateMachine (Code) | | This class demonstrates one approach for providing the base
functionality needed by classes representing stateful entities,
whose behaviors are defined via SCXML documents.
SCXML documents (more generically, UML state chart diagrams) can be
used to define stateful behavior of objects, and Commons SCXML enables
developers to use this model directly into the corresponding code
artifacts. The resulting artifacts tend to be much simpler, embody
a useful separation of concerns and are easier to understand and
maintain. As the size of the modeled entity grows, these benefits
become more apparent.
This approach functions by registering an SCXMLListener that gets
notified onentry, and calls the namesake method for each state that
has been entered.
This class swallows all exceptions only to log them. Developers of
subclasses should think of themselves as "component developers"
catering to other end users, and therefore ensure that the subclasses
are free of ModelException s and the like. Most methods
are protected for ease of subclassing.
|
Inner Class :protected class EntryListener implements SCXMLListener | |
Method Summary | |
public boolean | fireEvent(String event) Fire an event on the SCXML engine.
Parameters: event - The event name. | public SCXMLExecutor | getEngine() Get the SCXML engine driving the "lifecycle" of the
instances of this class. | public Log | getLog() Get the log for this class. | public static SCXML | getStateMachine() Get the SCXML object representing this state machine. | public boolean | invoke(String methodName) Invoke the no argument method with the following name.
Parameters: methodName - The method to invoke. | protected void | logError(Exception exception) Utility method for logging error. | public boolean | resetMachine() Reset the state machine. | public void | setLog(Log log) Set the log for this class. |
AbstractStateMachine | public AbstractStateMachine(URL scxmlDocument)(Code) | | Convenience constructor.
Parameters: scxmlDocument - The URL pointing to the SCXML document thatdescribes the "lifecycle" of theinstances of this class. |
AbstractStateMachine | public AbstractStateMachine(URL scxmlDocument, Context rootCtx, Evaluator evaluator)(Code) | | Primary constructor.
Parameters: scxmlDocument - The URL pointing to the SCXML document thatdescribes the "lifecycle" of theinstances of this class. Parameters: rootCtx - The root context for this instance. Parameters: evaluator - The expression evaluator for this instance. See Also: Context See Also: Evaluator |
fireEvent | public boolean fireEvent(String event)(Code) | | Fire an event on the SCXML engine.
Parameters: event - The event name. Whether the state machine has reached a "final"configuration. |
getEngine | public SCXMLExecutor getEngine()(Code) | | Get the SCXML engine driving the "lifecycle" of the
instances of this class.
Returns the engine. |
getLog | public Log getLog()(Code) | | Get the log for this class.
Returns the log. |
getStateMachine | public static SCXML getStateMachine()(Code) | | Get the SCXML object representing this state machine.
Returns the stateMachine. |
invoke | public boolean invoke(String methodName)(Code) | | Invoke the no argument method with the following name.
Parameters: methodName - The method to invoke. Whether the invoke was successful. |
logError | protected void logError(Exception exception)(Code) | | Utility method for logging error.
Parameters: exception - The exception leading to this error condition. |
resetMachine | public boolean resetMachine()(Code) | | Reset the state machine.
Whether the reset was successful. |
setLog | public void setLog(Log log)(Code) | | Set the log for this class.
Parameters: log - The log to set. |
|
|