You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Rahul Akolkar <ra...@gmail.com> on 2006/04/06 18:02:05 UTC

Re: [SCXML] variable scoping (was Re: uml2bpel cool, but what about csxml2bpel?)

Hi Mike,

Changing the subject, in an attempt to get the mailing list archives
to align things up.

On 4/6/06, Mike Sparr - www.goomzee.com <mi...@goomzee.com> wrote:
> Hey Rahul,
>
> Do I have to update my version (december snapshot) and implement <datamodel>
> to set global application variables?  I would like to set variables that all
> states/transitions can access and <assign> or cond="${var}".  I got it to
> work by declaring vars WITHIN the transition and passing in namelist for
> SEND..
>
> See my other post about variable scoping.  Help appreciated.
>
<snip/>

If you want to declare them at document root, then you will need the
datamodel snapshot (try tonight's build, the 20060406 one, from here
[1]), so you can do this:

<scxml ...>
 <datamodel>
  <data name="foo" expr="some_expression" />
  <!-- above usage of data is similar to var -->
 </datamodel>
  ...
  <!-- foo is now available to all states/transitions/conds/exprs in
this document -->
</scxml>

See this example [2] that uses EL (as I think you are using) -- its
just a test case (don't try to make sense of the state machine ;-),
but the point being "mainvar" is declared in state "main" and used in
"cond"s in child states as well, illustrating the variable scoping and
visibility.

If you haven't updated from December, there have been a few changes.
Since you already have a targettype set on the <send> (to "client") I
think you should be fine, but the general deal with sandbox components
is that there are no guarantees while updating between nightlies
(thats in theory, in practice -- if there is trouble, you can always
ping us and we can help resolve any deltas).

-Rahul

(long, possibly fragmented URLs below)

[1] http://cvs.apache.org/builds/jakarta-commons/nightly/commons-scxml/
[2] http://svn.apache.org/repos/asf/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jsp/datamodel-01.xml


> Rgds,
>
>
> Mike
>
<snap/>

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