Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.scxml
Class SCXMLExecutor

    java.lang.Object
      org.apache.commons.scxml.SCXMLExecutor

All Implemented Interfaces:
  Serializable

public class SCXMLExecutor
extends Object
implements Serializable

The SCXML "engine" that executes SCXML documents. The particular semantics used by this engine for executing the SCXML are encapsulated in the SCXMLSemantics implementation that it uses.

The default implementation is `org.apache.commons.scxml.semantics.SCXMLSemanticsImpl`

See Also:
  `SCXMLSemantics`, Serialized Form

Constructor Summary
`SCXMLExecutor()` Convenience constructor.
`SCXMLExecutor(Evaluator expEvaluator, EventDispatcher evtDisp, ErrorReporter errRep)` Constructor.
`SCXMLExecutor(Evaluator expEvaluator, EventDispatcher evtDisp, ErrorReporter errRep, SCXMLSemantics semantics)` Constructor.

Method Summary
`void` | `addListener(SCXML scxml, SCXMLListener listener)` Add a listener to the document root.
`void` | `addListener(Transition transition, SCXMLListener listener)` Add a listener to this transition.
`void` | `addListener(TransitionTarget transitionTarget, SCXMLListener listener)` Add a listener to this transition target.
`Status` | `getCurrentStatus()` Get the current status.
`ErrorReporter` | `getErrorReporter()` Get the environment specific error reporter.
`Evaluator` | `getEvaluator()` Get the expression evaluator in use.
`EventDispatcher` | `getEventdispatcher()` Get the event dispatcher.
`Context` | `getRootContext()` Get the root context for this execution.
`SCXML` | `getStateMachine()` Get the state machine that is being executed.
`void` | `go()` Initiate state machine execution.
`boolean` | `isSuperStep()` Use "super-step", default is `true` (that is, run-to-completion is default).
`void` | `registerInvokerClass(String targettype, Class invokerClass)` Register an `Invoker` for this target type.
`void` | `removeListener(SCXML scxml, SCXMLListener listener)` Remove this listener from the document root.
`void` | `removeListener(Transition transition, SCXMLListener listener)` Remove this listener for this transition.
`void` | `removeListener(TransitionTarget transitionTarget, SCXMLListener listener)` Remove this listener for this transition target.
`void` | `reset()` Clear all state and begin from "initialstate" indicated on root SCXML element.
`void` | `setErrorReporter(ErrorReporter errorReporter)` Set the environment specific error reporter.
`void` | `setEvaluator(Evaluator evaluator)` Set the expression evaluator.
`void` | `setEventdispatcher(EventDispatcher eventdispatcher)` Set the event dispatcher.
`void` | `setRootContext(Context rootContext)` Set the root context for this execution.
`void` | `setStateMachine(SCXML stateMachine)` Set the state machine to be executed.
`void` | `setSuperStep(boolean superStep)` Set the super step.
`void` | `triggerEvent(TriggerEvent evt)` Convenience method when only one event needs to be triggered.
`void` | `triggerEvents(TriggerEvent[] evts)` The worker method.
`void` | `unregisterInvokerClass(String targettype)` Remove the `Invoker` registered for this target type (if there is one registered).

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SCXMLExecutor

    public SCXMLExecutor(Evaluator expEvaluator,
                         EventDispatcher evtDisp,
                         ErrorReporter errRep)

  Constructor.

Parameters:
  `expEvaluator` - The expression evaluator
  `evtDisp` - The event dispatcher
  `errRep` - The error reporter

### SCXMLExecutor

    public SCXMLExecutor()

  Convenience constructor.

### SCXMLExecutor

    public SCXMLExecutor(Evaluator expEvaluator,
                         EventDispatcher evtDisp,
                         ErrorReporter errRep,
                         SCXMLSemantics semantics)

  Constructor.

Parameters:
  `expEvaluator` - The expression evaluator
  `evtDisp` - The event dispatcher
  `errRep` - The error reporter
  `semantics` - The SCXML semantics

Method Detail

### triggerEvents

    public void triggerEvents(TriggerEvent[] evts)
                       throws ModelException

  The worker method. Re-evaluates current status whenever any events are triggered.

  Parameters:
    `evts` - an array of external events which triggered during the last time quantum
  Throws:
    `ModelException` - in case there is a fatal SCXML object model problem.

### triggerEvent

    public void triggerEvent(TriggerEvent evt)
                      throws ModelException

  Convenience method when only one event needs to be triggered.

  Parameters:
    `evt` - the external events which triggered during the last time quantum
  Throws:
    `ModelException` - in case there is a fatal SCXML object model problem.

### reset

    public void reset()
               throws ModelException

  Clear all state and begin from "initialstate" indicated on root SCXML element.

  Throws:
    `ModelException` - in case there is a fatal SCXML object model problem.

