Hi Rahul,

Thanks for your suggested work arounds. I think the
count check on the SCXMLListener tracer would work for
e for now. But I am eagerly waiting for 0.6 with your
enhancement :-)

To clarify, if there had been an onEvent() callback, I
could have easily checked if the event made it. I was
considering events that do not effect to a state
transition (due to a condition, for example). Now,
with the work around, I will ensure that all events do
effect a state transition for now.

Also, thanks for your sugegstions on implementing role
based events. That was very helpful.

Regards
--
Raj

--- Rahul Akolkar <[EMAIL PROTECTED]> wrote:

> On 9/29/06, Madhwaraj Rao <[EMAIL PROTECTED]>
> wrote:
> > Hi Rahul,
> >
> > I found it difficult to implement your suggestion.
> > Events are asynchronous in my system, and having
> this
> > approach of first triggering an event, and
> verifying
> > that it resulted in a state transition (in an
> > EntryListener.onTransition()) is error prone. What
> if
> > an event didn't result in a state transition?
> >
> <snip/>
> 
> Then you know its "invalid" (I keep quoting it since
> there is no such
> thing, I'm just using the term in the context of
> your application).
> 
> 
> > Can you please sned me a code snippet with your
> > approach so I can really verify that it could be
> > applicable for me?
> >
> <snap/>
> 
> Sure. Here are examples of the workarounds I was
> talking about:
> 
> <example-1>
> 
> Set before =
> executor.getCurrentStatus().getStates();
> 
> // fire the event(s) ... executor.triggerEvent(...)
> etc.
> 
> Set after = executor.getCurrentStatus().getStates();
> 
> // compare before and after (ofcourse, won't work if
> there are self transitions)
> 
> </example-1>
> 
> -- OR --
> 
> <example-2>
> 
> // say tracer tracks the count of the number of
> transitions followed
> SCXMLListener tracer = new TransitionTracer();
> executor.addListener(scxml, tracer); // scxml is the
> oacsm.SCXML instance
> 
> int before = tracer.count();
> 
> // fire the event(s) ... executor.triggerEvent(...)
> etc.
> 
> int after = tracer.count();
> 
> // if after == before, invalid
> 
> </example-2>
> 
> etc. ...
> 
> 
> > Ideally, I would have liked a onEvent() callback
> in
> > the EntryListener.
> >
> <snip/>
> 
> Not sure I understand.
> 
> 
> > My other requirement is to prevent some events to
> > effect a state transition if the user role doesn't
> > have the right privileges.
> >
> <snap/>
> 
> Yes, this is a common requirement. You can implement
> it:
> 
>  * As a layer around Commons SCXML, using whatever
> means you choose to
> verify the user access rights as a function of the
> current user and
> current status of the state machine
> 
>  * As conditionals inside the SCXML document itself,
> guarding
> transitions and datamodel access appropriately
> (possibly using custom
> functions within the expression language chosen)
> 
> -Rahul
> 
> 
> > Thanks
> > --
> > Raj
> >
> > --- Rahul Akolkar <[EMAIL PROTECTED]> wrote:
> >
> > > On 9/27/06, Madhwaraj Rao
> <[EMAIL PROTECTED]>
> > > wrote:
> > > > Hello,
> > > >
> > > > I tried sending an invalid event to the state
> > > machine
> > > > and didn't see any error being reported. By
> > > invalid I
> > > > mean this event was not expected in the
> current
> > > state.
> > > >
> > > > Does the SCXMLSemanticsImpl report an error
> (via
> > > the
> > > > the ErrorReporter) when such an event is
> silently
> > > > discarded?
> > > >
> > > <snip/>
> > >
> > > No, because the semantics treat it as simply an
> > > inconsequential
> > > trigger (causing no change to the state
> machine),
> > > rather than an
> > > error.
> > >
> > > One of the ways you could track this is to
> register
> > > a SCXMLListener on
> > > the executor and track onTransition() callbacks
> (if
> > > you get none, the
> > > trigger is "invalid" -- per your definition
> above).
> > >
> > > -Rahul
> > >
> > >
> > > > Thanks
> > > > --
> > > > Raj
> > > >
> > >
> > >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to