The Invoker interface is used to define the possible interactions
between the parent state machine (executor) and the types of invocable
activities.
Invocable activities must first register an Invoker implementation class
for the appropriate "targettype" (attribute of <invoke>) with the
parent SCXMLExecutor .
The communication link between the parent state machine executor and
the invoked activity is a bi-directional events pipe.
All events triggered on the parent state machine get forwarded to the
invoked activity. The processing semantics for these events depend
upon the "targettype", and thereby vary per concrete implementation of
this interface.
The invoked activity in turn must fire a special "done" event
when it concludes. It may fire additional events before the "done"
event. The semantics of any additional events depend upon the
"targettype". The invoked activity must not fire any events after the
"done" event. The name of the special "done" event must be
the ID of the parent state wherein the corresponding <invoke>
resides, with the String ".invoke.done" appended.
The Invoker "lifecycle" is outlined below:
- Instantiation via
Class.newInstance (Invoker implementation requires accessible constructor).
- Configuration (setters for parent state ID and
SCInstance ).
- Initiation of invoked activity via invoke() method, passing
the source URI and the map of params.
- Zero or more bi-directional event triggering.
- Either completion or cancellation.
|