public class SCXMLExecutionContext extends Object implements SCXMLIOProcessor
Modifier and Type | Field and Description |
---|---|
static String |
SCXML_INVOKER_TYPE
Alias for
SCXML_INVOKER_TYPE_URI |
static String |
SCXML_INVOKER_TYPE_URI
Default and required supported SCXML Processor Invoker service URI
|
DEFAULT_EVENT_PROCESSOR, EVENT_PROCESSOR_ALIAS_PREFIX, INTERNAL_EVENT_PROCESSOR, PARENT_EVENT_PROCESSOR, SCXML_EVENT_PROCESSOR, SCXML_SESSION_EVENT_PROCESSOR_PREFIX
Modifier | Constructor and Description |
---|---|
protected |
SCXMLExecutionContext(SCXMLExecutor scxmlExecutor,
Evaluator evaluator,
EventDispatcher eventDispatcher,
ErrorReporter errorReporter)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
addEvent(TriggerEvent event)
Add an event to the internal event queue
|
protected void |
attachInstance(SCInstance instance)
Re-attach a previously detached SCInstance.
|
void |
cancelInvoker(Invoke invoke)
Cancel and remove an active Invoker
|
protected SCInstance |
detachInstance()
Detach the current SCInstance to allow external serialization.
|
ActionExecutionContext |
getActionExecutionContext() |
org.apache.commons.logging.Log |
getAppLog() |
ErrorReporter |
getErrorReporter() |
Evaluator |
getEvaluator() |
EventDispatcher |
getEventDispatcher() |
SCXMLIOProcessor |
getExternalIOProcessor() |
SCXMLIOProcessor |
getInternalIOProcessor() |
Map<Invoke,String> |
getInvokeIds() |
Invoker |
getInvoker(Invoke invoke)
|
String |
getLocation()
The SCXML specification section "C.1.1 _ioprocessors Value" states that the SCXMLEventProcessor must
maintain a 'location' field inside its entry in the _ioprocessors environment variable.
|
NotificationRegistry |
getNotificationRegistry() |
SCInstance |
getScInstance() |
SCXMLExecutor |
getSCXMLExecutor() |
SCXML |
getStateMachine() |
boolean |
hasPendingInternalEvent() |
void |
initialize()
Initialize method which will cancel all current active Invokers, clear the internal event queue and mark the
state machine process as running (again).
|
protected void |
initializeIOProcessors()
Initialize the _ioprocessors environment variable, which only can be done when the evaluator is available
|
boolean |
isCheckLegalConfiguration() |
boolean |
isRunning() |
Invoker |
newInvoker(String type)
Create a new
Invoker |
TriggerEvent |
nextInternalEvent() |
void |
registerInvoker(Invoke invoke,
Invoker invoker)
|
protected void |
registerInvokerClass(String type,
Class<? extends Invoker> invokerClass)
Register an Invoker for this target type.
|
void |
removeInvoker(Invoke invoke)
Remove a previously active Invoker, which must already have been canceled
|
void |
setCheckLegalConfiguration(boolean checkLegalConfiguration)
Set if the SCXML configuration should be checked before execution (default = true)
|
protected void |
setErrorReporter(ErrorReporter errorReporter)
Set or replace the error reporter
|
protected void |
setEvaluator(Evaluator evaluator)
Set or replace the evaluator
If the state machine instance has been initialized before, it will be initialized again, destroying all existing
state!
|
protected void |
setEventdispatcher(EventDispatcher eventdispatcher)
Set or replace the event dispatch
|
protected void |
setStateMachine(SCXML stateMachine)
Set or replace the state machine to be executed
If the state machine instance has been initialized before, it will be initialized again, destroying all existing
state!
|
void |
stopRunning()
Stop a running state machine
|
protected void |
unregisterInvokerClass(String type)
Remove the Invoker registered for this target type (if there is one registered).
|
public static final String SCXML_INVOKER_TYPE_URI
public static final String SCXML_INVOKER_TYPE
SCXML_INVOKER_TYPE_URI
protected SCXMLExecutionContext(SCXMLExecutor scxmlExecutor, Evaluator evaluator, EventDispatcher eventDispatcher, ErrorReporter errorReporter)
scxmlExecutor
- The SCXMLExecutor of this SCXMLExecutionContextevaluator
- The evaluatoreventDispatcher
- The event dispatcher, if null a SimpleDispatcher instance will be usederrorReporter
- The error reporter, if null a SimpleErrorReporter instance will be usedpublic SCXMLExecutor getSCXMLExecutor()
public SCXMLIOProcessor getExternalIOProcessor()
public SCXMLIOProcessor getInternalIOProcessor()
public ActionExecutionContext getActionExecutionContext()
public boolean isRunning()
public void stopRunning()
public void setCheckLegalConfiguration(boolean checkLegalConfiguration)
checkLegalConfiguration
- flag to setpublic boolean isCheckLegalConfiguration()
public void initialize() throws ModelException
ModelException
- if the state machine instance failed to initialize.public org.apache.commons.logging.Log getAppLog()
public SCXML getStateMachine()
protected void setStateMachine(SCXML stateMachine) throws ModelException
If the state machine instance has been initialized before, it will be initialized again, destroying all existing state!
stateMachine
- The state machine to setModelException
- if attempting to set a null value or the state machine instance failed to re-initializepublic String getLocation()
public SCInstance getScInstance()
public Evaluator getEvaluator()
protected void setEvaluator(Evaluator evaluator) throws ModelException
If the state machine instance has been initialized before, it will be initialized again, destroying all existing state!
evaluator
- The evaluator to setModelException
- if attempting to set a null value or the state machine instance failed to re-initializepublic ErrorReporter getErrorReporter()
protected void setErrorReporter(ErrorReporter errorReporter)
errorReporter
- The error reporter to set, if null a SimpleErrorReporter instance will be used insteadpublic EventDispatcher getEventDispatcher()
protected void setEventdispatcher(EventDispatcher eventdispatcher)
eventdispatcher
- The event dispatcher to set, if null a SimpleDispatcher instance will be used insteadpublic NotificationRegistry getNotificationRegistry()
protected void initializeIOProcessors()
protected SCInstance detachInstance()
attachInstance(SCInstance)
can be used to re-attach a previously detached instance
protected void attachInstance(SCInstance instance)
Note: an already attached instance will get overwritten (and thus lost).
instance
- An previously detached SCInstanceprotected void registerInvokerClass(String type, Class<? extends Invoker> invokerClass)
type
- The target type (specified by "type" attribute of the invoke element).invokerClass
- The Invoker class.protected void unregisterInvokerClass(String type)
type
- The target type (specified by "type" attribute of the invoke element).public Invoker newInvoker(String type) throws InvokerException
Invoker
type
- The type of the target being invoked.Invoker
for the specified type, if an
invoker class is registered against that type,
null
otherwise.InvokerException
- When a suitable Invoker
cannot be instantiated.public Invoker getInvoker(Invoke invoke)
Invoker
for this Invoke
.
May return null
. A non-null Invoker
will be
returned if and only if the Invoke
parent TransitionalState is
currently active and contains the <invoke> child.invoke
- The Invoke
.public void registerInvoker(Invoke invoke, Invoker invoker) throws InvokerException
invoke
- The Invoke.invoker
- The Invoker.InvokerException
- when the Invoker doesn't have an invokerIdpublic void removeInvoker(Invoke invoke)
invoke
- The Invoke for the Invoker to removepublic Map<Invoke,String> getInvokeIds()
public void cancelInvoker(Invoke invoke)
invoke
- The Invoke for the Invoker to cancelpublic void addEvent(TriggerEvent event)
addEvent
in interface SCXMLIOProcessor
event
- The eventpublic TriggerEvent nextInternalEvent()
public boolean hasPendingInternalEvent()
Copyright © 2005–2015 The Apache Software Foundation. All rights reserved.