Ate Douma created SCXML-187:
-------------------------------
Summary: Add support for initial SCXML script (SCXML spec 3.2.2:
<scxml> children)
Key: SCXML-187
URL: https://issues.apache.org/jira/browse/SCXML-187
Project: Commons SCXML
Issue Type: New Feature
Affects Versions: 2.0
Reporter: Ate Douma
Assignee: Ate Douma
Fix For: 2.0
The SCXML spec [1] section 3.2.2 <scxml> children, defines as an allowable
child element:
- <script> Provides scripting capability. Occurs 0 or 1 times.
Current Commons SCXML doesn't yet support this feature, ignoring such initial
script element.
As this will be very useful also for the Groovy language support (SCXML-186),
I'll add this feature to Commons SCXML now.
Important to note is the Context to be provided to such initial script
execution.
The intend (at least in my interpretation) of using such an initial script is
that it can access as well as set any context (data) variable globally for the
rest of the document.
This means that the Context for the initial script execution much be a parent
Context for all other element, including sibling 'root' states.
Using the root Context for this purpose however is IMO not the right way as it
would (potentially) impact/change the outcome of a reset of the SCXMLExecutor,
which resets all Contexts except for the root Context (as being a provider of
*external* context).
So, the way I'm going to solve this is by introducing a separate
InitialScriptContext, having the root Context as parent and itself being used
as parent for all other contexts, and thereby properly resettable through
SCXMLExecutor reset.
[1] http://www.w3.org/TR/2013/WD-scxml-20130801/
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)