commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Renaud, Martin" <Martin.Ren...@nuance.com>
Subject RE: SCXML : can we use ${prop-name-attributes} within <scxml /> definition ?
Date Wed, 05 Aug 2009 19:29:28 GMT
Hi Rahul,

Thanks for answering.

I want to avoid repeating the event name twice, because of the typo risks (among others).

For example, once in the state machine definition:

	<state id="MyState">
        <transition event="core.request.sent"   target="MySecondState"/>
	</state>

And again in the code:

	public static String EVENT_NAME = "core.request.send";
	...
	mySM.fireEvent(EVENT_NAME)


The names are different (send/sent).

I could easily inject the names in my java code using spring and a property file. EX:

event.name.foo=core.request.sent

and use the property name ${event.name.foo} where I need in spring files and use some bean
to trigger the events. I would like to know if there is a similar substitution mechanism that
allows me to use to a property file (the same in this case) against my state machine definition.

I understand that I can pre-process the xml document before handing it to scxml, but I wanted
to know if this feature exists or is being plan.

Thanks,

Martin


-----Original Message-----
From: Rahul Akolkar [mailto:rahul.akolkar@gmail.com] 
Sent: Wednesday, August 05, 2009 3:05 PM
To: Commons Users List
Subject: Re: SCXML : can we use ${prop-name-attributes} within <scxml /> definition
?

On Wed, Aug 5, 2009 at 8:37 AM, Renaud, Martin<Martin.Renaud@nuance.com> wrote:
> Hi,
>
> I would like to know if it's possible, using a built-in feature of
> apache commons scxml, to use property place holder in the xml file that
> defines the state machine ? The reason is to avoid duplication of event
> names in the sm definition and in the java code ?
>
<snip/>

Not sure which duplication is being refered to, please elaborate.


>
>
> Basically, I would like to do something like this and have a property
> file defining eventA and eventB.
>
<snap/>

Pre-processing of any sort can be done to the SCXML document before
being handed to the library ofcourse. It seems something like XML
entities may help you here (but I'll need help understanding the
question first).

-Rahul


>
>
> <scxml xmlns="http://www.w3.org/2005/07/scxml"
>       version="1.0"
>       initialstate="reset">
>
>    <state id="MyState">
>        <transition event="${eventA}"   target="MySecondState"/>
>    </state>
>
>    <state id="MySecondState">
>        <transition event="${eventB}"    target="MyState"/>
>    </state>
> </scxml>
>
>
> Thanks,
>
> Martin
>
>

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


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


Mime
View raw message