ScxmlImplementation

Kevin Brightwell edited this page Aug 26, 2015 · 1 revision
Clone this wiki locally

The following describes the SCXML generator and importer implemented in Umple. For more information about SCXML itself: http://www.w3.org/TR/scxml/

SCXML Generator

The SCXML Generator uses umple generation templates to generate scxml code from umple source code.

The source code for the generator can be found here:

Implemented:

  • states
  • nested states
  • entry/exit actions
  • do activities
  • transitions
  • guarded transitions
  • transition actions
  • auto-transitions

Could not implement:

  • Timed transitions: there is no notion of delay in scxml
  • Events with parameters: we need to better understand scxml datamodels and correctly implement the translation of executable content before we can make this work.
  • Queued and Pooled state machines: those properties are specific to umple state machines and cannot be translated to scxml

Note: Although we generate actions and do activities, please note that the resulting scxml document does not conform to w3c standards. This is because umple state machines use java to define actions and do activies. However, depending on the datamodel used, scxml documents can only define executable content with ECMAScript languages only. For more information: http://www.w3.org/TR/scxml/#profiles.

SCXML importer

The source code for the SCXML Importer can be found in the following files:

  • UmpleImport.ump
  • UmpleImport_CodeHandlers.ump
  • UmpleImport_CodeModels.ump

In those files, the following classes contain most of the logic for the importer:

  • ScxmlImportHandler: the class that other classes representing scxml elements inherit from.
  • ImportStateMachine: the class representing the state machine. It is instantiated when the parser encounters a <scxml> tag.
  • ImportStateMachineState: the class representing a state in the state machine. It is instantiated when the parser encounters a <state> tag.
  • ImportTransition: the class that represents a transition. It is instantiated when the parser encounters a <transition> tag.
  • ImportAction: the class that represents an entry or exit action. It is instantiated when the parser encounters an <entry> or an <exit> tag.

The following tags are parsed by the importer:

  • <scxml>
  • <state>
  • <entry>
  • <exit>
  • <script>
  • <initial>

The following are not parsed right now:

Suggested improvements on the implementation: