commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wolfgang Rabl <wolfgang.r...@maven.at>
Subject Re: [SCXML] two scxml questions
Date Wed, 02 Jul 2008 15:57:28 GMT
Thank you for your quick reply!

well, i would be particular interested in b)

I allready tried using the event listeners and they work quite well, but 
my problem here is the lack of information within the listener 
functions(i.e.onEntry). I would like to pass over additional data from 
the SCXML engine, not only the id of the current state.

It is possible to get access to the datamodel by using the 
TransitionTarget Object that is passed into the function, but i have got 
a problem here: This datamodel contains all the data specified in the 
scxml file, but only the initial values. Even if something changes the 
values of the datamodel within the scxml engine i can only get the old 
values in the listener functions. Why is that so? Am I doing something 
wrong here? Whats the right way to get access to the datamodel from the 
listener?

One more question:
When i take a look at the interaction patterns statet in 
http://commons.apache.org/scxml/guide/using-commons-scxml.html ,  b) 
should map to "Listening to state machine progress". Now i am not quite 
sure about the first patter, the "Mapping states to activities". May it 
be possible to explain this in other words than on that page? 
Unfortunately i am not able to understand that explanation there.

Thank you,
Wolfgang




Ingmar Kliche schrieb:
> 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
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message