[SCXML] W3C specs compatibility and state transition issues

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

[SCXML] W3C specs compatibility and state transition issues

by Ouyang, Landon - ES/RDR -Gil :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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?

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?



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


________________________________
This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.

Re: [SCXML] W3C specs compatibility and state transition issues

by Rahul Akolkar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Thu, Apr 10, 2008 at 8:30 PM, Ouyang, Landon - ES/RDR -Gil
<Landon.Ouyang@...> 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@...
For additional commands, e-mail: user-help@...


RE: [SCXML] W3C specs compatibility and state transition issues

by Ouyang, Landon - ES/RDR -Gil :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rahul,

Thanks for the quick and helpful response. I am still having trouble
creating a conditional state transition. Using your example, I added a
conditional transition in my XML file as follows:

<state id="six">
<datamodel>
        <data name="result">
                <value>0</value>
        </data>
</datamodel>
 <transition cond="$(result.value eq '1')" target="zero"
event="display.next"/>
 <transition cond="$(result.value eq '0')" target="seven"
event="display.next"/>
 <transition target="five" event="display.prev"/>
</state>

My handler for state 6 is the following:
public void six(){
      getEngine().getRootContext().set("result.value", "1");
        }

I have a NEXT button in my GUI that fires off the 'display.next' event.
In state 5, I hit this NEXT button and this code gets executed. I would
assume that when I hit the NEXT button again I should be in state 0, but
instead I stay in state 6 indefinitely!

Can you tell me what I am doing wrong?

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

-----Original Message-----
From: Rahul Akolkar [mailto:rahul.akolkar@...]
Sent: Thursday, April 10, 2008 6:22 PM
To: Jakarta Commons Users List
Subject: Re: [SCXML] W3C specs compatibility and state transition issues

On Thu, Apr 10, 2008 at 8:30 PM, Ouyang, Landon - ES/RDR -Gil
<Landon.Ouyang@...> 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@...
For additional commands, e-mail: user-help@...


This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.

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


RE: [SCXML] W3C specs compatibility and state transition issues

by Ouyang, Landon - ES/RDR -Gil :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I figured out the solution:

I needed to remove the event properties from the conditional
transitions. So if I change the state to:

<state id="six">
        <datamodel>
                <data name="result">
                        <value>0</value>
                </data>
        </datamodel>
 <transition cond="result.value eq '1'" target="zero"/>
 <transition cond="result.value eq '0'" target="five"/>
 <transition target="three" event="display.prev"/>
</state>

the code will work! Am I missing any other crucial details?

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


-----Original Message-----
From: Ouyang, Landon - ES/RDR -Gil [mailto:Landon.Ouyang@...]
Sent: Friday, April 11, 2008 1:34 PM
To: Jakarta Commons Users List
Subject: RE: [SCXML] W3C specs compatibility and state transition issues

Hi Rahul,

Thanks for the quick and helpful response. I am still having trouble
creating a conditional state transition. Using your example, I added a
conditional transition in my XML file as follows:

<state id="six">
<datamodel>
        <data name="result">
                <value>0</value>
        </data>
</datamodel>
 <transition cond="$(result.value eq '1')" target="zero"
event="display.next"/>
 <transition cond="$(result.value eq '0')" target="seven"
event="display.next"/>
 <transition target="five" event="display.prev"/>
</state>

My handler for state 6 is the following:
public void six(){
      getEngine().getRootContext().set("result.value", "1");
        }

I have a NEXT button in my GUI that fires off the 'display.next' event.
In state 5, I hit this NEXT button and this code gets executed. I would
assume that when I hit the NEXT button again I should be in state 0, but
instead I stay in state 6 indefinitely!

Can you tell me what I am doing wrong?

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

-----Original Message-----
From: Rahul Akolkar [mailto:rahul.akolkar@...]
Sent: Thursday, April 10, 2008 6:22 PM
To: Jakarta Commons Users List
Subject: Re: [SCXML] W3C specs compatibility and state transition issues

On Thu, Apr 10, 2008 at 8:30 PM, Ouyang, Landon - ES/RDR -Gil
<Landon.Ouyang@...> 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@...
For additional commands, e-mail: user-help@...


