Re: [SCXML] Polling in datamodel

2009-05-11 Thread Linda Erlenhov
Hello!

The thing here is that the value is never a DOM node. Hence my question. I
previousley asked why the "assign location" didn´t call for the "set"
function in the Context and got the answere that the "assign location"
doesn´t work as "assign name", "assign name" calls the set function and sets
a variable, "assign location" manipulates the XML tree as it is. The advice
was to make an "custom action" instead or do the ugly hack I did: do an
"assign name" with the name after the "assign location" has executed.
What I wanted to know is if there is any way of fetching the "tree" or
whatever it is to get the data associatet to a name, according to the model
below.
If you look at my example below, I will always "know" the name of the
datamodel in this case: "DynamicData", and I will recieve the "name" of the
specific tag in this data, in this case "Data_1", "Data_2" or "Data_3". In
my model below I have done an ugly way of finding out what the value is but
i realized that that was not enough, i need to know the "type" aswell. And
that I don´t know how to find.

Does anybody have a solution to this, or some kind of idea on how to solve
this?

best regards
//Linda

On Tue, May 5, 2009 at 3:50 PM, Ingmar Kliche
wrote:

> Linda,
> you should be able to use the DOM API to read the values. In
> context.set(name, value) you should check whether the value is a DOM node:
>
> import import org.w3c.dom.Node;
>
> ...
> ... set(String name, Object value) {
>
>if (value instanceof Node) {
>Node nodeValue = (Node) value;
>}
>
> scope.put(name, scope, value);
>
>
> 2009/5/5 Linda Erlenhov 
>
> > Hello.
> > I´m back with another thousand questions!
> >
> > Still with my datamodel like this:
> > 
> > http://commons.apache.org/scxml"; xmlns="http://www.w3.org/2005/07/scxml
> ">
> >
> > 
> > 
> > 0
> > 0
> > none
> > 
> > 
> > 
> > 
> > 
> > 
> > ...snip...
> > Later on i set the data:
> > ...snip.
> > 
> > 
> > 
> > 
> >  > expr="Data(DynamicData,'Data_1')+1"/>
> > 
> > 
> > 
> >
> > 
> > ..snip
> >
> > So now here´s the problem.
> >
> > As you see I haven´t used the custom action, but an rather ugly hack
> where
> > I
> > do an assign name after I do the assign location to trigger a call to the
> > "set" function in the context.
> >
> > In this version I also do another assign where I assign another name with
> > the value. All my data are named Data_XX so i screen the calls to set byt
> > looking for the ones that are named Data_XX. When I recieve a call for
> > Data_XX I would like to know what the value is, which I in this case have
> > solved by assigning another variable with it earlier, when i get a "set"
> > call named Data_xx i know that the variable DDValue contains the value of
> > this data. Not pretty, but OK and working so far.
> > Now I would like to be able to see what "type" the data is aswell. How do
> I
> > do that? And: Is there a less spaghetti way to poll the value of the data
> > from where I am (In the context) when I have the "name" of it. (The name
> in
> > this case is Data_1, Data_2 or Data_3, I also know that the data=name is
> > DynamicData) .
> >
> > Due to lack of time I would prefer if i wouldn´t have to "redo" to much
> of
> > the scxml, but is this possible to do it my way otherwise? Or do I have
> to
> > do it over.
> >
> > Best Regards
> > //Linda
> >
>


[SCXML] Polling in datamodel

2009-05-05 Thread Linda Erlenhov
Hello.
I´m back with another thousand questions!

Still with my datamodel like this:

http://commons.apache.org/scxml"; xmlns="http://www.w3.org/2005/07/scxml";>



0
0
none






...snip...
Later on i set the data:
...snip.










..snip

So now here´s the problem.

As you see I haven´t used the custom action, but an rather ugly hack where I
do an assign name after I do the assign location to trigger a call to the
"set" function in the context.

In this version I also do another assign where I assign another name with
the value. All my data are named Data_XX so i screen the calls to set byt
looking for the ones that are named Data_XX. When I recieve a call for
Data_XX I would like to know what the value is, which I in this case have
solved by assigning another variable with it earlier, when i get a "set"
call named Data_xx i know that the variable DDValue contains the value of
this data. Not pretty, but OK and working so far.
Now I would like to be able to see what "type" the data is aswell. How do I
do that? And: Is there a less spaghetti way to poll the value of the data
from where I am (In the context) when I have the "name" of it. (The name in
this case is Data_1, Data_2 or Data_3, I also know that the data=name is
DynamicData) .

Due to lack of time I would prefer if i wouldn´t have to "redo" to much of
the scxml, but is this possible to do it my way otherwise? Or do I have to
do it over.

Best Regards
//Linda


Re: [SCXML] getting set datats in the datamodel

2009-04-23 Thread Linda Erlenhov
Hello again!
This seems to work, since we now can see that data has changed.
Unfortunately, we seem to have missed out an important part of the
question. In addition to being notified when a data value is set, we
also would like to be able to "get/recieve" the new data value aswell as the
name (in this case numdat) so that we can display it to the screen in our
interface.
And, in this example we only have one data value, NumDat. However, it
is possible to define several data values insade the DynamicData-tag.
Can we still just write  after the first assign tag, or do we also have to
define what data value has been changed?
Sincerely,

Linda


> 
>
> Yup, I see what you are running into. Unfortunately for the specific
> usage pattern here, the two  variations have different
> semantics as follows:
>
> 1)  
> is a set operation, which produces a Context#set(...) call
>
> 2) 
> is really a mutation operation, it retrieves the XML  tree
> (stored as a DOM node in memory) and manipulates it -- there is no
> call to Context#set(...)
>
>
> >> How do I notify when my DynamicData has changed?
> >>
> 
>
> ISTR that you prefer to not use custom actions. With those
> constraints, one option (since you are generating all the SCXML) is to
> accomodate for the above variation via the SCXML markup itself -- so
> you could generate a redundant identity assignment to trigger the
> Context#set(...) call like so:
>
> 
>  expr="Data(DynamicData,'NumDat')+1"/>
> 
> 
>
> -Rahul
>


