You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Wolfgang Rabl <wo...@maven.at> on 2008/07/02 17:57:28 UTC

Re: [SCXML] two scxml questions

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 <wo...@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


Re: [SCXML] two scxml questions

Posted by Rahul Akolkar <ra...@gmail.com>.
On 7/11/08, Wolfgang Rabl <wo...@maven.at> wrote:
> Thanks very much, that was quite illustrating!
>
>  When working with custom actions, is it possible to pass over parameters
> other than Strings? Within the custom action implementation i get all the
> parameters and the childtagcontent as Strings and have to retrieve the
> corresponding datamodel information out of the scInstance parameter of the
> execute function. Is this the way to go or is there a simpler solution to
> pass over the parameters directly?
>
<snip/>

Instead of retrieving the corresponding datamodel (if that is indeed
what you are doing), you can use the expression evaluator [
scInstance.getEvaluator() ] instead. The former limits you to name
resolution, the latter gives you first-class expression evaluation.
You can see how that is used by looking at sources for existing
actions in the model package, for example, Var.java.

I will claim that there is no such thing as passing parameters
directly (its still passing strings, just that the strings are
expressions which are evaluated). Some environments have tricks that
enable them to pattern-match attribute values as being expressions
while other environments do this by providing additional meta-data
about attribute values being literal or expressions. The first is out
of question for custom actions (Commons SCXML supports pluggable ELs
so there isn't a single pattern to match) and its probably not any
easier to have another mechanism to describe where attributes values
are literals or not. Basically, the semantics of each attribute are
upto the custom action (and its implementation).

-Rahul


>  So for example if i have a scxml file i get foo and foo.bar only as strings
> and not as the objects they represent:
>
>    <state id="test">
>                <datamodel>
>                    <data name="foo"/>
>                </datamodel>
>               <onentry>
>                      <customAction1 param1="foo">
>                            <param2>foo.bar</param2>
>                      </customAction1>
>              </onentry>
>    </state>
>
>
>  thanks
>  Wolfgang
>
>
>  Rahul Akolkar schrieb:
>
> > On 7/9/08, Wolfgang Rabl <wo...@maven.at> wrote:
> >
> >
> >
> > > Hello,
> > >
> > >  Yes i will try the custom actions, but i dont think it would be a good
> idea
> > > to contribute my solution because I am quite unexperienced and it would
> not
> > > be a very good one :/ But i will see...
> > >
> > >  Nevertheless I have one further question regarding custom actions. As
> > > stated in
> > >
> http://commons.apache.org/scxml/guide/custom-actions.html
> > > it is possible to declare child Tags within the custom action if one
> > > implements the ExternalConten Interface. Are there any Examples for
> that? I
> > > do not know how to implement the necessary getExternalNodes() function.
> > > Whats the purpose of it? Is it to define the allowed childtags? and if
> so
> > > how are they defined? And how do i get access to the childtags within
> the
> > > execute funktion? It would realy be great if you could point me to an
> > > example implementation.
> > >
> > >
> > >
> > <snip/>
> >
> > Its easier to work without child tags, if possible (often, its not, so
> > see text below :-).
> >
> > Say you have a custom action like so (the semantics are not important
> > for the purposes of explaining the parsing):
> >
> >  <my:action>
> >      <my:foo/>
> >      <my:bar/>
> >  </my:action>
> >
> > Then the skeleton of the backing Action class may be implemented as:
> >
> >  public static class MyAction extends Action implements ExternalContent {
> >
> >    private List<Node> nodes = new ArrayList<Node>();
> >
> >    @Override
> >    public List<Node> getExternalNodes() {
> >      // this will be populated at parse time and used at execution time
> >      return nodes;
> >    }
> >
> >    @Override
> >    public void execute(...) throws ... {
> >      // Execute <my:action>, whatever the semantics are given
> >      // the child nodes.
> >      for (Node n : nodes) {
> >        // In this case, above loop executes twice since the "nodes"
> >        // list contains <my:foo/> and <my:bar/>
> >      }
> >    }
> >
> >  }
> >
> > -Rahul
> >
> >
> >
> >
> > >  thanks
> > >  Wolfgang
> > >
> > >
> > >
> > >
> > <snap/>

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


Re: [SCXML] two scxml questions

Posted by Wolfgang Rabl <wo...@maven.at>.
Thanks very much, that was quite illustrating!

When working with custom actions, is it possible to pass over parameters 
other than Strings? Within the custom action implementation i get all 
the parameters and the childtagcontent as Strings and have to retrieve 
the corresponding datamodel information out of the scInstance parameter 
of the execute function. Is this the way to go or is there a simpler 
solution to pass over the parameters directly?

So for example if i have a scxml file i get foo and foo.bar only as 
strings and not as the objects they represent:

    <state id="test">
                <datamodel>
                    <data name="foo"/>
                </datamodel>
               <onentry>
                      <customAction1 param1="foo">
                            <param2>foo.bar</param2>
                      </customAction1>
              </onentry>
    </state>


thanks
Wolfgang
   


Rahul Akolkar schrieb:
> On 7/9/08, Wolfgang Rabl <wo...@maven.at> wrote:
>   
>> Hello,
>>
>>  Yes i will try the custom actions, but i dont think it would be a good idea
>> to contribute my solution because I am quite unexperienced and it would not
>> be a very good one :/ But i will see...
>>
>>  Nevertheless I have one further question regarding custom actions. As
>> stated in
>> http://commons.apache.org/scxml/guide/custom-actions.html
>> it is possible to declare child Tags within the custom action if one
>> implements the ExternalConten Interface. Are there any Examples for that? I
>> do not know how to implement the necessary getExternalNodes() function.
>> Whats the purpose of it? Is it to define the allowed childtags? and if so
>> how are they defined? And how do i get access to the childtags within the
>> execute funktion? It would realy be great if you could point me to an
>> example implementation.
>>
>>     
> <snip/>
>
> Its easier to work without child tags, if possible (often, its not, so
> see text below :-).
>
> Say you have a custom action like so (the semantics are not important
> for the purposes of explaining the parsing):
>
>   <my:action>
>       <my:foo/>
>       <my:bar/>
>   </my:action>
>
> Then the skeleton of the backing Action class may be implemented as:
>
>   public static class MyAction extends Action implements ExternalContent {
>
>     private List<Node> nodes = new ArrayList<Node>();
>
>     @Override
>     public List<Node> getExternalNodes() {
>       // this will be populated at parse time and used at execution time
>       return nodes;
>     }
>
>     @Override
>     public void execute(...) throws ... {
>       // Execute <my:action>, whatever the semantics are given
>       // the child nodes.
>       for (Node n : nodes) {
>         // In this case, above loop executes twice since the "nodes"
>         // list contains <my:foo/> and <my:bar/>
>       }
>     }
>
>   }
>
> -Rahul
>
>
>   
>>  thanks
>>  Wolfgang
>>
>>
>>     
> <snap/>
>
> ---------------------------------------------------------------------
> 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


Re: [SCXML] two scxml questions

Posted by Rahul Akolkar <ra...@gmail.com>.
On 7/9/08, Wolfgang Rabl <wo...@maven.at> wrote:
> Hello,
>
>  Yes i will try the custom actions, but i dont think it would be a good idea
> to contribute my solution because I am quite unexperienced and it would not
> be a very good one :/ But i will see...
>
>  Nevertheless I have one further question regarding custom actions. As
> stated in
> http://commons.apache.org/scxml/guide/custom-actions.html
> it is possible to declare child Tags within the custom action if one
> implements the ExternalConten Interface. Are there any Examples for that? I
> do not know how to implement the necessary getExternalNodes() function.
> Whats the purpose of it? Is it to define the allowed childtags? and if so
> how are they defined? And how do i get access to the childtags within the
> execute funktion? It would realy be great if you could point me to an
> example implementation.
>
<snip/>

Its easier to work without child tags, if possible (often, its not, so
see text below :-).

Say you have a custom action like so (the semantics are not important
for the purposes of explaining the parsing):

  <my:action>
      <my:foo/>
      <my:bar/>
  </my:action>

Then the skeleton of the backing Action class may be implemented as:

  public static class MyAction extends Action implements ExternalContent {

    private List<Node> nodes = new ArrayList<Node>();

    @Override
    public List<Node> getExternalNodes() {
      // this will be populated at parse time and used at execution time
      return nodes;
    }

    @Override
    public void execute(...) throws ... {
      // Execute <my:action>, whatever the semantics are given
      // the child nodes.
      for (Node n : nodes) {
        // In this case, above loop executes twice since the "nodes"
        // list contains <my:foo/> and <my:bar/>
      }
    }

  }

-Rahul


>
>  thanks
>  Wolfgang
>
>
<snap/>

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


Re: [SCXML] two scxml questions

Posted by Wolfgang Rabl <wo...@maven.at>.
Hello,

Yes i will try the custom actions, but i dont think it would be a good 
idea to contribute my solution because I am quite unexperienced and it 
would not be a very good one :/ But i will see...

Nevertheless I have one further question regarding custom actions. As 
stated in http://commons.apache.org/scxml/guide/custom-actions.html it 
is possible to declare child Tags within the custom action if one 
implements the ExternalConten Interface. Are there any Examples for 
that? I do not know how to implement the necessary getExternalNodes() 
function. Whats the purpose of it? Is it to define the allowed 
childtags? and if so how are they defined? And how do i get access to 
the childtags within the execute funktion? It would realy be great if 
you could point me to an example implementation.

thanks
Wolfgang


Rahul Akolkar schrieb:
> On 7/4/08, Wolfgang Rabl <wo...@maven.at> wrote:
>   
>> Thank you for your answer
>>
>>  May i ask some further questions regarding datamodel manipulation...
>>  its very easy to change the value of a variable by using <assign>, but how
>> can i create a new one or delete an existing variable?
>>  and if i have a data tree, how can i add or delete entries there? for
>> example:
>>
>>      <datamodel>
>>        <data name="test">
>>          <rooms>
>>                 <room>kitchen</room>
>>                 <room>bedroom</room>
>>          </rooms>
>>        </data>
>>      </datamodel>
>>
>>  now i want to add a new room "bath" or delete the kitchen, is that possible
>> from within the scxml document? If not, how could that be done? By using a
>> custom action or by Jexl Method invokation?
>>
>>     
> <snip/>
>
> The corresponding <assign> variant "replaces the children". See the
> assign variants listed at the bottom of the datamodel guide:
>
>   http://commons.apache.org/scxml/guide/datamodel.html
>
> So there is no way to selectively add or remove a <room> above, using <assign>.
>
> You could do it either way (custom action or JEXL method), but custom
> actions would be more appropriate here IMO since they'd make the
> functionality available across ELs. So, one can imagine the following
> custom actions ...
>
>  <data:appendChild location="..." child="..."/>
>
>  <data:removeChild location="..." child="..."/>
>
> ... adjusted per taste, where each supports the corresponding
> equivalent on org.w3c.dom.Node. I think these would be quite useful
> additions to Commons SCXML, so if you end up implementing them, and if
> you'd like, you can contribute them back via JIRA:
>
>   http://commons.apache.org/scxml/issue-tracking.html
>
>
>   
>>  Oh and one more question, am i right that <SCRIPT> is not implemented in
>> commonsSCXML?
>>
>>     
> <snap/>
>
> Correct, implementations are not required to support it. But, its just
> another custom action and we have all the necessary machinery in place
> for folks who need it (to implement it themselves).
>
> -Rahul
>
>
>   
>>  thanks,
>>  Wolfgang
>>
>>
>>
>>  Rahul Akolkar schrieb:
>>
>>     
>>> On 7/2/08, Wolfgang Rabl <wo...@maven.at> wrote:
>>>
>>>
>>>       
>>>> 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.
>>>>
>>>>
>>>>
>>>>         
>>> <snip/>
>>>
>>> Custom actions are convenient for this, i.e. option (a).
>>>
>>>
>>>
>>>
>>>       
>>>>  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?
>>>>
>>>>
>>>>
>>>>         
>>> <snap/>
>>>
>>> That gives you the model (the state machine definition as it was
>>> authored), not the live instance (which needs to be accessed via the
>>> corresponding Context, a custom action will allow for that). There are
>>> Javadoc notes about this in some places, but clearly not all.
>>>
>>>
>>>
>>>
>>>       
>>>>  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".
>>>>
>>>>
>>>>         
>>> <snip/>
>>>
>>> Yes.
>>>
>>>
>>>
>>>
>>>       
>>>> 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.
>>>>
>>>>
>>>>
>>>>         
>>> <snap/>
>>>
>>> I don't have much email time today, but the RDC usecase [1] uses this
>>> pattern. Its open source, so all details are available if you want to
>>> look. The first two patterns are "lightweight" and don't really work
>>> too well for involved usecases IMO.
>>>
>>> -Rahul
>>>
>>> [1]
>>>       
>> http://commons.apache.org/scxml/usecases/scxml-in-rdc-group.html
>>     
>
> ---------------------------------------------------------------------
> 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


Re: [SCXML] two scxml questions

Posted by Rahul Akolkar <ra...@gmail.com>.
On 7/4/08, Wolfgang Rabl <wo...@maven.at> wrote:
> Thank you for your answer
>
>  May i ask some further questions regarding datamodel manipulation...
>  its very easy to change the value of a variable by using <assign>, but how
> can i create a new one or delete an existing variable?
>  and if i have a data tree, how can i add or delete entries there? for
> example:
>
>      <datamodel>
>        <data name="test">
>          <rooms>
>                 <room>kitchen</room>
>                 <room>bedroom</room>
>          </rooms>
>        </data>
>      </datamodel>
>
>  now i want to add a new room "bath" or delete the kitchen, is that possible
> from within the scxml document? If not, how could that be done? By using a
> custom action or by Jexl Method invokation?
>
<snip/>

The corresponding <assign> variant "replaces the children". See the
assign variants listed at the bottom of the datamodel guide:

  http://commons.apache.org/scxml/guide/datamodel.html

So there is no way to selectively add or remove a <room> above, using <assign>.

You could do it either way (custom action or JEXL method), but custom
actions would be more appropriate here IMO since they'd make the
functionality available across ELs. So, one can imagine the following
custom actions ...

 <data:appendChild location="..." child="..."/>

 <data:removeChild location="..." child="..."/>

... adjusted per taste, where each supports the corresponding
equivalent on org.w3c.dom.Node. I think these would be quite useful
additions to Commons SCXML, so if you end up implementing them, and if
you'd like, you can contribute them back via JIRA:

  http://commons.apache.org/scxml/issue-tracking.html


>  Oh and one more question, am i right that <SCRIPT> is not implemented in
> commonsSCXML?
>
<snap/>

Correct, implementations are not required to support it. But, its just
another custom action and we have all the necessary machinery in place
for folks who need it (to implement it themselves).

-Rahul


>  thanks,
>  Wolfgang
>
>
>
>  Rahul Akolkar schrieb:
>
> >
> > On 7/2/08, Wolfgang Rabl <wo...@maven.at> wrote:
> >
> >
> > > 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.
> > >
> > >
> > >
> > <snip/>
> >
> > Custom actions are convenient for this, i.e. option (a).
> >
> >
> >
> >
> > >  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?
> > >
> > >
> > >
> > <snap/>
> >
> > That gives you the model (the state machine definition as it was
> > authored), not the live instance (which needs to be accessed via the
> > corresponding Context, a custom action will allow for that). There are
> > Javadoc notes about this in some places, but clearly not all.
> >
> >
> >
> >
> > >  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".
> > >
> > >
> > <snip/>
> >
> > Yes.
> >
> >
> >
> >
> > > 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.
> > >
> > >
> > >
> > <snap/>
> >
> > I don't have much email time today, but the RDC usecase [1] uses this
> > pattern. Its open source, so all details are available if you want to
> > look. The first two patterns are "lightweight" and don't really work
> > too well for involved usecases IMO.
> >
> > -Rahul
> >
> > [1]
> http://commons.apache.org/scxml/usecases/scxml-in-rdc-group.html
> >

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


Re: [SCXML] two scxml questions

Posted by Wolfgang Rabl <wo...@maven.at>.
Thank you for your answer

May i ask some further questions regarding datamodel manipulation...
its very easy to change the value of a variable by using <assign>, but 
how can i create a new one or delete an existing variable?
and if i have a data tree, how can i add or delete entries there? for 
example:

      <datamodel>
        <data name="test">
          <rooms>
		<room>kitchen</room>
		<room>bedroom</room>
          </rooms>
        </data>
      </datamodel>

now i want to add a new room "bath" or delete the kitchen, is that 
possible from within the scxml document? If not, how could that be done? 
By using a custom action or by Jexl Method invokation?

Oh and one more question, am i right that <SCRIPT> is not implemented in 
commonsSCXML?

thanks,
Wolfgang



Rahul Akolkar schrieb:
> On 7/2/08, Wolfgang Rabl <wo...@maven.at> wrote:
>   
>> 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.
>>
>>     
> <snip/>
>
> Custom actions are convenient for this, i.e. option (a).
>
>
>   
>>  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?
>>
>>     
> <snap/>
>
> That gives you the model (the state machine definition as it was
> authored), not the live instance (which needs to be accessed via the
> corresponding Context, a custom action will allow for that). There are
> Javadoc notes about this in some places, but clearly not all.
>
>
>   
>>  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".
>>     
> <snip/>
>
> Yes.
>
>
>   
>> 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.
>>
>>     
> <snap/>
>
> I don't have much email time today, but the RDC usecase [1] uses this
> pattern. Its open source, so all details are available if you want to
> look. The first two patterns are "lightweight" and don't really work
> too well for involved usecases IMO.
>
> -Rahul
>
> [1] http://commons.apache.org/scxml/usecases/scxml-in-rdc-group.html
>
>
>   
>>  Thank you,
>>  Wolfgang
>>
>>
>>     
>
> ---------------------------------------------------------------------
> 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


Re: [SCXML] two scxml questions

Posted by Rahul Akolkar <ra...@gmail.com>.
On 7/2/08, Wolfgang Rabl <wo...@maven.at> wrote:
> 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.
>
<snip/>

Custom actions are convenient for this, i.e. option (a).


>  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?
>
<snap/>

That gives you the model (the state machine definition as it was
authored), not the live instance (which needs to be accessed via the
corresponding Context, a custom action will allow for that). There are
Javadoc notes about this in some places, but clearly not all.


>  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".
<snip/>

Yes.


> 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.
>
<snap/>

I don't have much email time today, but the RDC usecase [1] uses this
pattern. Its open source, so all details are available if you want to
look. The first two patterns are "lightweight" and don't really work
too well for involved usecases IMO.

-Rahul

[1] http://commons.apache.org/scxml/usecases/scxml-in-rdc-group.html


>  Thank you,
>  Wolfgang
>
>

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