This e-mail and any files transmitted with it may be proprietary and are
intended solely for the use of the individual or entity to whom they are
addressed. If you have received this e-mail in error please notify the
sender. Please note that any views or opinions presented in this e-mail
are solely those of the author and do not necessarily represent those of
ITT Corporation. The recipient should check this e-mail and any
attachments for the presence of viruses. ITT accepts no liability for
any damage caused by any virus transmitted by this e-mail.

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


This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.

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


Re: [SCXML] W3C specs compatibility and state transition issues

by Rahul Akolkar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Apr 11, 2008 at 5:01 PM, Ouyang, Landon - ES/RDR -Gil
<Landon.Ouyang@...> wrote:

> I figured out the solution:
>
> I needed to remove the event properties from the conditional
> transitions. So if I change the state to:
>
> <state id="six">
>        <datamodel>
>                <data name="result">
>                        <value>0</value>
>                </data>
>        </datamodel>
>  <transition cond="result.value eq '1'" target="zero"/>
>  <transition cond="result.value eq '0'" target="five"/>
>  <transition target="three" event="display.prev"/>
> </state>
>
> the code will work! Am I missing any other crucial details?
>
<snip/>

Not really, but couple of comments:

 * At a quick glance, I suspect you don't need the <datamodel>
specified declaratively, so you can just remove the entire <datamodel>
element (we are setting "result.value" via Java handlers). A brief
discussion about datamodels is here:

  http://commons.apache.org/scxml/guide/datamodel.html

 * When I gave the example (below), I intended "fooresult.success" and
"fooresult.numfailures" to be expressions of the flavor bean.property
i.e. fooresult was an instance of:

class FooResult {
  get/setSuccess()
  get/setNumfailures()
}

Generally better if you want to return a data structure, rather than
multiple "flat variables" (your example is fine, for one value its
much overhead).

-Rahul


> --
> Landon Ouyang
> Member Technical Staff
> ITT Electronics Systems, Radar Systems - Gilfillan
> 7821 Orion Ave,
> Van Nuys, CA 91406
> (818) 901-2982
>
>
> -----Original Message-----
> From: Ouyang, Landon - ES/RDR -Gil [mailto:Landon.Ouyang@...]
> Sent: Friday, April 11, 2008 1:34 PM
> To: Jakarta Commons Users List
>
> Subject: RE: [SCXML] W3C specs compatibility and state transition issues
>
> Hi Rahul,
>
> Thanks for the quick and helpful response. I am still having trouble
> creating a conditional state transition. Using your example, I added a
> conditional transition in my XML file as follows:
>
> <state id="six">
> <datamodel>
>        <data name="result">
>                <value>0</value>
>        </data>
> </datamodel>
>  <transition cond="$(result.value eq '1')" target="zero"
> event="display.next"/>
>  <transition cond="$(result.value eq '0')" target="seven"
> event="display.next"/>
>  <transition target="five" event="display.prev"/>
> </state>
>
> My handler for state 6 is the following:
> public void six(){
>      getEngine().getRootContext().set("result.value", "1");
>        }
>
> I have a NEXT button in my GUI that fires off the 'display.next' event.
> In state 5, I hit this NEXT button and this code gets executed. I would
> assume that when I hit the NEXT button again I should be in state 0, but
> instead I stay in state 6 indefinitely!
>
> Can you tell me what I am doing wrong?
>
> --
> Landon Ouyang
> Member Technical Staff
> ITT Electronics Systems, Radar Systems - Gilfillan
> 7821 Orion Ave,
> Van Nuys, CA 91406
> (818) 901-2982
>
> -----Original Message-----
> From: Rahul Akolkar [mailto:rahul.akolkar@...]
> Sent: Thursday, April 10, 2008 6:22 PM
> To: Jakarta Commons Users List
> Subject: Re: [SCXML] W3C specs compatibility and state transition issues
>
> On Thu, Apr 10, 2008 at 8:30 PM, Ouyang, Landon - ES/RDR -Gil
> <Landon.Ouyang@...> 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
>
>
> >
> >

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


RE: [SCXML] W3C specs compatibility and state transition issues

