You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by 박성찬 <sc...@gmail.com> on 2006/02/02 03:24:25 UTC

[SCXML] context parameter?

I found the context parameter "cook_time" in the microwave-01 example. It
should be a parameter connecting local variables with the external
component.
But i can't find any declaration, realization or assignment of that
"cook_time" in java code.
Is my approach right? I am going to use EMMA as context parameters in my
future usage.
What's your answers?

Sung Chan Park

Re: [SCXML] context parameter?

Posted by Rahul Akolkar <ra...@gmail.com>.
On 2/1/06, 박성찬 <sc...@gmail.com> wrote:
> I found the context parameter "cook_time" in the microwave-01 example. It
> should be a parameter connecting local variables with the external
> component.
> But i can't find any declaration, realization or assignment of that
> "cook_time" in java code.
> Is my approach right?
<snip/>

Yes. This microwave-01 document [1] (or the similar one that uses EL)
is used primarily by some of the JUnit test cases and serves as an
example for the Standalone command-line utility classes as well. Since
it does not control any microwave ;-) you will find that the cook_time
gets set to an arbitrary value of "5" iff it is not already available
(this happens onentry into the "on" state).

You're right in saying <quote>It should be a parameter connecting
local variables with the external component</quote>. It sometimes
helps to think of the picture as the following three layers:

 * The "System" - The realization in software of the entity whose
behavior is being modeled. This could be anything from a speech or web
application to a device (such as microwave).

 * The "SCXML Engine" - What Commons SCXML gives you; a library that
can execute a state machine defined via a valid SCXML document.

 * The "Bridge" - The thin mediating layer between the SCXML engine
and the system. The bridge "connects" the local variables in the
document to the external component/system. In terms of the expression
language being used this implies populating the relevant Context with
the necessary variables (and their appropriate values) -- and
interpreting what a current set of states means.

I hope to write up a wiki/web page about SCXML Contexts and
Evaluators, but for starters, since the above example uses JEXL
expressions, you can probably get the feel by reading up some of the
JEXL docs:

http://jakarta.apache.org/commons/jexl/

as well as beginnings of the Commons SCXML API docs to see how a
document can be assigned a "root context" that bridges to the external
component:

http://jakarta.apache.org/commons/sandbox/scxml/api-notes.html


> I am going to use EMMA as context parameters in my
> future usage.
> What's your answers?
<snap/>

Yup, I'd say EMMA is one of the exciting possibilities of using SCXML
in conjunction with other documents. That would mean grabbing the
interesting bits out of the EMMA document (such as the
interpretations) -- or the entire document itself -- and populating
the relevant Context so you can describe the behavior in terms of the
information contained in the EMMA document, amongst other things. Once
the Context is populated, the data becomes available to all executable
content within the particular state, as well as guard conditions on
the transitions.

-Rahul

[1] http://svn.apache.org/repos/asf/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jexl/microwave-01.xml


>
> Sung Chan Park
>
>