You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by "Berg, T.W. (Tom) van den" <to...@tno.nl> on 2008/07/17 10:37:58 UTC

Access to Context from custom action

What are the Java API calls the access the local Context (datamodel)
from a custom action?
And what is the Jexl code to do the same from the SCXML document?
 
For example, for the following simple SCML document:
- How can I retrieve the value "NAME1" from the custom action
rti:register ?
- How can I change this value from the custom action ?
- What is the Jexl code to pass the value NAME1 as parameter into
rti:register  (e.g. instead of using "doRegister") ?
 
Any help appreciated.
Thanks,
Tom van den Berg
 
 
<scxml xmlns="http://www.w3.org/2005/07/scxml"
       xmlns:rti="http://rti.actions/CUSTOM"
       version="1.0"
       initialstate="SyncPoint">
 
 <state id="SyncPoint">
  
  <datamodel>
   <data name="label">
    <value>NAME1</value>
   </data>
  </datamodel>
  
  <initial>
   <transition target="registered"/>
  </initial>
  
  <state id="registered">
   <onentry>
    <rti:register name="doRegister"/>
   </onentry>        
   <transition event="confirmed" target="confirmed"/>
   <transition event="error" target="error"/>
  </state>
  
  <state id="confirmed">
   <onentry>
    <rti:confirm name="doConfirm" />
   </onentry>        
   <transition target="end"/>
   <transition event="error" target="error"/>
  </state>
    
  <final id="end"/>
  
  <state id="error"></state>
 </state>
 
</scxml>
 
 
 
 
This e-mail and its contents are subject to the DISCLAIMER at http://www.tno.nl/disclaimer/email.html

Re: [SCXML] Access to Context from custom action

Posted by Rahul Akolkar <ra...@gmail.com>.
I forgot to mention that this is a shared list and we prefix email
subjects with the component name (so, in this case, I've now added
[SCXML] to the subject). Please use this convention going forward,
thanks.

On Thu, Jul 17, 2008 at 1:29 PM, Rahul Akolkar <ra...@gmail.com> wrote:
> On Thu, Jul 17, 2008 at 4:37 AM, Berg, T.W. (Tom) van den
> <to...@tno.nl> wrote:
>> What are the Java API calls the access the local Context (datamodel)
>> from a custom action?
> <snip/>
>
> Short reply since I'm running out of email time.
>
> You have a handle to the SCInstance (use the expression evaluator
> rather than context lookup where appropriate):
>
>  http://commons.apache.org/scxml/0.8/apidocs/org/apache/commons/scxml/SCInstance.html
>
>
>> And what is the Jexl code to do the same from the SCXML document?
>>
> <snap/>
>
> See this page (particularly, the latter half):
>
>  http://commons.apache.org/scxml/guide/datamodel.html
>
>
>> For example, for the following simple SCML document:
>> - How can I retrieve the value "NAME1" from the custom action
>> rti:register ?
> <snip/>
>
> All expressions untested, but meant to give you some hints:
>
> <cs:var name="retrievedvalue" expr="Data(label, 'value')"/>
>
>
>> - How can I change this value from the custom action ?
> <snap/>
>
> <assign location="Data(label, 'value')" expr="'NAME2'"/>
>
>
>> - What is the Jexl code to pass the value NAME1 as parameter into
>> rti:register  (e.g. instead of using "doRegister") ?
>>
> <snip/>
>
> See this post:
>
>  http://markmail.org/message/a3dtad2sfipehois
>
> The rest of that thread may be useful to glance at as well.
>
> -Rahul
>
>
>
>> Any help appreciated.
>> Thanks,
>> Tom van den Berg
>>
>>
>> <scxml xmlns="http://www.w3.org/2005/07/scxml"
>>       xmlns:rti="http://rti.actions/CUSTOM"
>>       version="1.0"
>>       initialstate="SyncPoint">
>>
>>  <state id="SyncPoint">
>>
>>  <datamodel>
>>   <data name="label">
>>    <value>NAME1</value>
>>   </data>
>>  </datamodel>
>>
>>  <initial>
>>   <transition target="registered"/>
>>  </initial>
>>
>>  <state id="registered">
>>   <onentry>
>>    <rti:register name="doRegister"/>
>>   </onentry>
>>   <transition event="confirmed" target="confirmed"/>
>>   <transition event="error" target="error"/>
>>  </state>
>>
>>  <state id="confirmed">
>>   <onentry>
>>    <rti:confirm name="doConfirm" />
>>   </onentry>
>>   <transition target="end"/>
>>   <transition event="error" target="error"/>
>>  </state>
>>
>>  <final id="end"/>
>>
>>  <state id="error"></state>
>>  </state>
>>
>> </scxml>
>>
>>
>

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


Re: Access to Context from custom action

Posted by Rahul Akolkar <ra...@gmail.com>.
On Thu, Jul 17, 2008 at 4:37 AM, Berg, T.W. (Tom) van den
<to...@tno.nl> wrote:
> What are the Java API calls the access the local Context (datamodel)
> from a custom action?
<snip/>

Short reply since I'm running out of email time.

You have a handle to the SCInstance (use the expression evaluator
rather than context lookup where appropriate):

  http://commons.apache.org/scxml/0.8/apidocs/org/apache/commons/scxml/SCInstance.html


> And what is the Jexl code to do the same from the SCXML document?
>
<snap/>

See this page (particularly, the latter half):

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


> For example, for the following simple SCML document:
> - How can I retrieve the value "NAME1" from the custom action
> rti:register ?
<snip/>

All expressions untested, but meant to give you some hints:

<cs:var name="retrievedvalue" expr="Data(label, 'value')"/>


> - How can I change this value from the custom action ?
<snap/>

<assign location="Data(label, 'value')" expr="'NAME2'"/>


> - What is the Jexl code to pass the value NAME1 as parameter into
> rti:register  (e.g. instead of using "doRegister") ?
>
<snip/>

See this post:

  http://markmail.org/message/a3dtad2sfipehois

The rest of that thread may be useful to glance at as well.

-Rahul



> Any help appreciated.
> Thanks,
> Tom van den Berg
>
>
> <scxml xmlns="http://www.w3.org/2005/07/scxml"
>       xmlns:rti="http://rti.actions/CUSTOM"
>       version="1.0"
>       initialstate="SyncPoint">
>
>  <state id="SyncPoint">
>
>  <datamodel>
>   <data name="label">
>    <value>NAME1</value>
>   </data>
>  </datamodel>
>
>  <initial>
>   <transition target="registered"/>
>  </initial>
>
>  <state id="registered">
>   <onentry>
>    <rti:register name="doRegister"/>
>   </onentry>
>   <transition event="confirmed" target="confirmed"/>
>   <transition event="error" target="error"/>
>  </state>
>
>  <state id="confirmed">
>   <onentry>
>    <rti:confirm name="doConfirm" />
>   </onentry>
>   <transition target="end"/>
>   <transition event="error" target="error"/>
>  </state>
>
>  <final id="end"/>
>
>  <state id="error"></state>
>  </state>
>
> </scxml>
>
>

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