by Ouyang, Landon - ES/RDR -Gil :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hmmm....

Given your snippet, I assumed this would work:

result aResult = new result();

if(bIsTest)
   aResult.value = 1;
else
   aResult.value = 0;

getEngine().getRootContext().set("result", aResult);

where the XML transition is conditional on "result.value eq 1". Why
doesn't it work?

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


-----Original Message-----
From: Rahul Akolkar [mailto:rahul.akolkar@...]
Sent: Friday, April 11, 2008 2:18 PM
To: Jakarta Commons Users List
Subject: Re: [SCXML] W3C specs compatibility and state transition issues

On Fri, Apr 11, 2008 at 5:01 PM, Ouyang, Landon - ES/RDR -Gil
<Landon.Ouyang@...> wrote:

> I figured out the solution:
>
> I needed to remove the event properties from the conditional
> transitions. So if I change the state to:
>
> <state id="six">
>        <datamodel>
>                <data name="result">
>                        <value>0</value>
>                </data>
>        </datamodel>
>  <transition cond="result.value eq '1'" target="zero"/>
>  <transition cond="result.value eq '0'" target="five"/>
>  <transition target="three" event="display.prev"/>
> </state>
>
> the code will work! Am I missing any other crucial details?
>
<snip/>

Not really, but couple of comments:

 * At a quick glance, I suspect you don't need the <datamodel>
specified declaratively, so you can just remove the entire <datamodel>
element (we are setting "result.value" via Java handlers). A brief
discussion about datamodels is here:

  http://commons.apache.org/scxml/guide/datamodel.html

 * When I gave the example (below), I intended "fooresult.success" and
"fooresult.numfailures" to be expressions of the flavor bean.property
i.e. fooresult was an instance of:

class FooResult {
  get/setSuccess()
  get/setNumfailures()
}

Generally better if you want to return a data structure, rather than
multiple "flat variables" (your example is fine, for one value its
much overhead).

-Rahul


> --
> Landon Ouyang
> Member Technical Staff
> ITT Electronics Systems, Radar Systems - Gilfillan
> 7821 Orion Ave,
> Van Nuys, CA 91406
> (818) 901-2982
>
>
> -----Original Message-----
> From: Ouyang, Landon - ES/RDR -Gil [mailto:Landon.Ouyang@...]
> Sent: Friday, April 11, 2008 1:34 PM
> To: Jakarta Commons Users List
>
> Subject: RE: [SCXML] W3C specs compatibility and state transition
issues

>
> Hi Rahul,
>
> Thanks for the quick and helpful response. I am still having trouble
> creating a conditional state transition. Using your example, I added a
> conditional transition in my XML file as follows:
>
> <state id="six">
> <datamodel>
>        <data name="result">
>                <value>0</value>
>        </data>
> </datamodel>
>  <transition cond="$(result.value eq '1')" target="zero"
> event="display.next"/>
>  <transition cond="$(result.value eq '0')" target="seven"
> event="display.next"/>
>  <transition target="five" event="display.prev"/>
> </state>
>
> My handler for state 6 is the following:
> public void six(){
>      getEngine().getRootContext().set("result.value", "1");
>        }
>
> I have a NEXT button in my GUI that fires off the 'display.next'
event.
> In state 5, I hit this NEXT button and this code gets executed. I
would
> assume that when I hit the NEXT button again I should be in state 0,
but

> instead I stay in state 6 indefinitely!
>
> Can you tell me what I am doing wrong?
>
> --
> Landon Ouyang
> Member Technical Staff
> ITT Electronics Systems, Radar Systems - Gilfillan
> 7821 Orion Ave,
> Van Nuys, CA 91406
> (818) 901-2982
>
> -----Original Message-----
> From: Rahul Akolkar [mailto:rahul.akolkar@...]
> Sent: Thursday, April 10, 2008 6:22 PM
> To: Jakarta Commons Users List
> Subject: Re: [SCXML] W3C specs compatibility and state transition
issues
>
> On Thu, Apr 10, 2008 at 8:30 PM, Ouyang, Landon - ES/RDR -Gil
> <Landon.Ouyang@...> 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
>
>
> >
> >

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


This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.

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


