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 19:12:04 GMT
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