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
Date Fri, 28 Dec 2007 20:15:42 GMT
On 12/28/07, Lupu Slobodu <lupu.slobodu@gmail.com> wrote:
> sure, so the information is available just at runtime, no way to determine
> it before calling engine.go(), right?
>
<snip/>

The information is available in the parsed object model [1], so you
can do some post-processing based on that (will require walking the
model).

If you're familiar with Commons Digester, you can also obtain a
SCXMLParser [1] instance and add digester rules specific to your
custom action.

-Rahul

[1] http://commons.apache.org/scxml/apidocs/org/apache/commons/scxml/model/package-summary.html

[2] http://commons.apache.org/scxml/apidocs/org/apache/commons/scxml/io/SCXMLParser.html


> On Dec 28, 2007 2:12 PM, Rahul Akolkar <rahul.akolkar@gmail.com> wrote:
>
> > On 12/28/07, Lupu Slobodu <lupu.slobodu@gmail.com> wrote:
> > > Is there a chance to know at the parsing time what state is a (custom)
> > > action going to run in? This could be useful if one wants to initialize
> > and
> > > validate an action handler registry that would associate action handlers
> > to
> > > particular states.
> > >
> > <snip/>
> >
> > Without going to the architectural necessity for such introspection
> > (it may be good to do without it, if possible), the state in which a
> > custom action is being executed at run-time is the parent of the
> > Executable container in which it resides i.e. given ...
> >
> >  <state id="foo">
> >      <onentry>
> >          <my:bar .../>
> >      </onentry>
> >  </state>
> >
> > where <my:bar> is implemented by a custom action whose execute()
> > method contains (untested):
> >
> >  String id = getParent().getParent().getId();
> >
> > then the value of id for the execution above would be "foo".
> >
> > -Rahul
> >
> >
> > > While it is possible to determine the current sate at run time and
> > > dynamically instantiate the handlers( as the AbstractStateMachine does),
> > > this approach  leaves room for potential inconsistencies (as a handler
> > class
> > > could not be defined)
> > >
> >

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


Mime
View raw message