commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ingmar Kliche" <>
Subject Re: [SCXML] two scxml questions
Date Fri, 20 Jun 2008 16:48:53 GMT

please find my comments inline.

2008/6/20 Wolfgang Rabl <>:
> Hello!
> I am new in commonsSCXML and have two questions:
> If i declare a variable in my scxml file as the example in the Documentation
> suggests i get an error:
> My scxml file:
> <scxml xmlns=""
>     version="1.0"
>     initialstate="hello">
>   <state id="hello">
>        <onentry>
>            <var name="foo" expr="'bar'" />
>       </onentry>
>   </state>
> </scxml>
> But here I get a Warning at the startup:
>            Ignoring element <var> in namespace
> "" at file:main.scxml:34:38 and digester
> match "scxml/state/onentry/var"
> What might be the problem here?

The <var> tag is not part of the current SCXML working draft
( anymore. Therefore within commons SCXML
it went into another namespace.

see also:

> my second question is about registering listeners for notifications of state
> machine execution events. In the stopwatch example such a listener is
> implemented for the 3 events onEntry,OnExit and onTransition,
> but this one only retrieves the stateID and calls a method of the same name
> by using reflection.
> Is it possible to get more parameters that can be used later in the Method?
> For example i would like to implement a state, that is reached because of
> some special _eventdata. Now the entry into this state triggers a methodcall
> and within the method I want to know the content of the _eventdata. If thats
> not possible at least i would like to have access to the datamodel of the
> Statemachine so i could buffer the _eventdata there (if i figure out how the
> <var> tags work)

There are several ways to execute methods within the interpreter
environment. The question is whether

a) you want the author (of the SCXML document) to have explicit
control of the method invocation (by explicitly using a tag) or
b) the interpreter environment should execute the method implicitly
(e.g. when entering some special state), i.e. without author control.

For b) the event listener is the right choice as it is called by the
interpreter without control of the author.

For a) you could either implement a custom action
( and call
this within <onentry> of the target state or you could use the <send>
tag to call a method. For the <send> tag you would have to register an
EventDispatcher (i.e. implement the EventDispatcher interface). This
EventDispatcher's send() function gets called on execution of the
<send> tag if the targettype is not "scxml" and/or the "delay"
attribute is not zero. You can pass parameters (using the namelist
attribute) and so you could pass every information from the datamodel.

If you decide on a) or b) we could give you more precise information.

> I would really appreciate your help in this manner.
> Wolfgang


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message