commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Luis dos Santos <daniel.d...@gmail.com>
Subject Re: [scxml] invoking methods on an object
Date Mon, 03 Oct 2011 23:07:28 GMT
Hi, 

Ok invoke is another thing. Meanwhile I did write some custom actions. What I am doing is
trying to call the object from within the actions.
I managed to get an instance to the object by passing a reference to it in the event trigger
method in my client code. I then access the parent context inside the custom action and get
the '_eventdata' object.

I was trying to define a variable with the <var> element inside the <onentry>
element but the engine warned me it was ignoring it. Do you know why ? I saw in the datamodel
section of the site that you can define them. (Although there is not a word of it in the 2011
w3c spec)

Sorry for my ignorance and dumb questions but I am very new to all this.

Thanks
Daniel Santos




On Oct 3, 2011, at 11:55 PM, Rahul Akolkar wrote:

> On Mon, Oct 3, 2011 at 9:17 AM, Daniel Luis dos Santos
> <daniel.dlds@gmail.com> wrote:
>> Hello,
>> 
>> I am beggining to use commons-SCXML. For now I created a generic class that wraps
the library's code just like the class AbstractStateMachine in the stopwatch example.
>> 
>> Each class from my application that will be governed by a state machine has an instance
of this, and has methods to trigger events on it.
> <snip/>
> 
> Note that the AbstractStateMachine pattern is a starter pattern and is
> limited if used in isolation. More patterns here:
> 
>  http://commons.apache.org/scxml/guide/using-commons-scxml.html
> 
> 
>> What I want to do is have methods from the object be called from state machine events.
For example, when I enter a state I want to be able to call a method on the stateful object.
>> 
>> I am trying to use invoke inside <onentry> but the markup is ignored. How can
I do this ?
>> 
> <snap/>
> 
> If you're talking about the <invoke> element, that is not an action
> (its a child of state not onentry) and requires Invoker
> implementations to be registered with the executor for each "type" of
> invoke.
> 
> If you want to call arbitrary Java methods within <onentry>, best to
> write a custom action for that. More on that here:
> 
>  http://commons.apache.org/scxml/guide/custom-actions.html
> 
> -Rahul
> 
> 
>> I am using version 0.9 from maven central.
>> 
>> Thanks
>> Daniel Santos
>> 
> 
> ---------------------------------------------------------------------
> 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