Re: [SCXML] W3C specs compatibility and state transition issues

by Rahul Akolkar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Apr 11, 2008 at 7:15 PM, Ouyang, Landon - ES/RDR -Gil
<Landon.Ouyang@...> wrote:

> Hmmm....
>
> Given your snippet, I assumed this would work:
>
> result aResult = new result();
>
> if(bIsTest)
>   aResult.value = 1;
> else
>   aResult.value = 0;
>
> getEngine().getRootContext().set("result", aResult);
>
> where the XML transition is conditional on "result.value eq 1". Why
> doesn't it work?
>
<snip/>

Try adding getter and setter methods, as I suggest below (for property
"value" in this example). Detailed discussion is in the JavaBeans
spec, which forms the basis of bean property access in most ELs we
use.

-Rahul


> --
> Landon Ouyang
> Member Technical Staff
> ITT Electronics Systems, Radar Systems - Gilfillan
> 7821 Orion Ave,
> Van Nuys, CA 91406
> (818) 901-2982
>
>
> -----Original Message-----
> From: Rahul Akolkar [mailto:rahul.akolkar@...]
>
> Sent: Friday, April 11, 2008 2:18 PM
> To: Jakarta Commons Users List
> Subject: Re: [SCXML] W3C specs compatibility and state transition issues
>
> On Fri, Apr 11, 2008 at 5:01 PM, Ouyang, Landon - ES/RDR -Gil
> <Landon.Ouyang@...> wrote:
> > I figured out the solution:
> >
> > I needed to remove the event properties from the conditional
> > transitions. So if I change the state to:
> >
> > <state id="six">
> >        <datamodel>
> >                <data name="result">
> >                        <value>0</value>
> >                </data>
> >        </datamodel>
> >  <transition cond="result.value eq '1'" target="zero"/>
> >  <transition cond="result.value eq '0'" target="five"/>
> >  <transition target="three" event="display.prev"/>
> > </state>
> >
> > the code will work! Am I missing any other crucial details?
> >
> <snip/>
>
> Not really, but couple of comments:
>
>  * At a quick glance, I suspect you don't need the <datamodel>
> specified declaratively, so you can just remove the entire <datamodel>
> element (we are setting "result.value" via Java handlers). A brief
> discussion about datamodels is here:
>
>  http://commons.apache.org/scxml/guide/datamodel.html
>
>  * When I gave the example (below), I intended "fooresult.success" and
> "fooresult.numfailures" to be expressions of the flavor bean.property
> i.e. fooresult was an instance of:
>
> class FooResult {
>  get/setSuccess()
>  get/setNumfailures()
> }
>
> Generally better if you want to return a data structure, rather than
> multiple "flat variables" (your example is fine, for one value its
> much overhead).
>
> -Rahul
>

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


RE: [SCXML] W3C specs compatibility and state transition issues

by Ouyang, Landon - ES/RDR -Gil :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Rahul,

My (limited) understand of JavaBeans is that a JavaBean object must
implement java.io.Serializable, has a public no argument constructor,
and contains set/get methods for properties. So I setup my result class
as follows:

    class result implements Serializable
        {
        public result() {}
        private int value;
        public int getValue()
            { return value; }
        public void setValue(int nNum)
            { value = nNum; }
        }

However, the state transition still does not work!

FYI, I was able to prove that the object is sent to the engine correctly
using:

result newResult = (result)getEngine().getRootContext().get("result");

But for some reason, I cannot retrieve/use "result.value" in my XML
file!

Any ideas what I'm missing here? Thanks for the help.

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

-----Original Message-----
From: Rahul Akolkar [mailto:rahul.akolkar@...]
Sent: Friday, April 11, 2008 6:56 PM
To: Jakarta Commons Users List
Subject: Re: [SCXML] W3C specs compatibility and state transition issues

On Fri, Apr 11, 2008 at 7:15 PM, Ouyang, Landon - ES/RDR -Gil
<Landon.Ouyang@...> wrote:

> Hmmm....
>
> Given your snippet, I assumed this would work:
>
> result aResult = new result();
>
> if(bIsTest)
>   aResult.value = 1;
> else
>   aResult.value = 0;
>
> getEngine().getRootContext().set("result", aResult);
>
> where the XML transition is conditional on "result.value eq 1". Why
> doesn't it work?
>
<snip/>

