On Sun, Nov 28, 2010 at 7:51 AM, Micka <mickamus...@gmail.com> wrote:
> Hi,
>
> The problem is happening when I initalize manually the state of my machine,
> and I trigger the event.
> do you think that initializing the state manullay is causing the problem ?
>
<snip/>

Initializing to the state manually as below seems fine. What such
initialization will not do, however, is cause the execution of the
<onentry> of said state, as the state machine is already considered to
be in that state. So, in the original example below, if "STATE_START"
is that persisted state which is restored the <oentry> and thereby the
contained <send> will not be executed.

I don't see anything unexpected in the EventDispatcher implementation.

-Rahul


> public class NEventDispatcher implements EventDispatcher {
>     public NEventDispatcher() {
>     }
>     @Override
>     public void cancel(String arg0) {
>     }
>     @SuppressWarnings("unused")
>     @Override
>     public void send(String sendId, String targe, String type, String event,
>             Map params, Object hints, long delay, List externalNodes) {
>         if (externalNodes == null || externalNodes.size() <= 0)
>             return;
>         // some stupid code here, i'm just inserting the information in my
> database
>     }
> }
>
>
> The implementation of the machine that i use :
>
>         tracer = new NTracer();
>         nEventDispatcher=new NEventDispatcher();
>         exec = new SCXMLExecutor(new JexlEvaluator(), nEventDispatcher,
> tracer);
>         exec.setStateMachine(config);
>         exec.addListener(config, tracer);
>         map=new HashMap();
>         jExlCtx = new JexlContext(map);
>         exec.setRootContext(jExlCtx);
>         exec.setErrorReporter(tracer);
>
> and how i'm initializing the state :
>
>
>     @SuppressWarnings("unchecked")
>     public void setInitialState(String idOfPersistedState)throws Exception {
>         if (idOfPersistedState != null) {
>             Map<String, State> allStates =
> exec.getStateMachine().getTargets();
>             State state = allStates.get(idOfPersistedState);
>             if (state == null) {
>                 throw new Exception("Unknown state "
>                         + idOfPersistedState);
>             }
>             // got the state, now set it
>             @SuppressWarnings("rawtypes")
>             Set states = exec.getCurrentStatus().getStates();
>             states.clear();
>             states.add(state);
>         }
>     }
>
>
> On Fri, Nov 26, 2010 at 7:14 PM, Rahul Akolkar <rahul.akol...@gmail.com>
> wrote:
>>
>> This is a post for the user list, but please see below first ...
>>
>> On Fri, Nov 26, 2010 at 1:03 PM, Michael musset <mickamus...@gmail.com>
>> wrote:
>> > Hi,
>> >
>> >
>> > I'm having a problem in my scxml project :
>> >
>> >    <state id="STATE_START">
>> >        <onentry>
>> >            <send target="test" targettype="'x-csta'" xmlns:csta="
>> > http://www.ecma.ch/standards/ecma-323/csta";>
>> >                <EVENT TARGET="test"  TAG="EVENT_HELLO">
>> >                        <![CDATA[
>> >                                my data
>> >                        ]]>
>> >                </EVENT>
>> >            </send>
>> >        </onentry>
>> >        <transition event="EVENT_TEST" target="STATE_1"
>> > cond="_eventdata.DATA1
>> > eq 'ok'"/>
>> >        <transition event="EVENT_START" target="STATE_START" />
>> >    </state>
>> >
>> > the send tag is recuperate properly by the the eventdispatcher ( I need
>> > what
>> > is inside the send tag) , but I can't manage to change state into the
>> > STATE_1.
>> > And If I remove the all <send >... </send> tag , the transition is
>> > working,
>> > I manage to change state into the STATE_1.
>> >
>> >
>> > So what is wrong? I'm using JexlEvaluator and JexlContext for my engine.
>> >
>> <snip/>
>>
>> We'll need to know what your EventDispatcher implementation is doing
>> that might disrupt processing the original event, which is why the
>> payload guard condition may no longer hold for the transition you
>> expect to be taken. Lets continue on the Commons User list, see:
>>
>>  http://commons.apache.org/mail-lists.html
>>
>> -Rahul
>>
>>
>> >
>> >
>> > Thanks in advance for the help !!!
>> >
>>
>
>
> --
> Michael Musset,
> Tel: 06 26 06 29 89
>
>

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

Reply via email to