Uploaded image for project: 'Commons SCXML'
  1. Commons SCXML
  2. SCXML-187

Add support for initial SCXML script (SCXML spec 3.2.2: <scxml> children)

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.0
    • 2.0
    • None

    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/

      Attachments

        Activity

          People

            ate Ate Douma
            ate Ate Douma
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: