commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar" <rahul.akol...@gmail.com>
Subject Re: [SCXML] W3C specs compatibility and state transition issues
Date Fri, 11 Apr 2008 01:21:50 GMT
On Thu, Apr 10, 2008 at 8:30 PM, Ouyang, Landon - ES/RDR -Gil
<Landon.Ouyang@itt.com> wrote:
> Apologize for the duplicate e-mail, I had to be schooled on the proper format by Mr.
Cooper. :)
>
>
> I am a new user of Commons SCXML. I have two very basic questions:
>
> 1)      How much of the W3C specs for SCXML is supported with Common SCXML? Are all of
the tags recognized?
>
<snip/>

Not supported:
  <anchor> (supporting this one is optional for engines)
  <validate>

Experimental (due to missing pieces in draft spec, see TBD markers for example):
  <invoke>


> 2)      Basing my code off of the simple stopwatch example, I created a simple Java app
that navigated across 10 states. I noticed that if I put any code in the state handler methods
that fires off events to transition to other states, the application still thinks I am in
the *previous* state! For example, if I am in the state 5 subroutine and fire off an EVENT_NEXT
event to go to state 6, the app actually keeps me in state 5 because it still thinks I am
in state 4! Is it true that the state machine transitions *after* the handler for the new
state is called? If so, how do I put custom code so that the state can make transition decisions
based on certain conditions?
>
<snap/>

You'd have to do that asynchronously (the executor is still processing
the earlier event). However ...

I'd store the result of "certain conditions" in the datamodel, and
query the datamodel later, like so:

public void foo() { // handler for state "foo"

    // check certain conditions, create someresultbean

    getEngine().getRootContext().put("fooresult", someresultbean);
}

And further, in a totally fictitious example:

<state id="foo">
    <transition cond="fooresult.success" target="bar"/>
    <transition cond="fooresult.numfailures gt 2" target="exit"/>
    <transition cond="not fooresult.success" target="foo"/> <!-- try again -->
    <!-- foo's other content -->
</state>

-Rahul


>
>
> --
> Landon Ouyang
> Member Technical Staff
> ITT Electronics Systems, Radar Systems - Gilfillan
> 7821 Orion Ave,
> Van Nuys, CA 91406
> (818) 901-2982
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message