commons-user mailing list archives

Wolfgang,
please find my comments inline.
2008/6/20 Wolfgang Rabl <wolfgang.rabl@maven.at>:
> 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="http://www.w3.org/2005/07/scxml"
> 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
> "http://www.w3.org/2005/07/scxml" 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
(http://www.w3.org/TR/scxml) anymore. Therefore within commons SCXML
it went into another namespace.
see also:
http://www.nabble.com/SCXML-%3Cvar%3E.-handled-differently-between-SCXMLDigester-and-SCXMLParser---td15132386.html#a15155662
>
> 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
(http://commons.apache.org/scxml/guide/custom-actions.html) 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
-Ingmar.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org