commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar" <>
Subject Re: [SCXML] Want to access payload associated with a TriggerEvent
Date Fri, 08 Sep 2006 20:56:19 GMT
On 9/8/06, Madhwaraj Rao <> wrote:
> Hi,
> I am trying to access the payload associated with a
> TriggerEvent in the EntryListener.onEntry() method. Is
> this possible?

No. The event payload is meant to be accessible only within
(expressions within) the SCXML document, and only for the duration the
event is being triggered, no longer.

As an aside, if you want the payload to persist, or be available in
the environment the executor instance is in, you can write (<assign>)
the needed bits to the root context, which serves as the bridge
between the state machine instance and the environment (therefore,
data can be "shared" across either sides).

> For example,
> I fire an event as:
> stopWatch.fireEvent(StopWatch.EVENT_UNSPLIT, new
> String("Unsplit Object"));
> and in my registered EntryListener.onEntry() method I
> need to access the payload corressponding to the event
> that caused a transition to the current state (that I
> entered).
> How do I access the payload corressponding to the
> event "watch.unsplit"?
> When I look in the SCXMLExecutor code, there is a
> hierarchy of Hashmaps, the first of which needs to be
> accesed by a private member (EVENT_DATA_MAP). This
> Hashmap contains the payload keyed by the event name.
> How can I access the secondary Hashmap from the
> AbstractStateMachine? Or is there a better way to
> doing this?

The AbstractStateMachine used by the StopWatch example demonstrates
one particular Commons SCXML usage pattern -- probably the simplest --
and the SCXMLListener (here, EntryListener) is generally usually used
in conjunction with one or more other interaction patterns. I suggest
looking at the other patterns [1] and usecases [2],[3] to see what
best fits your needs.


[3] (see attachment

> Thanks,
> --
> Raj

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message