[
https://issues.apache.org/jira/browse/SCXML-187?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Ate Douma updated SCXML-187:
----------------------------
Description:
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.
Also of importance to mention is when and how this initial script will be
executed.
The initial script (if defined) will be stored as a (self) Transition action of
a synthesized Action (no parent, no children) and stored in the SCXML model
object.
During the SCXML initialization/reset by the SCXMLExecutor this script (parent
transition) then will be injected it in the initial step transition list and
thereby executed as first action.
As a transition action, the initial script execution won't 'trigger' any event,
only registered listeners will be notified of its 'transition'
[1] http://www.w3.org/TR/2013/WD-scxml-20130801/
was:
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/
> 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.
> Also of importance to mention is when and how this initial script will be
> executed.
> The initial script (if defined) will be stored as a (self) Transition action
> of a synthesized Action (no parent, no children) and stored in the SCXML
> model object.
> During the SCXML initialization/reset by the SCXMLExecutor this script
> (parent transition) then will be injected it in the initial step transition
> list and thereby executed as first action.
> As a transition action, the initial script execution won't 'trigger' any
> event, only registered listeners will be notified of its 'transition'
> [1] http://www.w3.org/TR/2013/WD-scxml-20130801/
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)