commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From J J <jesfa...@yahoo.es>
Subject Re: [scxml] Problem raising event in scxml
Date Tue, 31 May 2011 16:24:47 GMT
Thank you very much, it worked! :)




________________________________
De: Rahul Akolkar <rahul.akolkar@gmail.com>
Para: Commons Users List <user@commons.apache.org>
Enviado: mar,31 mayo, 2011 16:54
Asunto: Re: [scxml] Problem raising event in scxml

On Tue, May 31, 2011 at 6:21 AM, J J <jesfalso@yahoo.es> wrote:
> Thanks Rahul,
> I've changed the in the way you told me and the warning disappeared, but it
> didn't work in the way I needed, so I've changed the implementation to do it 
in
> a custom action in the onentry tag.
<snip/>

OK, though there isn't enough information above.


> The custom Action does the work fine, but at
> the end I need to raise a "next event" to the queue but it's not working. I 
try
> to raise the event with eventDispatcher.send method but it's not lauching that
> event. I know it's not launchiung because I have a SCXMLListener with a 
onentry
> method wich is executed after the custom action and I can see in debug mode 
the
> states where the the flow goes.
>
> Here is the code I'm using. I've tried also to set target and type to null, 
but
> it happens the same.
>
> any idea?
>
<snap/>

Depends on the EventDispatcher implementation (the simple/dummy one in
the distro doesn't do much).


> thanks.
>
> public class Skip extends Action {
>
>    @Override
>    public void execute(EventDispatcher eventDispatcher, ErrorReporter
> errorReporter,
>            SCInstance scInstance, Log log, Collection derivedEvents) throws
> ModelException,
>            SCXMLExpressionException {
>            //some checks and if I want to skip this state I add in the String
> event
>            //variable the name of the event
>            ...
<snip/>

If you want a derived event, add it to "derivedEvents" like so:

   TriggerEvent te = ... // create the derived event after same checks as above
   derivedEvents.add(te);  // add to internal event queue

Thats about it.

-Rahul


>            if(event != null){
>                //I want to raise the event
>                String sendId = null;
>                String target = "#_internal";
>                String type = "scxml";
>                Map params = null;
>                Object hints = null;
>                long delay = 0;
>                List externalNodes = null;
>                eventDispatcher.send(sendId , target, type, event, params,
> hints, delay, externalNodes);
>            }
>    }
> }
>
>
>
>
> ________________________________
> De: Rahul Akolkar <rahul.akolkar@gmail.com>
> Para: Commons Users List <user@commons.apache.org>
> Enviado: jue,26 mayo, 2011 15:31
> Asunto: Re: [scxml] Problem raising event in scxml
>
> On Thu, May 26, 2011 at 7:55 AM, J J <jesfalso@yahoo.es> wrote:
>> Hello,
>>
>>
>> I'm having an issue with the <raise> tag inside an <if> element in the
>><onentry>
>> content.
>>
>> The problem is explained more in this Stackoverflow question:
>> http://stackoverflow.com/questions/6044370/problem-raising-event-in-scxml
>>
>> Can anyone tell me what may be the problem?
>>
> <snip/>
>
> As the warning message indicates, <raise> is not implemented yet,
> neither is _event (previously, a subset was _eventdata, which is
> implemented). You can use <send> with no target or type to achieve the
> same (basically change the element name in that snippet to be send).
>
> You may open enhancement requests for anything that isn't implemented
> yet from the latest draft [1].
>
> -Rahul
>
> [1] http://commons.apache.org/scxml/issue-tracking.html
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
For additional commands, e-mail: user-help@commons.apache.org
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message