You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Sh...@asu.edu on 2006/03/24 20:07:36 UTC

[SCXML] Help with sending events

Hi,

I am a graduate student developing a testing tool for an open source software 
framework providing image-guided surgery applications (http://www.igstk.org/). 
State machines are used to ensure the stability of the components in this 
framework. We are very interested in using SCXML engine for the test suite.
My problem is that, I am having trouble triggering the events in order to make 
transitions. Using the “fireEvent” method I am able to achieve this, but I 
would like to use <send> to send the events. Right now, although the send gets 
called during the scxml execution, the transition does not happen whether I 
call it from the same session or externally. 

My scxml file looks something like this:

<?xml version="1.0"?>
<scxml xmlns="http://www.w3.org/2005/07/SCXML"
	 version="1.0"
       initialstate="NullImageSpatialObjectState">
	<state id="NullImageSpatialObjectState">
		<transition event=" validImageSpatialObjectInput">
				<target next="ValidImageSpatialObjectState"/>
		</transition>
	</state>
        ………………………
</scxml>

I am using 
<send  targettype="scxml" event="validImageSpatialObjectInput"/> to send the 
validImageSpatialObjectInput event. 

I am a little confused as to how <send> works.

Any help is appreciated.

Thank you,
shylaja

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


Re: [SCXML] metamodel

Posted by Rahul Akolkar <ra...@gmail.com>.
On 6/21/06, Beatriz Pérez <be...@unizar.es> wrote:
> Hello, I am starting to study the use of Commons scxml and I would like to
> know if it is based on the UML 2.0 metamodel, it is, if it implements the
> elements of the metamodel.
<snap/>

No, it doesn't. From a tooling perspective, what I've seen till date
serves primarily as a serialization mechanism for UML 2.0 state chart
diagrams into SCXML documents.

Were you expecting it to be based on the UML 2.0 metamodel? Why? (for
my own understanding)

-Rahul


> if thats the case, Is there any package where I can see the implemented
> classes?
> Thanks
>
>

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


[SCXML] metamodel

Posted by Beatriz Pérez <be...@unizar.es>.
Hello, I am starting to study the use of Commons scxml and I would like to 
know if it is based on the UML 2.0 metamodel, it is, if it implements the 
elements of the metamodel.
if thats the case, Is there any package where I can see the implemented 
classes?
Thanks 


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


Re: [SCXML] Help with sending events

Posted by Rahul Akolkar <ra...@gmail.com>.
On 3/24/06, Shylaja.Kokoori@asu.edu <Sh...@asu.edu> wrote:
> Hi,
>
> I am a graduate student developing a testing tool for an open source software
> framework providing image-guided surgery applications (http://www.igstk.org/).
> State machines are used to ensure the stability of the components in this
> framework. We are very interested in using SCXML engine for the test suite.
<snip/>

Sounds like a good usecase, thanks for sharing.


> My problem is that, I am having trouble triggering the events in order to make
> transitions. Using the "fireEvent" method I am able to achieve this, but I
> would like to use <send> to send the events. Right now, although the send gets
> called during the scxml execution, the transition does not happen whether I
> call it from the same session or externally.
>
<snap/>

You are right, this bit is not implemented according to the latest
SCXML working draft. I'll try to make the necessary change over the
weekend; you can also file a ticket in the ASF bugzilla to track this
issue. Details are on the issue tracking page [1].

<send> can be overloaded in as many ways as "targettypes" the user
wishes to support. Looking at the example Mike shared with us, the
engine is sending events and data to an external system (in this case
a browser -- happens to be a speech browser, hence the VoiceXML
markup). For such usages, the events will be processed by suitable
implementations of the EventDispatcher interface from Commons SCXML.
However, in the specific case where (your usage scenario):

 * The <send> targettype is "scxml"

 * The target is not specified or empty (defaults to current execution)

the SCXML WD is clear that it should result in a "derived" event being
triggered on the current state machine. That will soon be the case.
Sorry about the confusion.

-Rahul

[1] http://jakarta.apache.org/commons/sandbox/scxml/issue-tracking.html



> My scxml file looks something like this:
>
> <?xml version="1.0"?>
> <scxml xmlns="http://www.w3.org/2005/07/SCXML"
>         version="1.0"
>       initialstate="NullImageSpatialObjectState">
>        <state id="NullImageSpatialObjectState">
>                <transition event=" validImageSpatialObjectInput">
>                                <target next="ValidImageSpatialObjectState"/>
>                </transition>
>        </state>
>        ………………………
> </scxml>
>
> I am using
> <send  targettype="scxml" event="validImageSpatialObjectInput"/> to send the
> validImageSpatialObjectInput event.
>
> I am a little confused as to how <send> works.
>
> Any help is appreciated.
>
> Thank you,
> shylaja
>

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


Re: [SCXML] Help with sending events

Posted by Rahul Akolkar <ra...@gmail.com>.
On 3/25/06, shylaja <sh...@yahoo.com> wrote:
> Thank you very much Mike and Rahul for all the support
>
> you both provided.
>
<snip/>

You're welcome (speaking for myself ;-).

> Send event works fine now, with the latest build.
>
<snap/>

Thanks for that feedback.

-Rahul


> Thanks again,
> shylaja
>

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


Re: [SCXML] Help with sending events

Posted by shylaja <sh...@yahoo.com>.
Thank you very much Mike and Rahul for all the support

you both provided.

Send event works fine now, with the latest build.

Thanks again,
shylaja


--- Rahul Akolkar <ra...@gmail.com> wrote:

> On 3/24/06, Shylaja.Kokoori@asu.edu
> <Sh...@asu.edu> wrote:
> <snip/>
> > My problem is that, I am having trouble triggering
> the events in order to make
> > transitions. Using the "fireEvent" method I am
> able to achieve this, but I
> > would like to use <send> to send the events. Right
> now, although the send gets
> <snap/>
> 
> This has been fixed in SVN. You can build from SVN
> [1],[2] or wait for
> the nightlies to appear here [3] within a day or two
> -- I expect the
> 20060325 nightlies to contain the addition.
> 
> See the accompanying test case [4] for usage
> examples. The Commons
> SCXML user guide [5] deserves a section on events
> raised internally
> via the <send> element, as well as all derived
> events that are raised
> as the engine executes (change notifications, entry
> and exit
> notifications etc.) and error events (target
> unavailable etc.). I'll
> add that to my documentation TODO list.
> 
> Feedback on documentation, especially where it
> currently lacks, is welcome.
> 
> -Rahul
> 
> (long URLs, may be fragmented)
> 
> [1]
>
http://svn.apache.org/repos/asf/jakarta/commons/sandbox/scxml/trunk/
> [2]
>
http://jakarta.apache.org/commons/sandbox/scxml/building.html
> [3]
>
http://cvs.apache.org/builds/jakarta-commons/nightly/commons-scxml/
> [4]
>
http://svn.apache.org/repos/asf/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/send-02.xml
> [5]
>
http://jakarta.apache.org/commons/sandbox/scxml/guide.html
> 


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


Re: [SCXML] Help with sending events

Posted by Rahul Akolkar <ra...@gmail.com>.
On 3/24/06, Shylaja.Kokoori@asu.edu <Sh...@asu.edu> wrote:
<snip/>
> My problem is that, I am having trouble triggering the events in order to make
> transitions. Using the "fireEvent" method I am able to achieve this, but I
> would like to use <send> to send the events. Right now, although the send gets
<snap/>

This has been fixed in SVN. You can build from SVN [1],[2] or wait for
the nightlies to appear here [3] within a day or two -- I expect the
20060325 nightlies to contain the addition.

See the accompanying test case [4] for usage examples. The Commons
SCXML user guide [5] deserves a section on events raised internally
via the <send> element, as well as all derived events that are raised
as the engine executes (change notifications, entry and exit
notifications etc.) and error events (target unavailable etc.). I'll
add that to my documentation TODO list.

Feedback on documentation, especially where it currently lacks, is welcome.

-Rahul

(long URLs, may be fragmented)

[1] http://svn.apache.org/repos/asf/jakarta/commons/sandbox/scxml/trunk/
[2] http://jakarta.apache.org/commons/sandbox/scxml/building.html
[3] http://cvs.apache.org/builds/jakarta-commons/nightly/commons-scxml/
[4] http://svn.apache.org/repos/asf/jakarta/commons/sandbox/scxml/trunk/src/test/java/org/apache/commons/scxml/send-02.xml
[5] http://jakarta.apache.org/commons/sandbox/scxml/guide.html

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


Re: [SCXML] Help with sending events

Posted by Rahul Akolkar <ra...@gmail.com>.
On 3/24/06, Mike Sparr - www.goomzee.com <mi...@goomzee.com> wrote:
> Hey,
>
> I see you got that far.  You will create your own implementation of the
> EventDispatcher interface and within, capture the event and place in object
> stored in session (in memory hashmap).  That object that contains the event
> can be accesses from your controller and you can fire an event based on the
> event captured from the Send object.
>
<snip/>

Hi Mike,

This will indeed work. We can also get this done without the
bi-directional association implied below (so the EventDispatcher
doesn't need a "handle" back to the SCXMLExecutor -- either directly
or via some other intermediary). We can short-circuit the
EventDispatcher for the specific usecase Shylaja points out, simply by
adding the event to the derived events in Send#execute(), and avoiding
the callback on the EventDispatcher altogether (from where we'd only
have to figure out our way back). The derived events get "triggered"
automagically.

Thanks, as always, for your input. Nice to know your (gomzee's?)
system is up and running.

-Rahul


> Class that implements EventDispatcher
>
> XXX implements EventDispatcher {
> ....
>    public void send(String sendId, String target, String targetType,
>            String event, Map params, Object hints, long delay,
>            List externalNodes) {
>         get event from here, place in object that your controller can
> access, then call TriggerEvent from within there.
>     }
> ...
>
> }
>
> ========
>
> Your controller class can TriggerEvent:
>
>            TriggerEvent[] te = { new
> TriggerEvent(someStoredObject.getEvent(),
>                    TriggerEvent.SIGNAL_EVENT) };
>
>
<snap/>

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


Re: [SCXML] Help with sending events

Posted by "Mike Sparr - www.goomzee.com" <mi...@goomzee.com>.
Hey,

I see you got that far.  You will create your own implementation of the
EventDispatcher interface and within, capture the event and place in object
stored in session (in memory hashmap).  That object that contains the event
can be accesses from your controller and you can fire an event based on the
event captured from the Send object.

Class that implements EventDispatcher

XXX implements EventDispatcher {
....
    public void send(String sendId, String target, String targetType,
            String event, Map params, Object hints, long delay,
            List externalNodes) {
         get event from here, place in object that your controller can
access, then call TriggerEvent from within there.
     }
... 

}

========

Your controller class can TriggerEvent:

            TriggerEvent[] te = { new
TriggerEvent(someStoredObject.getEvent(),
                    TriggerEvent.SIGNAL_EVENT) };


========

Sorry I cannot got into great details - Rahul Alkolkar, one of the authors
could help more.  Our implementation is rather proprietary but I think this
covers most of the generic functionality.  If you look at his SimpleXXXXX
classes they show you how to implement.

Best,


Mike




On 3/24/06 1:13 PM, "Mike Sparr - www.goomzee.com" <mi...@goomzee.com> wrote:

> Below is an example of how we use SCXML.  You can declare the event in the
> <send> tag and it is sent.  Of course each implementation of the executor
> varies, but maybe this will help.
> 
> =====
> 
>   <state id="state_logoff" final="true">
> 
>     <transition event="menu" >
>       <send target="http://localhost:8080/goomzee" targettype="client"
> event="menu" delay="0" hints="" sendid="2345">
> <vxml version="2.0">
> 
> <form>
> 
> <field name="input">
> 
> <prompt>You are now logged off.  Goodbye</prompt>
> 
> </field>
> 
> <filled namelist="input">
> <submit next="http://localhost:8080/goomzee/Voice" namelist="input"/>
> 
> </filled>
> 
> </form>
> 
> </vxml>
>       </send>
>       <target next="state_welcome" />
>     </transition>
> 
>   </state>
> 
> =====
> 
> You could alternately not include body content within sent and declare the
> event as such:
> 
> <send target="http://localhost:8080/goomzee" targettype="client"
> event="menu" delay="0" hints="" sendid="2345" />
> 
> For this demo script, I have a welcome state which prompts for login/logoff.
> Then a login state and a logoff state that ultimately reverts back to
> welcome.  
> 
> =====
> 
> Mike
> 
> 
> 
> 
> 
> On 3/24/06 12:07 PM, "Shylaja.Kokoori@asu.edu" <Sh...@asu.edu>
> wrote:
> 
>> Hi,
>> 
>> I am a graduate student developing a testing tool for an open source software
>> framework providing image-guided surgery applications
>> (http://www.igstk.org/).
>> State machines are used to ensure the stability of the components in this
>> framework. We are very interested in using SCXML engine for the test suite.
>> My problem is that, I am having trouble triggering the events in order to
>> make
>> transitions. Using the ³fireEvent² method I am able to achieve this, but I
>> would like to use <send> to send the events. Right now, although the send
>> gets
>> called during the scxml execution, the transition does not happen whether I
>> call it from the same session or externally.
>> 
>> My scxml file looks something like this:
>> 
>> <?xml version="1.0"?>
>> <scxml xmlns="http://www.w3.org/2005/07/SCXML"
>> version="1.0"
>>        initialstate="NullImageSpatialObjectState">
>> <state id="NullImageSpatialObjectState">
>> <transition event=" validImageSpatialObjectInput">
>> <target next="ValidImageSpatialObjectState"/>
>> </transition>
>> </state>
>>         ŠŠŠŠŠŠŠŠŠ
>> </scxml>
>> 
>> I am using 
>> <send  targettype="scxml" event="validImageSpatialObjectInput"/> to send the
>> validImageSpatialObjectInput event.
>> 
>> I am a little confused as to how <send> works.
>> 
>> Any help is appreciated.
>> 
>> Thank you,
>> shylaja
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
> 



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


Re: [SCXML] Help with sending events

Posted by "Mike Sparr - www.goomzee.com" <mi...@goomzee.com>.
Below is an example of how we use SCXML.  You can declare the event in the
<send> tag and it is sent.  Of course each implementation of the executor
varies, but maybe this will help.

=====

  <state id="state_logoff" final="true">

    <transition event="menu" >
      <send target="http://localhost:8080/goomzee" targettype="client"
event="menu" delay="0" hints="" sendid="2345">
<vxml version="2.0">

<form>

<field name="input">

<prompt>You are now logged off.  Goodbye</prompt>

</field>

<filled namelist="input">
<submit next="http://localhost:8080/goomzee/Voice" namelist="input"/>

</filled>

</form>

</vxml>
      </send>
      <target next="state_welcome" />
    </transition>

  </state>

=====

You could alternately not include body content within sent and declare the
event as such:

<send target="http://localhost:8080/goomzee" targettype="client"
event="menu" delay="0" hints="" sendid="2345" />

For this demo script, I have a welcome state which prompts for login/logoff.
Then a login state and a logoff state that ultimately reverts back to
welcome.  

=====

Mike





On 3/24/06 12:07 PM, "Shylaja.Kokoori@asu.edu" <Sh...@asu.edu>
wrote:

> Hi,
> 
> I am a graduate student developing a testing tool for an open source software
> framework providing image-guided surgery applications (http://www.igstk.org/).
> State machines are used to ensure the stability of the components in this
> framework. We are very interested in using SCXML engine for the test suite.
> My problem is that, I am having trouble triggering the events in order to make
> transitions. Using the ³fireEvent² method I am able to achieve this, but I
> would like to use <send> to send the events. Right now, although the send gets
> called during the scxml execution, the transition does not happen whether I
> call it from the same session or externally.
> 
> My scxml file looks something like this:
> 
> <?xml version="1.0"?>
> <scxml xmlns="http://www.w3.org/2005/07/SCXML"
> version="1.0"
>        initialstate="NullImageSpatialObjectState">
> <state id="NullImageSpatialObjectState">
> <transition event=" validImageSpatialObjectInput">
> <target next="ValidImageSpatialObjectState"/>
> </transition>
> </state>
>         ŠŠŠŠŠŠŠŠŠ
> </scxml>
> 
> I am using 
> <send  targettype="scxml" event="validImageSpatialObjectInput"/> to send the
> validImageSpatialObjectInput event.
> 
> I am a little confused as to how <send> works.
> 
> Any help is appreciated.
> 
> Thank you,
> shylaja
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org



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