commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Rahul Akolkar" <rahul.akol...@gmail.com>
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
<anna.klisiewicz@googlemail.com> wrote:
> Hi Chris,
> Thank you for your answer.
>
> 2008/7/14 Christian Grobmeier <grobmeier@gmail.com>:
>
>> 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.
>
<snip/>

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

  http://java.sun.com/docs/books/tutorial/


>>
>> I wonder that you are starting with Java and with SCXML at the same time.
>> If yes, did you read that?
>>
>> http://commons.apache.org/scxml/guide/core-parser.html
>>
>> You can read that you have several ways to give an XML file to the SCXML
>> parser:
>>
>> http://commons.apache.org/scxml/apidocs/org/apache/commons/scxml/io/SCXMLParser.html
>
>
> 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.
>
<snap/>

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.
<snip/>

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:
    http://commons.apache.org/scxml/guide/core-parser.html
 * Create an instance of the state machine described by the document:
    http://commons.apache.org/scxml/guide/core-engine.html
 * Trigger one or more events on the state machine (causing various
other interesting things to happen, thats for another day):
    http://commons.apache.org/scxml/guide/core-events.html

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.

-Rahul


> 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: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org


Mime
View raw message