commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abigail Gertner <gert...@mitre.org>
Subject Re: [scxml] datamodel, custom actions and digester
Date Wed, 11 Aug 2010 19:51:42 GMT


On 8/11/2010 3:36 PM, Rahul Akolkar wrote:
> On Wed, Aug 11, 2010 at 2:19 PM, Abigail Gertner <gertner@mitre.org> wrote:
>   
>>
>> On 8/11/2010 12:29 AM, Rahul Akolkar wrote:
>>     
>>> <snip/>
>>> The way to obtain the live values of the datamodel is to use the
>>> expression evaluator, see interfaces mentioned here:
>>>
>>>   http://commons.apache.org/scxml/guide/contexts-evaluators.html
>>>
>>>
>>>       
>> Is it possible to call a method using the expression evaluator with an
>> argument that is a node in the XML tree, rather than just a string value?
>>
>>     
> <snip/>
>
> Executable content is open ended in SCXML, as largely speaking most
> things are possible with custom actions. I'm afraid I've lost the
> bigger picture of your scenario in the pin-pointed question above.
>
> To obtain a node using the expression evaluator, use
> Evaluator#evalLocation(...) which returns a Node.
>   

What I mean is, if I want to do something like:

<onentry>
  <cs:var name="result" expr="foo.bar(...)"/>
</onentry>

Where the argument to foo.bar() is a Node from the datamodel, but with
the current context values included, how can I get that from the
expression evaluator. I tried using the Data('var','path') expression
but it doesn't seem to work for nodes.

>>> Might be worthwhile revisiting the need for using
>>> SCXMLParser#newInstance() rather than the static parse methods.
>>>
>>>
>>>
>>>       
>> The reason I am doing this is that I am using xinclude to include a
>> separate xml file and I found that I needed to call setXIncludeAware()
>> on the parser to make it do the include. Is there some way to do this
>> using the static parse methods?
>>
>>     
> <snap/>
>
> Not in the latest release (v0.9) so thats one of the cases where you
> may indeed not be able to use the static parse methods. Based on what
> I've read so far, it seems your best bet may be to register the
> digester rules for your custom actions by hand after you obtain the
> new instance and let the custom action do the appropriate expression
> evaluation and datamodel / context processing.
>   
I'm trying to do it this way now and having trouble getting the custom
action to fire. I am using

dig.addObjectCreate("!*/onentry/sendMessage", SendMessage.class);

Where my custom action is called SendMessage.

Then in my scxml file I have

<onentry>
  <sendMessage/>
</onentry>

The SendMessage object is being created when the file is parsed, but the
execute() method is not being called when the state is entered.
Do I have to do something else to get it to call execute()?

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


Mime
View raw message