commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Micka <mickamus...@gmail.com>
Subject Re: SCXML : send & transition doesn't work when they are in the same state.
Date Sun, 28 Nov 2010 12:51:42 GMT
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 ?

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.akolkar@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 <mickamusset@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 !!!
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
Michael Musset,
Tel: 06 26 06 29 89

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message