On 12/28/07, Lupu Slobodu <[EMAIL PROTECTED]> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to