DPML
DPML Metro Graph State Datatype
HomeUtilitiesStationMetro
State Datatype
Description

A state is an immutable datastructure that defines a collection of available transitions, management operations, and possibly initialization or termination triggers. Actionable features of a state are exposed when the state is within the current state path. The current state path is a path composed of the current state, it's parent, parent's patrent, etc. unit the root state is reached. As such, any operations declared within the root state will always be available where operations and/transitions in sub-states will only available if the associated state is present in the state path.

Attributes
name Set the state name.
terminal If set to 'true' the state will be classified as a terminal state.
Nested Elements
trigger An initialization or termination trigger.
state A nested state.
transition A state transition.
operation A management operation.
Example
<project name="standalone-graph-example" default="install"
    xmlns:transit="antlib:dpml.tools.transit" 
    xmlns:x="dpml:depot" 
    xmlns:c="dpml:metro">

  <transit:import uri="local:template:dpml/tools/standard"/>

  <target name="build" depends="standard.build">
    <x:plugin uri="link:plugin:dpml/metro/dpml-metro-tools"/>
    <c:state>
      <trigger event="initialization">
        <transition name="startup" target="started">
          <operation method="start"/>
        </transition>
      </trigger>
      <state name="started">
        <trigger event="termination">
          <apply id="stop"/>
        </trigger>
        <transition name="stop" target="../stopped">
          <operation method="stop"/>
        </transition>
      </state>
      <state name="stopped">
        <transition name="start" target="../started">
          <operation method="start"/>
        </transition>
      </state>
    </c:state>
  </target>

</project>