You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Rahul Akolkar <ra...@gmail.com> on 2009/08/05 21:05:11 UTC

Re: SCXML : can we use ${prop-name-attributes} within definition ?

On Wed, Aug 5, 2009 at 8:37 AM, Renaud, Martin<Ma...@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


Re: SCXML : can we use ${prop-name-attributes} within definition ?

Posted by Rahul Akolkar <ra...@gmail.com>.
On Wed, Aug 5, 2009 at 3:50 PM, Renaud, Martin<Ma...@nuance.com> wrote:
> Ok thanks. That make sense. I was just checking in case of...
>
>
> I start prototyping with scxml, so I might bother you again in the next couple days ;-)
>
<snip/>

Its no bother, please ask away ;-)

-Rahul




> -Martin
>
>
> -----Original Message-----
> From: Rahul Akolkar [mailto:rahul.akolkar@gmail.com]
> Sent: Wednesday, August 05, 2009 3:41 PM
> To: Commons Users List
> Subject: Re: SCXML : can we use ${prop-name-attributes} within <scxml /> definition ?
>
> On Wed, Aug 5, 2009 at 3:29 PM, Renaud, Martin<Ma...@nuance.com> wrote:
>> 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).
>>
> <snip/>
>
> OK, got it.
>
>
>> 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.
>>
> <snap/>
>
> You will have to do some pre-processing since this kind of
> substitution is not provided as a feature by Commons SCXML. One could
> imagine a number of technologies (generate a DTD or DOCTYPE with
> entities, straight text replacement etc.) that will allow setting up
> of such pre-processing, so in that sense it almost seems beyond the
> scope of the core library function.
>
> -Rahul
>
>
>> 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<Ma...@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


RE: SCXML : can we use ${prop-name-attributes} within definition ?

Posted by "Renaud, Martin" <Ma...@nuance.com>.
Ok thanks. That make sense. I was just checking in case of...


I start prototyping with scxml, so I might bother you again in the next couple days ;-)

-Martin


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

On Wed, Aug 5, 2009 at 3:29 PM, Renaud, Martin<Ma...@nuance.com> wrote:
> 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).
>
<snip/>

OK, got it.


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

You will have to do some pre-processing since this kind of
substitution is not provided as a feature by Commons SCXML. One could
imagine a number of technologies (generate a DTD or DOCTYPE with
entities, straight text replacement etc.) that will allow setting up
of such pre-processing, so in that sense it almost seems beyond the
scope of the core library function.

-Rahul


> 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<Ma...@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


Re: SCXML : can we use ${prop-name-attributes} within definition ?

Posted by Rahul Akolkar <ra...@gmail.com>.
On Wed, Aug 5, 2009 at 3:29 PM, Renaud, Martin<Ma...@nuance.com> wrote:
> 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).
>
<snip/>

OK, got it.


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

You will have to do some pre-processing since this kind of
substitution is not provided as a feature by Commons SCXML. One could
imagine a number of technologies (generate a DTD or DOCTYPE with
entities, straight text replacement etc.) that will allow setting up
of such pre-processing, so in that sense it almost seems beyond the
scope of the core library function.

-Rahul


> 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<Ma...@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


RE: SCXML : can we use ${prop-name-attributes} within definition ?

Posted by "Renaud, Martin" <Ma...@nuance.com>.
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<Ma...@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