Implementation of a finite state machine (FSM) or finite state automaton, a model of behavior composed of states, transitions and actions. A state, represented by AMICO variables, stores information about the past, i.e. it reflects the input changes from the system start to the present moment. A transition indicates a state change and is described by a condition that would need to be fulfilled to enable the transition. An action is a description of an activity that is to be performed at a given moment.
java -jar %AMICO_HOME%/bin/amico-state-machine.jar [<conf-url>]
A main configuration file:
This is a minimal configuration file that uses default
parameters for missing attributes. --------------------------------------------- <?xml version="1.0"
encoding="UTF-8"?> |
This is a full configuration file that overrides default parameters. --------------------------------------------- <?xml version="1.0"
encoding="UTF-8"?> <command>UPDATE
last-loaded-module SM</command>
|
A configuration file for AMICO state machine adapter (linked from a main
configuration file):
<?xml version="1.0" encoding="UTF-8"?> <state-machine entry-state="state1" exit-state="state10"> <state id="state1"> <entry-action type="list"> <command timeOffsetMs="1000">UPDATE-DIRECT state-info Enter-state-1</command> </entry-action> <exit-action type="list"> <command timeOffsetMs="0">UPDATE-DIRECT state-info Exit-state-1</command> </exit-action> </state> <state id="state2"> <entry-action type="list"> <command timeOffsetMs="1000">UPDATE-DIRECT state-info Enter-state-2</command> </entry-action> <exit-action type="list"> <command timeOffsetMs="0">UPDATE-DIRECT state-info Exit-state-2</command> </exit-action> </state> <transition from="state1" to="state2" trigger="state[.='2']" trigger-on-every-update="true"> <transition-action type="list"> <command timeOffsetMs="1000">UPDATE-DIRECT age 12</command> <command timeOffsetMs="1000">UPDATE-DIRECT age 13</command> <command timeOffsetMs="1000">UPDATE-DIRECT age 20</command> <command timeOffsetMs="1000">UPDATE-DIRECT age 30</command> </transition-action> </transition> <transition from="state2" to="state3" trigger="test[.='xslt']" trigger-on-every-update="true"> <transition-action type="xml" input-type="empty" input="" xslt-url="file:conf/state-machine/derived-commands.xsl"> <parameter name="numberOfSteps" value="<%=number%>"/> <parameter name="startNumber" value="<%=number%>"/> <parameter name="user-id" value="<%=user-id%>"/--> </transition-action> </transition> <transition from="state3" to="state4" trigger="test[.='list']" trigger-on-every-update="true"> <transition-action type="list"> <command timeOffsetMs="1000">UPDATE-DIRECT age 12</command> <command timeOffsetMs="1000">UPDATE-DIRECT age 13</command> <command timeOffsetMs="1000">UPDATE-DIRECT age 20</command> <command timeOffsetMs="1000">UPDATE-DIRECT age 30</command> </transition-action> </transition> </state-machine> |
Each state (on entry and exit) and each transition runs a sequence of commands when transition trigger is activated. Sequence of commands can be given as list, as a link to a file that contains list of commands, or to a XSLT that derives list of commands. XSLT file can also receive parameters.