Collection internalEvents = step.getAfterStatus().getEvents();
Map invokers = scInstance.getInvokers();
// ExecutePhaseActions / OnExit
for (Iterator i = step.getExitList().iterator(); i.hasNext();) {
TransitionTarget tt = (TransitionTarget) i.next();
OnExit oe = tt.getOnExit();
try {
for (Iterator onExitIter = oe.getActions().iterator();
onExitIter.hasNext();) {
((Action) onExitIter.next()).execute(evtDispatcher,
errRep, scInstance, appLog, internalEvents);
}
} catch (SCXMLExpressionException e) {
errRep.onError(ErrorConstants.EXPRESSION_ERROR, e.getMessage(),
oe);
}
// check if invoke is active in this state
if (invokers.containsKey(tt)) {
Invoker toCancel = (Invoker) invokers.get(tt);
try {
toCancel.cancel();
} catch (InvokerException ie) {
TriggerEvent te = new TriggerEvent(tt.getId()
+ ".invoke.cancel.failed", TriggerEvent.ERROR_EVENT);
internalEvents.add(te);
}
// done here, don't wait for cancel response
invokers.remove(tt);
}
nr.fireOnExit(tt, tt);
nr.fireOnExit(stateMachine, tt);
TriggerEvent te = new TriggerEvent(tt.getId() + ".exit",
TriggerEvent.CHANGE_EVENT);
internalEvents.add(te);
}
// ExecutePhaseActions / Transitions
for (Iterator i = step.getTransitList().iterator(); i.hasNext();) {
Transition t = (Transition) i.next();
try {
for (Iterator transitIter = t.getActions().iterator();
transitIter.hasNext();) {
((Action) transitIter.next()).execute(evtDispatcher,
errRep, scInstance, appLog, internalEvents);
}
} catch (SCXMLExpressionException e) {
errRep.onError(ErrorConstants.EXPRESSION_ERROR,
e.getMessage(), t);
}
List rtargets = t.getRuntimeTargets();
for (int j = 0; j < rtargets.size(); j++) {
TransitionTarget tt = (TransitionTarget) rtargets.get(j);
nr.fireOnTransition(t, t.getParent(), tt, t);
nr.fireOnTransition(stateMachine, t.getParent(), tt, t);
}
}
// ExecutePhaseActions / OnEntry
for (Iterator i = step.getEntryList().iterator(); i.hasNext();) {
TransitionTarget tt = (TransitionTarget) i.next();
OnEntry oe = tt.getOnEntry();
try {
for (Iterator onEntryIter = oe.getActions().iterator();
onEntryIter.hasNext();) {
((Action) onEntryIter.next()).execute(evtDispatcher,
errRep, scInstance, appLog, internalEvents);
}
} catch (SCXMLExpressionException e) {