You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Cedric NICOLAS <ce...@villefluide.fr> on 2009/11/03 23:23:01 UTC

Managing content in an SCXML file

Dear Rahul and others,

I want to do a quite simple thing : having a state machine on a server
controlling user interface of mobile clients. 
The state machine would have a lot of states and complex stream, and for
some specific states it will embedded a simple markup language content (e.g.
an html subset) that will be delivered to the mobile client which when it
receives it, interpret and display it.

For example the server state machine would have "connect" state that will be
triggered when the mobile is establishing a connection, and would react by
giving to the mobile client the content to be displayed. An simple example
would be :

<state id="connect">
	<content>
		<title> Welcome ! </title>
		<button> text="Click here to continue" action ="send_OK"
</button>
		<button> text="Quit" action ="send_Quit" </button>
</content>
	<transition event="send_OK" target="next_state"/>
	<transition event="send_Quit" target="final_state"/>
</state>

In that case the content in <content> tags will be retrieved by the Java
code on void connect() method, and sent to the device. Server will listen to
device and when receiving a message like send_OK, trigger this to the state
machine.

To summarize I want to emulate a tiny web server hosting some tiny pages
with a state machine.

I've gone through all the documentation of Commons Scxml, and didn't find an
easy way to do this. The possible ways I see are to use a data model, but
using <assign> tags for setting my content seems to be quite heavy to write
and don't know how to assign an XML tree to a data model node, and other
possibility would be to use maybe custom actions, but how to describe in a
simple way my XML like-content ?

Do you have a suggestion to do this in an easy and readable way ?



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


RE: Managing content in an SCXML file

Posted by Cedric NICOLAS <ce...@villefluide.fr>.
Martin,

Thanks for answer. Events for this state machine are quite simple, and I've
already fully implemented the communication layer. Events type being
triggered to the state machine will be : 
	- a first connexion from a device, 
	- a message from the device
	- an event from a master controller state machine.

The state machine in return can trigger events to :
	- the device that the SM is managing
	- the master controller state machine.

To be a little be more precise, there will be on server side on state
machine instance being created for each new device. Each of these instances
will control the corresponding device state, remotely, if you want. Then
there is a master state machine coordinating all devices children states
machines, as there is no direct communication between devices.

Objective is to have on the mobile device the lightest possible client
software, in order to be able to port easily that software on the different
mobile platforms, and also to have the full control as well of the business
logic but also of the UI on the server side, to be able to upgrade the UI on
the fly. The Scxml file will then fully define the behavior of the device,
but also the UI being displayed. The UI on mobile side is very very simple,
it is much lighter than HTML is. We will have one or two text fields and 3
buttons. It is why our markup language will be very simple as well : a tag
to fill the text field, and a tag to define button text and event.

My only concern here is how to embed easily in an scxml file this 2-tags
markup language for each state. This in order to have in only one state
machine file, as well the full business logic but the UI definition as well.
I don't want to have a separate resource file to handle the UI, in order to
have the scxml file defining and carrying all, it will be much easier to
maintain.

All the other aspects of the project have already been solved.

-----Message d'origine-----
De : Martin Gainty [mailto:mgainty@hotmail.com] 
Envoyé : mercredi 4 novembre 2009 00:10
À : user@commons.apache.org
Objet : RE: Managing content in an SCXML file


Cedric

a markup implies SGML..i assume this might be described as XSD or XML Schema
Definition?
Can you describe the events this state-machine model would support?
can you describe the content each event would carry and or generate?
Can you describe what would be contained in the header for each Event?
Can you describe what the body would look like for each event?

You might be able to implement a simple listener that listens on fixed
host/port and when message is received (EOT is achieved after receiving
header and body)
you can hand the body of the message to device

can you confine the size of the message? 
if not you might want to implement a packet model to buffer the packets to a
known structure
(as in some sort of linked-list) 
until body EOT is achieved 

sounds like a fun project!
Bon Chance
Martin Gainty 
______________________________________________ 
Note de déni et de confidentialité
 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le
destinataire prévu, nous te demandons avec bonté que pour satisfaire
informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
de ceci est interdite. Ce message sert à l'information seulement et n'aura
pas n'importe quel effet légalement obligatoire. Étant donné que les email
peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
aucune responsabilité pour le contenu fourni.




