I practice the Hello custom action. The following is the document. I found that 
_eventdata is always null ( or empty). When I use the log action to display it 
on an entry, its value is also displyed as null. 

it works well when the event is triggered by engine.triggerEvent().  I do not 
make any change to the Hello class.
 
<scxml xmlns="http://www.w3.org/2005/07/scxml";
       xmlns:my="http://my.custom-actions.domain/CUSTOM";
       version="1.0"
       initialstate="init">

     <state id="init">
        <onentry>
            <my:hello name="finished" />
        </onentry>
        <transition event="helloevent"
                        cond="empty _eventdata" target="empty" />
         <transition event="helloevent"
                        cond="_eventdata eq 'finished'" target="finished" />
         <transition event="helloevent" target="tostop" />
     </state>

the following is part of the java code:
 
   // (1) Create a list of custom actions, add as many as are needed
       List<CustomAction> customActions = new ArrayList<CustomAction>();
       CustomAction ca =
             new CustomAction("http://my.custom-actions.domain/CUSTOM";,
                              "hello", Hello.class);
       customActions.add(ca);
       // (2) Parse the SCXML document containing the custom action(s)
       SCXML stateMachine = null;
       try {
        URL url = 
HelloWorld.class.getClassLoader().getResource("custom-hello-world-01.xml") ;
        ErrorHandler errorHandler = new SimpleErrorHandler();
        stateMachine = SCXMLParser.parse(url, errorHandler, customActions);
       } catch (Exception e) {
           // bad document, take necessary action
       }
       final SCXMLExecutor engine = new SCXMLExecutor( new JexlEvaluator(), new 
SimpleDispatcher(),
                 new SimpleErrorReporter());
       engine.setStateMachine( stateMachine );
       engine.setSuperStep(true);
       engine.setRootContext( new JexlContext() );
       engine.addListener(stateMachine, new EntryListener() );
       try {
            engine.go();
       } catch (ModelException me) {
            System.err.println(me);
       }
       //waiting in another thread.

What's is wrong with my document? I use commons-scxml-0.7.
 
Thanks for your help.
 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to