### getCurrentStatus

    public Status getCurrentStatus()

  Get the current status.

  Returns:
    The current Status

### setEvaluator

    public void setEvaluator(Evaluator evaluator)

  Set the expression evaluator. NOTE: Should only be used before the executor is set in motion.

  Parameters:
    `evaluator` - The evaluator to set.

### getEvaluator

    public Evaluator getEvaluator()

  Get the expression evaluator in use.

  Returns:
    Evaluator The evaluator in use.

### setRootContext

    public void setRootContext(Context rootContext)

  Set the root context for this execution. NOTE: Should only be used before the executor is set in motion.

  Parameters:
    `rootContext` - The Context that ties to the host environment.

### getRootContext

    public Context getRootContext()

  Get the root context for this execution.

  Returns:
    Context The root context.

### getStateMachine

    public SCXML getStateMachine()

  Get the state machine that is being executed. NOTE: This is the state machine definition or model used by this executor instance. It may be shared across multiple executor instances and as a best practice, should not be altered. Also note that manipulation of instance data for the executor should happen through its root context or state contexts only, never through the direct manipulation of any `Datamodel`s associated with this state machine definition.

  Returns:
    Returns the stateMachine.

### setStateMachine

    public void setStateMachine(SCXML stateMachine)

  Set the state machine to be executed. NOTE: Should only be used before the executor is set in motion.

  Parameters:
    `stateMachine` - The stateMachine to set.

### go

    public void go()
            throws ModelException

  Initiate state machine execution.

  Throws:
    `ModelException` - in case there is a fatal SCXML object model problem.

### getErrorReporter

    public ErrorReporter getErrorReporter()

  Get the environment specific error reporter.

  Returns:
    Returns the errorReporter.

### setErrorReporter

    public void setErrorReporter(ErrorReporter errorReporter)

  Set the environment specific error reporter.

  Parameters:
    `errorReporter` - The errorReporter to set.

### getEventdispatcher

    public EventDispatcher getEventdispatcher()

  Get the event dispatcher.

  Returns:
    Returns the eventdispatcher.

### setEventdispatcher

    public void setEventdispatcher(EventDispatcher eventdispatcher)

  Set the event dispatcher.

  Parameters:
    `eventdispatcher` - The eventdispatcher to set.

### isSuperStep

    public boolean isSuperStep()

  Use "super-step", default is `true` (that is, run-to-completion is default).

  Returns:
    Returns the superStep property.
  See Also:
    `setSuperStep(boolean)`

### setSuperStep

    public void setSuperStep(boolean superStep)

  Set the super step.

  Parameters:
    `superStep` - if true, the internal derived events are also processed (run-to-completion); if false, the internal derived events are stored in the CurrentStatus property and processed within the next triggerEvents() invocation, also the immediate (empty event) transitions are deferred until the next step

### addListener

    public void addListener(SCXML scxml,
                            SCXMLListener listener)

  Add a listener to the document root.

  Parameters:
    `scxml` - The document root to attach listener to.
    `listener` - The SCXMLListener.

### removeListener

    public void removeListener(SCXML scxml,
                               SCXMLListener listener)

  Remove this listener from the document root.

  Parameters:
    `scxml` - The document root.
    `listener` - The SCXMLListener to be removed.

### addListener

    public void addListener(TransitionTarget transitionTarget,
                            SCXMLListener listener)

  Add a listener to this transition target.

  Parameters:
    `transitionTarget` - The `TransitionTarget` to attach listener to.
    `listener` - The SCXMLListener.

### removeListener

    public void removeListener(TransitionTarget transitionTarget,
                               SCXMLListener listener)

  Remove this listener for this transition target.

  Parameters:
    `transitionTarget` - The `TransitionTarget`.
    `listener` - The SCXMLListener to be removed.

### addListener

    public void addListener(Transition transition,
                            SCXMLListener listener)

  Add a listener to this transition.

  Parameters:
    `transition` - The `Transition` to attach listener to.
    `listener` - The SCXMLListener.

### removeListener

    public void removeListener(Transition transition,
                               SCXMLListener listener)

  Remove this listener for this transition.

  Parameters:
    `transition` - The `Transition`.
    `listener` - The SCXMLListener to be removed.

### registerInvokerClass

    public void registerInvokerClass(String targettype,
                                     Class invokerClass)

  Register an `Invoker` for this target type.

  Parameters:
    `targettype` - The target type (specified by "targettype" attribute of <invoke> tag).
    `invokerClass` - The `Invoker` `Class`.

### unregisterInvokerClass

    public void unregisterInvokerClass(String targettype)

  Remove the `Invoker` registered for this target type (if there is one registered).

  Parameters:
    `targettype` - The target type (specified by "targettype" attribute of <invoke> tag).

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005-2008 The Apache Software Foundation. All Rights Reserved.