commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Linda Erlenhov <>
Subject Re: [SCXML] getting set datats in the datamodel
Date Wed, 15 Apr 2009 16:34:28 GMT
So I´m back here again.

My problem now is that I don´t know how to notify.
I looked at the solution suggested below since I thought it would be the
easiest and best looking way to implement this.

The way my first solution worked was to use Observer and Observable. Since
Observable is a class I could not extend SimpleContext aswell (since
multiple inheritance from classes is not ok in java) so i just "copied"
SimpleContext instead since it only implemented two Interfaces, extended
Observable and modifyed it according to my liking. The problem then was that
to user timers (as I was asking about in another thread) and they use JEXL.
So to make the timers work I have to use an JEXL or JEXL extended class. And
there goes my Observable.

I am aware that this might be a java question instead of a SCXML question
and if so I apologise. Maybe you can see something that I have missed or
help me with where I should post this question. I´ve stared a bit too long
at my code by now. Is there another way to do this?

best regards

> >>
> >>  * Use a custom Context implementation - This will allow you to
> >> intercept data changes, à la pointcut at
> >> oacs.Context#set(String,Object), and get notifications that way
> >
> >
> > This could possibly be of intrest, but I´m still not 100% sure on how the
> > context works. Where would these notifications "arrive"
> >
> <snip/>
> This is another approach, some background:
> I'll sketch an outline here -- say we have MyContext extending
> SimpleContext where MyContext#set(String,Object) looks like:
>   public void set(String name, Object value) {
>      // inherit behavior
>      super.set(name, value);
>      // notifications you need
>      notify(name, value);
>   }
> and a MyEvaluator extending the Evaluator you are currently using
> whose newContext() method does this:
>   public Context newContext(Context parent) {
>      return new MyContext(parent);
>   }
> then using this evaluator with the SCXMLExecutor instances like so:
>   SCXMLExecutor exec = new SCXMLExecutor();
>   ...
>   exec.setEvaluator(new MyEvaluator());
> ties in the above "pointcut" behavior causing notifications for any
> data changes within the state machine. Adjust outline per
> requirements.
> -Rahul
> > best regards
> > //Linda
> >
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

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