Try adding getter and setter methods, as I suggest below (for property
"value" in this example). Detailed discussion is in the JavaBeans
spec, which forms the basis of bean property access in most ELs we
use.

-Rahul


> --
> Landon Ouyang
> Member Technical Staff
> ITT Electronics Systems, Radar Systems - Gilfillan
> 7821 Orion Ave,
> Van Nuys, CA 91406
> (818) 901-2982
>
>
> -----Original Message-----
> From: Rahul Akolkar [mailto:rahul.akolkar@...]
>
> Sent: Friday, April 11, 2008 2:18 PM
> To: Jakarta Commons Users List
> Subject: Re: [SCXML] W3C specs compatibility and state transition
issues

>
> On Fri, Apr 11, 2008 at 5:01 PM, Ouyang, Landon - ES/RDR -Gil
> <Landon.Ouyang@...> wrote:
> > I figured out the solution:
> >
> > I needed to remove the event properties from the conditional
> > transitions. So if I change the state to:
> >
> > <state id="six">
> >        <datamodel>
> >                <data name="result">
> >                        <value>0</value>
> >                </data>
> >        </datamodel>
> >  <transition cond="result.value eq '1'" target="zero"/>
> >  <transition cond="result.value eq '0'" target="five"/>
> >  <transition target="three" event="display.prev"/>
> > </state>
> >
> > the code will work! Am I missing any other crucial details?
> >
> <snip/>
>
> Not really, but couple of comments:
>
>  * At a quick glance, I suspect you don't need the <datamodel>
> specified declaratively, so you can just remove the entire <datamodel>
> element (we are setting "result.value" via Java handlers). A brief
> discussion about datamodels is here:
>
>  http://commons.apache.org/scxml/guide/datamodel.html
>
>  * When I gave the example (below), I intended "fooresult.success" and
> "fooresult.numfailures" to be expressions of the flavor bean.property
> i.e. fooresult was an instance of:
>
> class FooResult {
>  get/setSuccess()
>  get/setNumfailures()
> }
>
> Generally better if you want to return a data structure, rather than
> multiple "flat variables" (your example is fine, for one value its
> much overhead).
>
> -Rahul
>

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


This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.

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


Re: [SCXML] W3C specs compatibility and state transition issues

by Rahul Akolkar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 4/14/08, Ouyang, Landon - ES/RDR -Gil <Landon.Ouyang@...> wrote:
> Hi Rahul,
>
>  My (limited) understand of JavaBeans is that a JavaBean object must
>  implement java.io.Serializable, has a public no argument constructor,
>  and contains set/get methods for properties. So I setup my result class
>  as follows:
>
>     class result implements Serializable
<snip/>

I think making the class public will fix the problem.

This is no longer a [scxml] discussion. My preference would be to have
a new email thread, if the discussion continues.

-Rahul