> From: cedric.nicolas@villefluide.fr
> To: user@commons.apache.org
> Subject: Managing content in an SCXML file
> Date: Tue, 3 Nov 2009 23:23:01 +0100
> 
> Dear Rahul and others,
> 
> I want to do a quite simple thing : having a state machine on a server
> controlling user interface of mobile clients. 
> The state machine would have a lot of states and complex stream, and for
> some specific states it will embedded a simple markup language content
(e.g.
> an html subset) that will be delivered to the mobile client which when it
> receives it, interpret and display it.
> 
> For example the server state machine would have "connect" state that will
be
> triggered when the mobile is establishing a connection, and would react by
> giving to the mobile client the content to be displayed. An simple example
> would be :
> 
> <state id="connect">
> 	<content>
> 		<title> Welcome ! </title>
> 		<button> text="Click here to continue" action ="send_OK"
> </button>
> 		<button> text="Quit" action ="send_Quit" </button>
> </content>
> 	<transition event="send_OK" target="next_state"/>
> 	<transition event="send_Quit" target="final_state"/>
> </state>
> 
> In that case the content in <content> tags will be retrieved by the Java
> code on void connect() method, and sent to the device. Server will listen
to
> device and when receiving a message like send_OK, trigger this to the
state
> machine.
> 
> To summarize I want to emulate a tiny web server hosting some tiny pages
> with a state machine.
> 
> I've gone through all the documentation of Commons Scxml, and didn't find
an
> easy way to do this. The possible ways I see are to use a data model, but
> using <assign> tags for setting my content seems to be quite heavy to
write
> and don't know how to assign an XML tree to a data model node, and other
> possibility would be to use maybe custom actions, but how to describe in a
> simple way my XML like-content ?
> 
> Do you have a suggestion to do this in an easy and readable way ?
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
 		 	   		  
_________________________________________________________________
Windows 7: Unclutter your desktop.
http://go.microsoft.com/?linkid=9690331&ocid=PID24727::T:WLMTAGL:ON:WL:en-US
:WWL_WIN_evergreen:112009


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


RE: Managing content in an SCXML file

Posted by Martin Gainty <mg...@hotmail.com>.
Cedric

a markup implies SGML..i assume this might be described as XSD or XML Schema Definition?
Can you describe the events this state-machine model would support?
can you describe the content each event would carry and or generate?
Can you describe what would be contained in the header for each Event?
Can you describe what the body would look like for each event?

You might be able to implement a simple listener that listens on fixed host/port and when message is received (EOT is achieved after receiving header and body)
you can hand the body of the message to device

can you confine the size of the message? 
if not you might want to implement a packet model to buffer the packets to a known structure
(as in some sort of linked-list) 
until body EOT is achieved 

sounds like a fun project!
Bon Chance
Martin Gainty 
______________________________________________ 
Note de déni et de confidentialité
 Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> From: cedric.nicolas@villefluide.fr
> To: user@commons.apache.org
> Subject: Managing content in an SCXML file
> Date: Tue, 3 Nov 2009 23:23:01 +0100
> 
> Dear Rahul and others,
> 
> I want to do a quite simple thing : having a state machine on a server
> controlling user interface of mobile clients. 
> The state machine would have a lot of states and complex stream, and for
> some specific states it will embedded a simple markup language content (e.g.
> an html subset) that will be delivered to the mobile client which when it
> receives it, interpret and display it.
> 
> For example the server state machine would have "connect" state that will be
> triggered when the mobile is establishing a connection, and would react by
> giving to the mobile client the content to be displayed. An simple example
> would be :
> 
> <state id="connect">
> 	<content>
> 		<title> Welcome ! </title>
> 		<button> text="Click here to continue" action ="send_OK"
> </button>
> 		<button> text="Quit" action ="send_Quit" </button>
> </content>
> 	<transition event="send_OK" target="next_state"/>
> 	<transition event="send_Quit" target="final_state"/>
> </state>
> 
> In that case the content in <content> tags will be retrieved by the Java
> code on void connect() method, and sent to the device. Server will listen to
> device and when receiving a message like send_OK, trigger this to the state
> machine.
> 
> To summarize I want to emulate a tiny web server hosting some tiny pages
> with a state machine.
> 
> I've gone through all the documentation of Commons Scxml, and didn't find an
> easy way to do this. The possible ways I see are to use a data model, but
> using <assign> tags for setting my content seems to be quite heavy to write
> and don't know how to assign an XML tree to a data model node, and other
> possibility would be to use maybe custom actions, but how to describe in a
> simple way my XML like-content ?
> 
> Do you have a suggestion to do this in an easy and readable way ?
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
> 
 		 	   		  
_________________________________________________________________
Windows 7: Unclutter your desktop.
http://go.microsoft.com/?linkid=9690331&ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen:112009