commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan <rnidef...@gmail.com>
Subject [scxml] events triggered in onentry
Date Wed, 18 May 2011 00:22:23 GMT
I have the following simple SCXML document:

<scxml xmlns="http://www.w3.org/2005/07/scxml"
            xmlns:my="http://www.my.com"
            version="1.0"
            initialstate="welcome">

    <state id="welcome">
        <onentry>
            <my:play filename="welcome"/>
        </onentry>
        <transition cond="${_eventdata eq 'blah'}" target="end"/>
    </state>
    <state id="end" final="true">
        <onentry/>
    </state>
</scxml>

My approach is to generate events from custom actions, then act on those
events in my transitions. To test this approach, I hardcoded the generation
of an event in my Play.class action:

        TriggerEvent evt = new TriggerEvent("agi.keypress",
TriggerEvent.SIGNAL_EVENT, "blah");
        scInstance.getExecutor().triggerEvent(evt);

However, I can't seem to get the <transition/> to recognize this event. Here
is log output as the state machine runs:

[org.apache.commons.scxml.Context] (Asterisk-Java DaemonPool-1-thread-1)
_eventdata = blah
[org.apache.commons.scxml.Context] (Asterisk-Java DaemonPool-1-thread-1)
_eventdatamap = {agi.keypress=blah}
[org.apache.commons.scxml.Context] (Asterisk-Java DaemonPool-1-thread-1)
_eventdata = null
[org.apache.commons.scxml.Context] (Asterisk-Java DaemonPool-1-thread-1)
_eventdatamap = null
[org.apache.commons.scxml.SCXMLExecutor] (Asterisk-Java
DaemonPool-1-thread-1) Current States: []
[org.apache.commons.scxml.Context] (Asterisk-Java DaemonPool-1-thread-1)
_eventdata = null
[org.apache.commons.scxml.Context] (Asterisk-Java DaemonPool-1-thread-1)
_eventdatamap = {welcome.entry=null}
[org.apache.commons.scxml.Evaluator] (Asterisk-Java DaemonPool-1-thread-1)
${_eventdata eq 'blah'} = false
[org.apache.commons.scxml.Context] (Asterisk-Java DaemonPool-1-thread-1)
_ALL_NAMESPACES = null
[org.apache.commons.scxml.Context] (Asterisk-Java DaemonPool-1-thread-1)
_eventdata = null
[org.apache.commons.scxml.Context] (Asterisk-Java DaemonPool-1-thread-1)
_eventdatamap = {welcome.entry=null}
[org.apache.commons.scxml.SCXMLExecutor] (Asterisk-Java
DaemonPool-1-thread-1) Current States: [welcome]

Why is the _eventdata/_eventdatamap pair being printed twice to start? The
first time it has the event I've triggered, the second time its empty. Then
after this, you see that the welcome.entry event triggered, then the JSP EL
condition evaluates to false.

My initial guess is that I've misunderstood the state machine algorithm, and
my attempt to trigger an event from the <onentry/> is flawed.

How should I go about this?

Thanks,
Ryan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message