Re: [SCXML] getting set datats in the datamodel

2009-04-22 Thread Linda Erlenhov
Hello
Is there anybody that can help me with my problem described below?

best regards
//Linda

On Mon, Apr 20, 2009 at 2:05 PM, Linda Erlenhov wrote:

> Hello
> I think I´ve done some mixing between two things that doesn´t work together
> as I hoped it would.
>
> I have this Datamodel, the scxml document starts like this:
> 
> http://commons.apache.org/scxml"; xmlns="http://www.w3.org/2005/07/scxml";>
>
> 
> 
> 0
> 
> 
> 
>
> -
>
> I assign the "Indication1" later on:
>
> ---
> 
> 
> 
> 
> 
>
> ---
>
> And the "DynamicData" also later:
> ---
> 
> 
> 
> 
>  expr="Data(DynamicData,'NumDat')+1"/>
> 
> 
>
> ---
>
> I implemented a custom context with a notification functionality in the
> "set" function (observer observed pattern) but the problem now is that the
> only time the "set" function in the context is used is when indications are
> set. Not when the DynamicData is set. I know that the SCXML works and that
> the expressions evaluate properly because of the log:labels, my guess is
> that it´s something with the Data() function that makes these expressions do
> something different. What? Where is the "set" for the DynamicData located?
> How do I notify when my DynamicData has changed?
>
>
> Best regards
> Linda
>
>
>


Re: [SCXML] getting set datats in the datamodel

2009-04-20 Thread Linda Erlenhov
Hello
I think I´ve done some mixing between two things that doesn´t work together
as I hoped it would.

I have this Datamodel, the scxml document starts like this:

http://commons.apache.org/scxml"; xmlns="http://www.w3.org/2005/07/scxml";>



0




-

I assign the "Indication1" later on:

---






---

And the "DynamicData" also later:
---








---