>         {
>         public result() {}
>         private int value;
>         public int getValue()
>             { return value; }
>         public void setValue(int nNum)
>             { value = nNum; }
>         }
>
>  However, the state transition still does not work!
>
>  FYI, I was able to prove that the object is sent to the engine correctly
>  using:
>
>  result newResult = (result)getEngine().getRootContext().get("result");
>
>  But for some reason, I cannot retrieve/use "result.value" in my XML
>  file!
>
>  Any ideas what I'm missing here? Thanks for the help.
>
>
>  --
>  Landon Ouyang
>  Member Technical Staff
>  ITT Electronics Systems, Radar Systems - Gilfillan
>  7821 Orion Ave,
>  Van Nuys, CA 91406
>  (818) 901-2982
>
>  -----Original Message-----
>  From: Rahul Akolkar [mailto:rahul.akolkar@...]
>
> Sent: Friday, April 11, 2008 6:56 PM
>  To: Jakarta Commons Users List
>  Subject: Re: [SCXML] W3C specs compatibility and state transition issues
>
>  On Fri, Apr 11, 2008 at 7:15 PM, Ouyang, Landon - ES/RDR -Gil
>  <Landon.Ouyang@...> wrote:
>  > Hmmm....
>  >
>  > Given your snippet, I assumed this would work:
>  >
>  > result aResult = new result();
>  >
>  > if(bIsTest)
>  >   aResult.value = 1;
>  > else
>  >   aResult.value = 0;
>  >
>  > getEngine().getRootContext().set("result", aResult);
>  >
>  > where the XML transition is conditional on "result.value eq 1". Why
>  > doesn't it work?
>  >
>  <snip/>
>
>  Try adding getter and setter methods, as I suggest below (for property
>  "value" in this example). Detailed discussion is in the JavaBeans
>  spec, which forms the basis of bean property access in most ELs we
>  use.
>
>  -Rahul
>
>
>  > --
>  > Landon Ouyang
>  > Member Technical Staff
>  > ITT Electronics Systems, Radar Systems - Gilfillan
>  > 7821 Orion Ave,
>  > Van Nuys, CA 91406
>  > (818) 901-2982
>  >
>  >
>  > -----Original Message-----
>  > From: Rahul Akolkar [mailto:rahul.akolkar@...]
>  >
>  > Sent: Friday, April 11, 2008 2:18 PM
>  > To: Jakarta Commons Users List
>  > Subject: Re: [SCXML] W3C specs compatibility and state transition
>  issues
>  >
>  > On Fri, Apr 11, 2008 at 5:01 PM, Ouyang, Landon - ES/RDR -Gil
>  > <Landon.Ouyang@...> wrote:
>  > > I figured out the solution:
>  > >
>  > > I needed to remove the event properties from the conditional
>  > > transitions. So if I change the state to:
>  > >
>  > > <state id="six">
>  > >        <datamodel>
>  > >                <data name="result">
>  > >                        <value>0</value>
>  > >                </data>
>  > >        </datamodel>
>  > >  <transition cond="result.value eq '1'" target="zero"/>
>  > >  <transition cond="result.value eq '0'" target="five"/>
>  > >  <transition target="three" event="display.prev"/>
>  > > </state>
>  > >
>  > > the code will work! Am I missing any other crucial details?
>  > >
>  > <snip/>
>  >
>  > Not really, but couple of comments:
>  >
>  >  * At a quick glance, I suspect you don't need the <datamodel>
>  > specified declaratively, so you can just remove the entire <datamodel>
>  > element (we are setting "result.value" via Java handlers). A brief
>  > discussion about datamodels is here:
>  >
>  >  http://commons.apache.org/scxml/guide/datamodel.html
>  >
>  >  * When I gave the example (below), I intended "fooresult.success" and
>  > "fooresult.numfailures" to be expressions of the flavor bean.property
>  > i.e. fooresult was an instance of:
>  >
>  > class FooResult {
>  >  get/setSuccess()
>  >  get/setNumfailures()
>  > }
>  >
>  > Generally better if you want to return a data structure, rather than
>  > multiple "flat variables" (your example is fine, for one value its
>  > much overhead).
>  >
>  > -Rahul
>  >

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


[SCXML] State transitions from within handler

by Ouyang, Landon - ES/RDR -Gil :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Rahul,

Thanks for your help, I was able to implement the state transition
method you had described earlier.

The reason for this investigation is that we intend to use the Commons
SCXML engine to implement highly complex systems by separating all the
"pieces" into atomic modules (states). However, we would like the
decision making for the transitions to be done within the application
code (state handlers) and not the state machine implementation (XML). We
foresee problems if the XML document must specifically reference the
attributes needed to decide which transitions occur (ie 'result.value'
in our earlier example).

The only way I can think around this problem is to create a custom
transition/event stack in which the next event gets pushed during the
state handler and popped once we are officially in the current state
(since the previous state is still being processed while we are in the
handler).

Is there a better way around this issue? If not, where in
AbstractStateMachine will I know for a fact that the previous state's
processing has been completed?

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


-----Original Message-----
From: Ouyang, Landon - ES/RDR -Gil [mailto:Landon.Ouyang@...]
Sent: Monday, April 14, 2008 9:31 AM
To: Jakarta Commons Users List
Subject: RE: [SCXML] W3C specs compatibility and state transition issues

