commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar" <rahul.akol...@gmail.com>
Subject Re: [SCXML] two scxml questions
Date Fri, 04 Jul 2008 23:53:22 GMT
On 7/4/08, Wolfgang Rabl <wolfgang.rabl@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 <wolfgang.rabl@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


Mime
View raw message