commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Dragert <chris.drag...@mail.mcgill.ca>
Subject RE: [scxml] Regarding usage of fireEvent method
Date Mon, 02 Aug 2010 15:58:20 GMT
This seems correct, but it's not possible to debug without knowing the results of your if-statement.
 The problem may be located in there, and be independent of the usage of commons-scxml.

Three ways to debug:

1)  Change first() so that you have:

            public void first() {
                 fireEvent("event1");
            }

2)  AbstractStateMachine has an inner class that defines an SCXML listener (aside: this is
what actually calls your  "public void stateName()" methods).  If you want to debug, you can
create your own listener with appropriate code to intercept transitions/state entries.

3)  In the SCXML, add onentry blocks to determine where you are:

<state ...>
     <onentry>
          <log expr="in state x" />
     </onentry>
</state>

Hope this helps,
Chris Dragert
________________________________________
From: Prem Chand Majeti [prem.majeti@aricent.com]
Sent: Monday, August 02, 2010 1:40 AM
To: user@commons.apache.org
Subject: [scxml] Regarding usage of fireEvent method

Hi,

I'm trying to implement simple FSM in java.

Here is my scxml :-

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

    <state id="first">
            <transition event="event1" target="second" />
            <transition event="event2" target="last" />
    </state>

    <state id="second">
            <transition event="event3" target="last" />
    </state>

    <state id="last" final="true" />

</scxml>

Java Implemetation:-

public class FsmTest extends AbstractStateMachine {

            public FsmTest(URL scxmlDocument) {
                        super(scxmlDocument);
            }

            public void first() {
                        //Some process...
                        if(..)
                                    fireEvent("event1");
                        else
                                    fireEvent("event2");
            }

            public void second() {
                        // Some Process....
                        fireEvent("event3");
            }

            public void last() {
            }

}

When I try to run this, it was entering into the state "first". But from there no event was
fired and it was not moving to other states.
Please let me know if I was doing something wrong.

Thanks & Regards
Prem


________________________________
"DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of
the individual to whom it is addressed. It may contain privileged or confidential information
and should not be circulated or used for any purpose other than for what it is intended. If
you have received this message in error, please notify the originator immediately. If you
are not the intended recipient, you are notified that you are strictly prohibited from using,
copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility
for loss or damage arising from the use of the information transmitted by this email including
damage from virus."
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message