commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar" <>
Subject Re: SCXML - getting started
Date Sun, 20 Jul 2008 13:23:36 GMT
On Thu, Jul 17, 2008 at 7:05 PM, Anna Klisiewicz
<> wrote:
> Hi Chris,
> Thank you for your answer.
> 2008/7/14 Christian Grobmeier <>:
>> Hi Anna,
>> are you sure you want to use SCXML? Its not an API for parsing XML files in
>> general, its:
>> "State Chart XML (SCXML) is a general-purpose event-based state machine
>> language"
> Yes I am sure, I need to use SCXML. I would like to avoid  Java, as I don't
> have experience with it and to be honest, I am not really good at oo
> programming. Unfortunately it seems that there is not too much choice and
> Commons SCXML is the best way.

You will need some familiarity with Java to use Commons SCXML. Basics
are here (amongst many other places):

>> I wonder that you are starting with Java and with SCXML at the same time.
>> If yes, did you read that?
>> You can read that you have several ways to give an XML file to the SCXML
>> parser:
> Yes I have seen it and I haven't created anythig working. I couldn't even
> run the StopWatch example, because I had some errors, and due to luck of
> experience I couldn't fix it. The biggest problem I've got is using classes
> effectively.

The stopwatch example may not be the easiest to get working if you
aren't familiar with setting up classpaths etc. After "hello world",
the right tools will make the difference, though I'm aware there is
some cost upfront to being able to use any of them. I'd recommend
getting to know either Ant or Maven for building (and more). IDEs
(such as Eclipse) help some developers.

> I have to  write a dialogue system and the scxml code will look simillar to
> this below. What would you suggest to use to make it working? What should I
> focus on while learning, because I feel discouraged now and It doesn't seem
> that I will be able to use Commons SCXML effectively soon.

The general pattern is:
 * Obtain a URL to the SCXML document (theres couple of other options,
using InputSource and "real path", we'll skip that for now)
 * Parse the document:
 * Create an instance of the state machine described by the document:
 * Trigger one or more events on the state machine (causing various
other interesting things to happen, thats for another day):

If you're having specific difficulties in using Commons SCXML, please
do not hesitate to ask.

Finally, the content below won't validate as SCXML (see W3C Working
Draft for all the details):

 * <state> doesn't have a target attribute, you'll need to use <initial>
 * <transition> doesn't have vars or precond attributes

You will have to get that sorted out before you can use the document.


> Best wishes, Anna
> <datamodel>
>    <data name="is">
>       <private>
>          <plan eval="true"> </plan>
>          <bel eval="true"> </bel>
>       </private>
>       <shared>
>          <com eval="true">  </com>
>          <qud eval="true"> </qud>
>       </shared>
>    </data>
> <datamodel>
> <parallel id="ds">
>    <state id="Moves" target="select">
>       <state id="select" target="selectAction">
>          <state id="Action">
>             <transition vars="Action" precond="" target="selectMove">
>                <script>...</script>
>             </transition>
>             <transition target="selectMove"/>
>          </state>
>          <state id="selectMove">
>             <transition vars="Question Answer"
> precond="..."target="update">
>                <send target="Self" event="generateMove" expr=""/>
>             </transition>
>          <state>
>      <!--some more states...-->
>       </state>
>    </state>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message