I implemented a custom context with a notification functionality in the
"set" function (observer observed pattern) but the problem now is that the
only time the "set" function in the context is used is when indications are
set. Not when the DynamicData is set. I know that the SCXML works and that
the expressions evaluate properly because of the log:labels, my guess is
that it´s something with the Data() function that makes these expressions do
something different. What? Where is the "set" for the DynamicData located?
How do I notify when my DynamicData has changed?


Best regards
Linda


Re: [SCXML] getting set datats in the datamodel

2009-04-15 Thread Linda Erlenhov
Hello
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
//Linda


> >>
> >>  * 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"
> >
> 
>
> This is another approach, some background:
>
>  http://commons.apache.org/scxml/guide/contexts-evaluators.html
>
> 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: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [SCXML] Timers in SCXML

2009-04-15 Thread Linda Erlenhov
Hello
Sorry to mass-spam email you, but I solved the problem myself after a food
break and some more thinking.  The problem was the way I was trying to solve
the data requests i asked about in another mail. So this is not a problem
anymore, thank you!

//Linda

On Wed, Apr 15, 2009 at 2:16 PM, Linda Erlenhov wrote:

> Hello again.
> I run the standalone test and it looks like the timers work fine there (An
> infinit loop between the two states, the logs, except for those that was
> nested as you pointed out, are printed one or two seconds apart as specified
> in the scxml ), so now I´m a bit clueless with how to proceed, any idéas? Is
> there anything I might have forgotten in my java files since it doesn´t work
> there?
>
> best regards
> //Linda
>
> On Tue, Apr 14, 2009 at 9:11 PM, Rahul Akolkar wrote:
>
>> On Tue, Apr 14, 2009 at 8:19 AM, Linda Erlenhov
>>  wrote:
>> > Hello!
>> >
>> > This may be a stupid question but:
>> > I have read through the code for the simple scheduler and I´m  not sure
>> i
>> > understand what happens.
>> > We have written a simple scxml for a small statechart containing two
>> states
>> > with timers and used the simple scheduler as described in your previous
>> > e-mail. As I understand the timers would make the machine just jump
>> between
>> > the two states. This doesn´t happen. Why?
>> 
>>
>> The Commons SCXML version and the relevant driver (Java) code will
>> help towards answering -- we know this works, so we'll need to know
>> whats being done differently. Bear in mind that the timers execute as
>> daemons.
>>
>> I suggest trying your example standalone [1] first, and we'll go from
>> there.
>>
>> As an aside, in the markup below,  is nested in  which
>> isn't legal, so the nested  will be ignored.
>>
>> -Rahul
>>
>> [1] http://commons.apache.org/scxml/guide/testing-standalone.html
>>
>>
>>
>> > ---
>> > http://commons.apache.org/scxml"; xmlns="http://www.w3.org/2005/07/scxml
>> ">
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > 
>> > -
>> >
>> > The output when this is run is simply:
>> > 2009-apr-14 13:08:57 org.apache.commons.scxml.model.Log execute
>> > INFO: Renegade: Entering state: A
>> > 2009-apr-14 13:08:57 org.apache.commons.scxml.env.SimpleScheduler send
>> > INFO: send ( sendId: 1, target: null, targetType: scxml, event: ToB,
>> params:
>> > null, hints: null, delay: 1000)
>> >
>> > best regards
>> > //Linda
>> >
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>>
>


Re: [SCXML] Timers in SCXML

2009-04-15 Thread Linda Erlenhov
Hello again.
I run the standalone test and it looks like the timers work fine there (An
infinit loop between the two states, the logs, except for those that was
nested as you pointed out, are printed one or two seconds apart as specified
in the scxml ), so now I´m a bit clueless with how to proceed, any idéas? Is
there anything I might have forgotten in my java files since it doesn´t work
there?

best regards
//Linda

On Tue, Apr 14, 2009 at 9:11 PM, Rahul Akolkar wrote:

> On Tue, Apr 14, 2009 at 8:19 AM, Linda Erlenhov
>  wrote:
> > Hello!
> >
> > This may be a stupid question but:
> > I have read through the code for the simple scheduler and I´m  not sure i
> > understand what happens.
> > We have written a simple scxml for a small statechart containing two
> states
> > with timers and used the simple scheduler as described in your previous
> > e-mail. As I understand the timers would make the machine just jump
> between
> > the two states. This doesn´t happen. Why?
> 
>
> The Commons SCXML version and the relevant driver (Java) code will
> help towards answering -- we know this works, so we'll need to know
> whats being done differently. Bear in mind that the timers execute as
> daemons.
>
> I suggest trying your example standalone [1] first, and we'll go from
> there.
>
> As an aside, in the markup below,  is nested in  which
> isn't legal, so the nested  will be ignored.
>
> -Rahul
>
> [1] http://commons.apache.org/scxml/guide/testing-standalone.html
>
>
>
> > ---
> > http://commons.apache.org/scxml"; xmlns="http://www.w3.org/2005/07/scxml
> ">
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > -
> >
> > The output when this is run is simply:
> > 2009-apr-14 13:08:57 org.apache.commons.scxml.model.Log execute
> > INFO: Renegade: Entering state: A
> > 2009-apr-14 13:08:57 org.apache.commons.scxml.env.SimpleScheduler send
> > INFO: send ( sendId: 1, target: null, targetType: scxml, event: ToB,
> params:
> > null, hints: null, delay: 1000)
> >
> > best regards
> > //Linda
> >
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [SCXML] Timers in SCXML

2009-04-14 Thread Linda Erlenhov
Hello!

This may be a stupid question but:
I have read through the code for the simple scheduler and I´m  not sure i
understand what happens.
We have written a simple scxml for a small statechart containing two states
with timers and used the simple scheduler as described in your previous
e-mail. As I understand the timers would make the machine just jump between
the two states. This doesn´t happen. Why?
---
http://commons.apache.org/scxml"; xmlns="http://www.w3.org/2005/07/scxml";>






















-

The output when this is run is simply:
2009-apr-14 13:08:57 org.apache.commons.scxml.model.Log execute
INFO: Renegade: Entering state: A
2009-apr-14 13:08:57 org.apache.commons.scxml.env.SimpleScheduler send
INFO: send ( sendId: 1, target: null, targetType: scxml, event: ToB, params:
null, hints: null, delay: 1000)

best regards
//Linda


Re: [SCXML] getting set datats in the datamodel

2009-04-06 Thread Linda Erlenhov
Hello again!

I´m not sure how to explain what I want to do. The task I have is to build
an editor that you then can use to build simulations of applications. An
application can be a cd-player for instance. What already exists is an
editor for building GUI:s without coding (not build by me) and an engine
that runs this and via a protocol "talks" to an application. What I´m trying
to do is "attatch" my editor to the protocol instead of a "real life"
application. The problem is that I´m developing this very generic. I can not
know what kind of application the user want to simulate, the only thing I
have to run this from is the protocol specification and in that
specification it, for one thing,  says that I should be able to handle
dynamic data subscriptions.

In the cd-player case this could be that a track on the cd has ended and a
new has begun, if I have an subscription for the title of the song playing I
would then like to send it to the engine i was talking about.

So if I write a datamodel like (well, I don´t, it would be generated like
this):

text
0


and then somewhere in the scema the person who build the simulation wants
"title" to change, this is then translated to:


as an example.

If i want to "read" what data.title:s expression is, how do I do that?

I used the:
http://www.ling.gu.se/~lager/Labs/SCXML-Lab/
for more examples, I´m not sure if you´re using the same standard, but it´s
an easy way to understand how the SCXML works.



> This still is all quite vague to me -- for example, not clear where
> you put the data in the first place.
>
> If you want to listen to data changes, listening to state changes may
> not be the way to proceed (so I wouldn't use SCXMLListener for this
> purpose). I can think of multiple potential options:
>
>  * Avoid the need for any data synchronization / subscriptions
> altogether - Back the state machine's root context with the actual
> data store


Unfortunently this is not an option because the parts that use the
subscriptions are not written by me and already exists, I just want to
"communicate" with these parts.