Hi Rahul,

My (limited) understand of JavaBeans is that a JavaBean object must
implement java.io.Serializable, has a public no argument constructor,
and contains set/get methods for properties. So I setup my result class
as follows:

    class result implements Serializable
        {
        public result() {}
        private int value;
        public int getValue()
            { return value; }
        public void setValue(int nNum)
            { value = nNum; }
        }

However, the state transition still does not work!

FYI, I was able to prove that the object is sent to the engine correctly
using:

result newResult = (result)getEngine().getRootContext().get("result");

But for some reason, I cannot retrieve/use "result.value" in my XML
file!

Any ideas what I'm missing here? Thanks for the help.

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

-----Original Message-----
From: Rahul Akolkar [mailto:rahul.akolkar@...]
Sent: Friday, April 11, 2008 6:56 PM
To: Jakarta Commons Users List
Subject: Re: [SCXML] W3C specs compatibility and state transition issues

On Fri, Apr 11, 2008 at 7:15 PM, Ouyang, Landon - ES/RDR -Gil
<Landon.Ouyang@...> wrote:

> Hmmm....
>
> Given your snippet, I assumed this would work:
>
> result aResult = new result();
>
> if(bIsTest)
>   aResult.value = 1;
> else
>   aResult.value = 0;
>
> getEngine().getRootContext().set("result", aResult);
>
> where the XML transition is conditional on "result.value eq 1". Why
> doesn't it work?
>
<snip/>

Try adding getter and setter methods, as I suggest below (for property
"value" in this example). Detailed discussion is in the JavaBeans
spec, which forms the basis of bean property access in most ELs we
use.

-Rahul


> --
> Landon Ouyang
> Member Technical Staff
> ITT Electronics Systems, Radar Systems - Gilfillan
> 7821 Orion Ave,
> Van Nuys, CA 91406
> (818) 901-2982
>
>
> -----Original Message-----
> From: Rahul Akolkar [mailto:rahul.akolkar@...]
>
> Sent: Friday, April 11, 2008 2:18 PM
> To: Jakarta Commons Users List
> Subject: Re: [SCXML] W3C specs compatibility and state transition
issues

>
> On Fri, Apr 11, 2008 at 5:01 PM, Ouyang, Landon - ES/RDR -Gil
> <Landon.Ouyang@...> wrote:
> > I figured out the solution:
> >
> > I needed to remove the event properties from the conditional
> > transitions. So if I change the state to:
> >
> > <state id="six">
> >        <datamodel>
> >                <data name="result">
> >                        <value>0</value>
> >                </data>
> >        </datamodel>
> >  <transition cond="result.value eq '1'" target="zero"/>
> >  <transition cond="result.value eq '0'" target="five"/>
> >  <transition target="three" event="display.prev"/>
> > </state>
> >
> > the code will work! Am I missing any other crucial details?
> >
> <snip/>
>
> Not really, but couple of comments:
>
>  * At a quick glance, I suspect you don't need the <datamodel>
> specified declaratively, so you can just remove the entire <datamodel>
> element (we are setting "result.value" via Java handlers). A brief
> discussion about datamodels is here:
>
>  http://commons.apache.org/scxml/guide/datamodel.html
>
>  * When I gave the example (below), I intended "fooresult.success" and
> "fooresult.numfailures" to be expressions of the flavor bean.property
> i.e. fooresult was an instance of:
>
> class FooResult {
>  get/setSuccess()
>  get/setNumfailures()
> }
>
> Generally better if you want to return a data structure, rather than
> multiple "flat variables" (your example is fine, for one value its
> much overhead).
>
> -Rahul
>

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


This e-mail and any files transmitted with it may be proprietary and are
intended solely for the use of the individual or entity to whom they are
addressed. If you have received this e-mail in error please notify the
sender. Please note that any views or opinions presented in this e-mail
are solely those of the author and do not necessarily represent those of
ITT Corporation. The recipient should check this e-mail and any
attachments for the presence of viruses. ITT accepts no liability for
any damage caused by any virus transmitted by this e-mail.

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


This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.

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


Re: [SCXML] State transitions from within handler

by Rahul Akolkar