>
>
>  * Declaratively add s guarded on specific *.change events
> - Has the benefit of capturing the associated actions in the SCXML
> document itself (use the appropriate executable content on transition)


Not sure how this would work for the user of my editor.

>
>
>  * 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"

best regards
//Linda


Re: [SCXML] getting set datats in the datamodel

2009-04-06 Thread Linda Erlenhov
Hello Armel
Me and another girl named Anna has build the editor using GMF, Graphical
modeling framework for Eclipse (http://www.eclipse.org/modeling/gmf/) as a
part of our Master Thesis project.

best regards
//Linda


On Fri, Apr 3, 2009 at 11:59 AM, Armel SORO wrote:

> Hi Linda,
>
> This is not really an answer to the problem but a simple question: which
> kind of graphical editor do you use to build state machines?
> Was it built from scratch or did you use any specific software to do this?
>
> I am indeed interesting in using one like that to model my system and
> generate the corresponding SCXML document.
>
> B.R.
>
> --
> Armel
>
>
> 2009/3/31 Linda Erlenhov 
>
> > Hello again!
> >
> > I have a problem with my datamodel. Or rather the fetching of datas that
> > are
> > used in the datamodel.
> > I have my editor for building statemachines graphical, this is then
> > "translated" into a corresponding SCXML document that then is run
> > "normally"
> > with Apache commons. The person that uses the editor shoul amongst other
> > things be able select if she/he has want´s some data to be set (integers
> or
> > strings) when entering states.
> > The GUI that communicates with the machine does this via an interface
> wich
> > is the thing I´m writing now. The GUI can send subscriptions requests for
> > data wich basically means that it wants to subscribe certain data and
> wants
> > the interface to send it when the data is changed.
> > How I solved the part of saving checking the data is somewhat irrelevant,
> > the problem is when I want to fetch the data that is saved. Since the
> model
> > doesn´t "tell" when data has changed I check whenever entering a state
> > (onEntry Listner) but where do I check this.
> > Where is this, the data, saved?
> >
> > best regards
> > //Linda
> >
>


[SCXML] getting set datats in the datamodel

2009-03-31 Thread Linda Erlenhov
Hello again!

I have a problem with my datamodel. Or rather the fetching of datas that are
used in the datamodel.
I have my editor for building statemachines graphical, this is then
"translated" into a corresponding SCXML document that then is run "normally"
with Apache commons. The person that uses the editor shoul amongst other
things be able select if she/he has want´s some data to be set (integers or
strings) when entering states.
The GUI that communicates with the machine does this via an interface wich
is the thing I´m writing now. The GUI can send subscriptions requests for
data wich basically means that it wants to subscribe certain data and wants
the interface to send it when the data is changed.
How I solved the part of saving checking the data is somewhat irrelevant,
the problem is when I want to fetch the data that is saved. Since the model
doesn´t "tell" when data has changed I check whenever entering a state
(onEntry Listner) but where do I check this.
Where is this, the data, saved?

best regards
//Linda


[SCXML] Transition/Var question

2009-03-12 Thread Linda Erlenhov
Hello again.

I have made som improvements in my code, but now new intresting and funny
things have happened instead.

I have this very simple file:
--
http://www.w3.org/2005/07/scxml"; version="1.0"
initialstate="7">












---
And have written a testprogram, but when i start i get this error:

2009-mar-12 15:46:32
org.apache.commons.scxml.io.SCXMLParser$IgnoredElementRule begin
VARNING: Ignoring element  in namespace "
http://www.w3.org/2005/07/scxml"; at file:/C:x/testvideo.scxml:4:28 and
digester match "scxml/state/transition/var"

I looked at how var:s are written in examples and such, but I don´t
understand what I have done wrong.
The reason to why I am not using assign or any other action is because the
var:s I want are supposed to be objects that I look for in an
ontransitionlistner and they should be forwarded to another application.
They are final and should not be changed, just passed on.

best regards
//Linda


[SCXML] "getting" a state id.

2009-03-11 Thread Linda Erlenhov
Hello
I´m back with sort of the same (but then again not) problem as I´ve asked
previousley. It´s about fetching ID:s again. I have an SCXML file that looks
on the form like this:



















I would like to "fetch" the first states id, the one that wrapps everything
(in this version the id is 176).
How do I do that?

Best Regards
Linda


[SCXML] more Evaluator/Context questions

2009-03-05 Thread Linda Erlenhov
Hello!

This is my plan:
My guards are boolean expressions and the boolean variables that the
expression consists of are updated in "onEntry"/"onExit". I use a listner
for _when_ the update should be done.

The trouble is that I´m not shure _where/how_ the updating is done. Since
this should be done during runtime a guess is that it is some kind of update
in the context, but I have clearly not understood properly how this
(context)  works.

So if I create a simple example then maybe someone could use it to explain
this to me:

The statemachine has three states. A, B and C. There are transitions between
A & B both ways, and also transitions between B & C both ways. You can
trigger events that are "go to A", "go to B" "go to C". You start in A. On
the transition from B to A there is a guard for "been in C" that is set when
you visit C. So you have to visit C atleast once before you enter state A
the second time.

A<=>B<=>C

How/where do I set the "been in C" state to true when i enter the state?


Best Regards

//Linda


Re: [SCXML] Transition/Var question

2009-03-02 Thread Linda Erlenhov
Hello

Yes this is what I want to do, but I don´t understand how (1) is done. With
the getEngine you get the rootContext, The rootContext describes ALL var:s
in the StateMachine as I understand, so then it should be the context
associated with the transition I want. How do I do that? The transition type
doesn´t have a name and I can´t find a method that takes an "executable
object"ish and returns something that I want.

best regards
//Linda

On Sat, Feb 28, 2009 at 6:20 AM, Rahul Akolkar wrote:

> On Fri, Feb 27, 2009 at 7:06 AM, Linda Erlenhov
>  wrote:
> > Hello again!
> >
> >
> >> 
> >>
> >> followed by introspection like so:
> >>
> >>getEngine().getRootContext().get("outcome");
> >>
> >> 
> >
> > The problem with that approach is that i won´t know the names of my
> "var":s.
> >
> > The idéa is:
> > I´m building an graphical editor for Statecharts, where you can model a
> > statemachine with some simple drag and drop actions. When your satisfied
> > with your machine the editor generates an SCXML-file which then is meant
> to
> > be run. Everything I do has to be "generic" so what I wanted was a way
> to,
> > when the listner registers an "onTransition" ( the class Implements the
> > SCXMLListener interface) move:
> > 1. Check if there is an "var" associated with that transition
> > 2. If so, fetch the exp.
> >
> 
>
> IIUC, for (1), introspect the Transition object (the list of actions
> therein). (2) is above (replace the String constant "outcome" with the
> value obtained in 1).
>
> -Rahul
>
>
> > best regards
> > //Linda
> >
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: [SCXML] Transition/Var question

2009-02-27 Thread Linda Erlenhov
Hello again!


> 
>
> followed by introspection like so:
>
>getEngine().getRootContext().get("outcome");
>
> 

The problem with that approach is that i won´t know the names of my "var":s.

The idéa is:
I´m building an graphical editor for Statecharts, where you can model a
statemachine with some simple drag and drop actions. When your satisfied
with your machine the editor generates an SCXML-file which then is meant to
be run. Everything I do has to be "generic" so what I wanted was a way to,
when the listner registers an "onTransition" ( the class Implements the
SCXMLListener interface) move:
1. Check if there is an "var" associated with that transition
2. If so, fetch the exp.

best regards
//Linda


[SCXML] Transition/Var question

2009-02-27 Thread Linda Erlenhov
Hello
I have in my Transitions added "var" on the form:


  


(This example is taken directly from the SCXML specification)

In my statemachine (a version similar, but not derived from the
AbstractStateMachine that is included) I have added an "onTransition"
function in my listner that when I am on a transition should check if there
is an "var" and in that case send it to .

I´m having trouble fetching the "var". My thought is that that I should
derive a new class from the transition class that includes the method
"getVar" but I´ve looked through the API and I don´t understand how this
method should be written. Can anybody help me?

Best Regards
/Linda


Re: [SCXML] Executor Questions

2009-02-19 Thread Linda Erlenhov
Hello again.
Doesn´t anybody have a solution to my problem?
I don´t know if maybe theres something I need to clarify.

The engine sends "messages" that are java objects that I in the (?) part
translates to somethin on the form that the ApacheEngine wants.
What I don´t understand is what I should do with the "context" and
"evauator" in my model, can I work around it somehow?

best regards
//Linda



On Tue, Feb 17, 2009 at 1:52 PM, Linda Erlenhov wrote:

> Hello
> I have just begun using the Apache SCXML  and I have encountered a problem.
>
> This is what already is:
> I have an editor for HMI. You build the interfaces using modules and then
> connects to actions and events in a databas and this is then run by another
> engine that sends events/actions (for some strange reasond they are named
> the "wrong" way in this program, i didn´t build it so...) to a CD player or
> whatever through a protocol via an interface.
>
> My job:
>  is to build a simulator for the "cd-player" part. The" tricky" is that it
> should be generic, so that the client can build whatever kind of machine he
> or she wants to.
>
> I have created a graphical interface with GMF in eclipse where you can
> build statemachines with the help of "modules" representing states,
> transitions etc. This generates a XML representation of  the statemachine
> once it´s finished and then that is translated into SCXML. So far so good.
>
> so what we have here now is HMIeditor <-> DB <-> Engine <-> protocol <->
> (??) <-> Apache engine<->SCXML<->XML <-> my editor for statecharts.
>
> All the functions (actions, events etc.) of the "cd-player" is described in
> a XML file wich both the HMI editor and my editor uses so I can put them on
> any form I want to and I have knowledge in what the HMIeditorengine "does"
> to the data.
>
> This is what I think is the problem (above shown as (??)):
> Between the apache engine and the protocol ther should be an interface
> (duh). My interface there should start up both engines and then (i think)
> listen to two buffers (i´m thinking two threads), my interface takes care of
> the translation from the protocol data look to the ApacheEngines data look.
>
> I just don´t undstand now how I should start up the Apache engine. I don't
> understand what i need the context and evaluator and so on for, the things
> that the apache engine recieves should be on the form it wants?
>
> Or have I just misunderstood?
>
> I hope someone understands something of what my problem is.
>
> best regards
> //Linda
>


[SCXML] Executor Questions

2009-02-17 Thread Linda Erlenhov
Hello
I have just begun using the Apache SCXML  and I have encountered a problem.

This is what already is:
I have an editor for HMI. You build the interfaces using modules and then
connects to actions and events in a databas and this is then run by another
engine that sends events/actions (for some strange reasond they are named
the "wrong" way in this program, i didn´t build it so...) to a CD player or
whatever through a protocol via an interface.

My job:
 is to build a simulator for the "cd-player" part. The" tricky" is that it
should be generic, so that the client can build whatever kind of machine he
or she wants to.

I have created a graphical interface with GMF in eclipse where you can build
statemachines with the help of "modules" representing states, transitions
etc. This generates a XML representation of  the statemachine once it´s
finished and then that is translated into SCXML. So far so good.

so what we have here now is HMIeditor <-> DB <-> Engine <-> protocol <->
(??) <-> Apache engine<->SCXML<->XML <-> my editor for statecharts.

All the functions (actions, events etc.) of the "cd-player" is described in
a XML file wich both the HMI editor and my editor uses so I can put them on
any form I want to and I have knowledge in what the HMIeditorengine "does"
to the data.

This is what I think is the problem (above shown as (??)):
Between the apache engine and the protocol ther should be an interface
(duh). My interface there should start up both engines and then (i think)
listen to two buffers (i´m thinking two threads), my interface takes care of
the translation from the protocol data look to the ApacheEngines data look.

I just don´t undstand now how I should start up the Apache engine. I don't
understand what i need the context and evaluator and so on for, the things
that the apache engine recieves should be on the form it wants?

Or have I just misunderstood?

I hope someone understands something of what my problem is.

best regards
//Linda