[JEXL] How to set an empty string array property value?

2013-10-31 Thread Woonsan Ko
Hi,

I'm testing with JEXL 2.1.2-SNAPSHOT (The 2.0 branch snapshot).
My bean has a property setter with string array.


    public void setValues(String[] values) {
    // ...
    }

And, a JEXL script setting an empty array like the following seems to fail and 
maybe it even fails to find the property setter method:

  mybean.values = [];
Is it because it always tries to match a method with 'Object []' argument?
If so, isn't it something to improve?

Regards,

Woonsan


Re: [JEXL] How to set an empty string array property value?

2013-11-01 Thread Woonsan Ko
I created a JIRA issue for this and attached patches:
- https://issues.apache.org/jira/browse/JEXL-144

I think it's a good improvement because it is very natural to try to set an 
empty array property like the following:


    // setting an empty array

    bean.strarr =  [ ];


I hope the patches fix this issue. Please review them.

Cheers,

Woonsan



On Thursday, October 31, 2013 5:17 PM, Woonsan Ko woon_...@yahoo.com wrote:
 
Hi,

I'm testing with JEXL 2.1.2-SNAPSHOT (The 2.0 branch snapshot).
My bean has a property setter with string array.


    public void setValues(String[] values) {
    // ...
    }

And, a JEXL script setting an empty array like the following seems to fail and 
maybe it even fails to find the property setter method:

  mybean.values = [];
Is it because it always tries to match a method with 'Object []' argument?
If so, isn't it something to improve?

Regards,

Woonsan




Re: scxml: planning and versions

2014-04-15 Thread Woonsan Ko
Hi Rinke,

Welcome! And that's great to hear about your project!
The roadmap is described here: 
http://commons.apache.org/proper/commons-scxml/roadmap.htmlI would recommend 
you to use 2.0-M1 instead because the milestones (M0 and M1) were actually done 
based on the J6 branch and included proper cleanups and basic alignments to the 
latest specification.

Kind regards,

Woonsan

[1] 
http://mail-archives.apache.org/mod_mbox/commons-dev/201404.mbox/%3c533d4314.40...@douma.nu%3E
 


On Tuesday, April 15, 2014 5:30 AM, R.C. Hoekstra r.c.hoeks...@erasmusmc.nl 
wrote:
 
Hi all @ commons scxml,

We're a university team of scientists working on multi agent simulations of 
tropical diseases for a world health organization project. A disease can be 
considered as a state machine, with the patient going through various states 
and transitions, each triggering new events.

For our project we're diving into commons scxml. However I'm a bit confused 
about what version would be best to use. I'm a bit afraid that the 0.9 
official release is so much outdated that it will not be compatible with the 
coming release, so we would end up with lots of changes to be made when 
updating. On the other hand working on a release which is still under 
development or unstable doesn't seem a good idea.

Is the J6 branch on the svn.apache.org repository a good idea (1.0)?

Can you give some clues in when the first 2.0 release can be expected?

Thanks, Rinke

by the way: thanks for all the good work done. I think it is a great project. 


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




Re: SCXML2 Serialization

2014-04-16 Thread Woonsan Ko
Hi Francis,

I think the best practices are to serialize either o.a.c.s.SCXMLExecutor [1] or 
o.a.c.s.model.SCXML instances. Both cases are well-maintained in test code. [2]
In your case, you can probably (de)serialize SCXMLExecutor instance directly to 
store/load the execution context.
Also, as far as I can see, SCXMLExecutor doesn't provide #(at|de)tachInstance() 
methods and I don't think it would do even later because SCInstance doesn't 
necessarily have full information about the current execution context.
So, please (de)serialize the SCXMLExecutor instance instead.

Cheers,

Woonsan

[1] http://commons.apache.org/proper/commons-scxml/faq.html#serializability
[2] 
http://svn.apache.org/repos/asf/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCXMLTestHelper.java



On Wednesday, April 16, 2014 9:07 AM, ten...@free.fr ten...@free.fr wrote:
 
Hi all,

I would like to know the best practice to serialize/deserialize SCXML fsm.

I do this during the creation of the SCXML executor, scInstace is the 
serialized context:

            ListCustomAction customActions = new ArrayListCustomAction();
            CustomAction ca =
                    new CustomAction(http://my.custom-actions.domain/CUSTOM1;,
                            hello, Hello.class);
            customActions.add(ca);

            JexlEvaluator evaluator = new JexlEvaluator();

            try {
                scxml = SCXMLReader.read(StopWatch.class.getClassLoader().

            } catch (Exception e) {
                e.printStackTrace();
                throw e;
            }


            executor = null;
            try {
                executor = new SCXMLExecutor(evaluator, null, new 
SimpleErrorReporter());

                if (scInstance != null) {
                    // serialized context use it
                    executor.attachInstance(scInstance);
                    executor.registerInvokerClass(x-test, 
DummyInvoker.class);
                    executor.setStateMachine(scxml);
                    executor.go();
                    setInitialState(executor, paused);
                } else {
                    // new context
                    Context rootContext = new JexlContext();
                    rootContext.set(var1, value1);
                    executor.registerInvokerClass(x-test, 
DummyInvoker.class);
                    executor.setStateMachine(scxml);
                    executor.setRootContext(rootContext);
                    executor.go();
                }

            } catch (ModelException me) {
                // Executor initialization failed, because the
                // state machine specified has inconsistencies
                me.printStackTrace();
            }

I serialize executor.detachInstance(). It's seem to work, but is it the right 
way to restart a SCXML 'session' ?

Thanks
Francis.



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





Re: SCXML2 Serialization

2014-04-16 Thread Woonsan Ko


On Wednesday, April 16, 2014 9:57 AM, Ate Douma a...@douma.nu wrote:

Hi Woonsan,

On 16-04-14 15:49, Woonsan Ko wrote:
 Hi Francis,

 I think the best practices are to serialize either o.a.c.s.SCXMLExecutor [1] 
 or o.a.c.s.model.SCXML instances. Both cases are well-maintained in test 
 code. [2]
Actually, since the last milestone SCXMLExecutor no longer is serializable :)
See also https://issues.apache.org/jira/browse/SCXML-197

I still need to provide updated documentation for this, but the 
SCXMLTestHelper 
[2] class has been (and had to be) updated for this changed usage.

 In your case, you can probably (de)serialize SCXMLExecutor instance directly 
 to store/load the execution context.
 Also, as far as I can see, SCXMLExecutor doesn't provide 
 #(at|de)tachInstance() methods and I don't think it would do even later 
 because SCInstance doesn't necessarily have full information about the 
 current execution context.
 So, please (de)serialize the SCXMLExecutor instance instead.

You need to update to the latest milestone 1 or trunk, then you'll see the new 
attach/detach instance features ;)

Ah, sorry. I haven't updated the code for a while. My comment was based on 
outdated information then..


Thanks,

Woonsan




 Cheers,

 Woonsan

 [1] http://commons.apache.org/proper/commons-scxml/faq.html#serializability
 [2] 
 http://svn.apache.org/repos/asf/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml2/SCXMLTestHelper.java



 On Wednesday, April 16, 2014 9:07 AM, ten...@free.fr ten...@free.fr 
 wrote:

 Hi all,

 I would like to know the best practice to serialize/deserialize SCXML fsm.

 I do this during the creation of the SCXML executor, scInstace is the 
 serialized context:

              ListCustomAction customActions = new 
ArrayListCustomAction();
              CustomAction ca =
                      new 
CustomAction(http://my.custom-actions.domain/CUSTOM1;,
                              hello, Hello.class);
              customActions.add(ca);

              JexlEvaluator evaluator = new JexlEvaluator();

              try {
                  scxml = SCXMLReader.read(StopWatch.class.getClassLoader().

              } catch (Exception e) {
                  e.printStackTrace();
                  throw e;
              }


              executor = null;
              try {
                  executor = new SCXMLExecutor(evaluator, null, new 
SimpleErrorReporter());

                  if (scInstance != null) {
                      // serialized context use it
                      executor.attachInstance(scInstance);
                      executor.registerInvokerClass(x-test, 
DummyInvoker.class);
                      executor.setStateMachine(scxml);
                      executor.go();
                      setInitialState(executor, paused);
                  } else {
                      // new context
                      Context rootContext = new JexlContext();
                      rootContext.set(var1, value1);
                      executor.registerInvokerClass(x-test, 
DummyInvoker.class);
                      executor.setStateMachine(scxml);
                      executor.setRootContext(rootContext);
                      executor.go();
                  }

              } catch (ModelException me) {
                  // Executor initialization failed, because the
                  // state machine specified has inconsistencies
                  me.printStackTrace();
              }

 I serialize executor.detachInstance(). It's seem to work, but is it the 
 right way to restart a SCXML 'session' ?

 Thanks
 Francis.



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







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





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



[vfs] Outdated filesystem capability info in site?

2014-05-01 Thread Woonsan Ko
Hi,

I'm working with ftp file system (VFS 2.0) and it seems working fine when 
listing children.
But the page [1] says it doesn't support 'Directory Content' capability yet.

Is the information (also on sftp and some others) outdated?

Regards,

Woonsan


[1] http://commons.apache.org/proper/commons-vfs/filesystems.html

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



Re: [vfs] Outdated filesystem capability info in site?

2014-05-02 Thread Woonsan Ko
Ah, thanks for the explanation.
It can help someone like me if the page contains a link to [1] for the 
capability definitions.

Cheers,

Woonsan

[1] 
http://commons.apache.org/proper/commons-vfs/apidocs/org/apache/commons/vfs2/Capability.html




 On Thursday, May 1, 2014 9:55 PM, Bernd Eckenfels e...@zusammenkunft.net 
 wrote:
  Hello,
 
 I think directory content refers to directories which can also be
 read as a stream. For example for WebDAV XML properties. FTP has no
 such thing.
 
 BTW: I am currently working in getting 2.1 out the door, so it might be
 a good time to have a look at the trunk and speak up on showstoppers.
 
 Gruss
 Bernd
 
 Am Thu, 1 May
 2014 17:54:28 -0700 (PDT) schrieb Woonsan Ko woon_...@yahoo.com:
 
 
  Hi,
 
  I'm working with ftp file system (VFS 2.0) and it seems working fine
  when listing children. But the page [1] says it doesn't support
  'Directory Content' capability yet.
 
  Is the information (also on sftp and some others) outdated?
 
  Regards,
 
  Woonsan
 
 
  [1] http://commons.apache.org/proper/commons-vfs/filesystems.html
 
  -
  To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
  For additional commands, e-mail: user-h...@commons.apache.org
 
 
 

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



Re: our project setup: any tips specifically on performance/speed?

2014-05-16 Thread Woonsan Ko
Hi Rinke,

I think you can measure a rough range of how many times to invoke SCXMLExecutor 
(#go(), #triggerEvent() for instance) in simulation on N instances. Then you'll 
probably able to get an estimate of the total execution time somehow.
If the estimate of the pure SCXML executions can possibly meet your 
requirements, then I think the next thing to consider might be how to reduce 
IOs if you have to (de)serialize those instances. In one of our projects, we 
initialize a root context and an executor every time before triggering events. 
So, the SCXML definition is responsible for initializing itself (to move the 
right current state) from the given root context (in script blocks). I think 
this pattern could help reduce the amount of (de)serialized data, and so reduce 
IO.

Regards,

Woonsan


On Monday, May 12, 2014 12:58 AM, R.C. Hoekstra r.c.hoeks...@erasmusmc.nl 
wrote:
 



Hi list, 

As written before, We're a university team of scientists working on multi 
agent simulations of tropical diseases for a world health organization 
project. A disease can be considered as a state machine, with the patient 
going through various states and transitions, each triggering new events.

We've managed to make a working example of a xml file where a patient is going 
through various stages of the disease, including treatments with medicine. Our 
most important concern at the moment is: how efficient is it? Our aim is a 
multi agent simulation with possibly a few 100,000 of instances of a State 
Machine engine (SCXMLExecutor). I'd like to share the code setup with you 
guys, and maybe you can give some clues on how efficient it will be in terms 
of performance/speed, and maybe some hints if an alternative approach would be 
better?

general setup
we have a Population object (a wrapped list) containing all agent objects. 
Each agent is assigned an SCXMLExecutor as the engine, so there are many 
instances of SCXMLExecutor. We use the default JexlEvaluator, and each 
SCXMLExecutor gets the agent it belongs to assigned to the rootContext, so the 
agent's properties can be accessed from the scxml file. 

Transitions
Our transitions are usually of a special type: a patient usually stays x days 
in a certain state, after which the transition takes place. The x days is 
determined on basis of drawing a random number from a statistical 
distribution. There is usually more than one possible transition; each with 
different probabilities. 
So the scxml file must contain the following information: 
* distribution name and parameters to determine the time until next transition.
* A number coupled to each possible transition indicating the likelyhood that 
it happens. 

We solved this in the following way:
* distribution name, mean and variance parameters, and chances are defined in 
the datamodel as single variables: data id=”distr”
in each state's onentry we set these variables with the values specific for 
that state, via the assign tag. The chances variable is defined as an array: 
assign name=chances expr=[0.05d, 0.10d, 0.20d] /
* The state's onentry also contains a send tag. Send passes the agent's id, 
the forementioned variables and the event concerned. 
The send message is captured by our own implementation of EventDispatcher. 
This does two things: 
** It draws the random time based on the passed distribution parameters. It 
schedules this in our own discreet event manager. When the desired time has 
passed, the discreet event manager passes the correct event back to the 
correct SCXMLExecutor instance. 
** It determines which transition will be chosen by drawing a random number on 
basis of the chances array. This results in an index number of the transition 
to be chosen. This index number is passed as payload to the event. The scxml 
file checks this index number in the cond attribute of the transitions.

Agent properties:
Each disease state also has its effect on the agent's properties, for example 
the infectivity of the agent, or its fitness. The agent was passed to the 
rootContext, so the onentry of each state contains code to set the agent's 
properties specific to that state: 
                script
                    agent.infectivity = 1
                /script

This is our overall approach. I'd be happy to receive any comments; 
specifically tips regarding the expected speed/performance. 

best regards,
Rinke

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




Re: [scxml] Re: our project setup: any tips specifically on performance/speed?

2014-06-07 Thread Woonsan Ko
Hi Rinke,


On Friday, May 30, 2014 4:46 PM, R.C. Hoekstra r.c.hoeks...@erasmusmc.nl 
wrote:




Hi Woonsan, Hi Ate, 

(sorry for the late response)

Woonsan wrote:

 If the estimate of the pure SCXML executions can possibly meet your 
 requirements, then I think
 the next thing to consider might be how to reduce IOs if you have to 
 (de)serialize those instances.
 In one of our projects, we initialize a root context and an executor every 
 time before triggering
 events. So, the SCXML definition is responsible for initializing itself (to 
 move the right
 current state) from the given root context (in script blocks). I think this 
 pattern could
 help reduce the amount of (de)serialized data, and so reduce IO.

We haven't given the (de)serialization lots of attention yet. Of course, 
potentially it can be quite heavy with a few 100.000 of instances, but I don't 
know yet what is exactly needed. 
Your pattern sounds interesting, but can you please point out some link to 
that project, so I can get the real picture clear? 

Ate gave a presentation last April in Denver with Hippo CMS Document Workflow 
use cases and SVN location info (p15):
- 
http://events.linuxfoundation.org/sites/events/files/slides/ApacheConUS2014%20-%20Apache%20Commons%20SCXML%202.0.pdf

You will be able to find 'documentworkflow.scxml' and 
'DocumentWorkflowImpl.java' which always invokes workflowExecutor.start() to 
reset the context and initialize the state without having to store the executor 
or instance.

Regards,

Woonsan



thanks for the response, 

Rinke

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




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



Re: [SCXML] mapping of data types used to store values of datamodel with the java datatypes

2014-07-19 Thread Woonsan Ko


 On Wednesday, July 16, 2014 10:02 AM, anshul gangwar 
 anshul.mit20...@gmail.com wrote:
  Hi,
 
 I have one query regarding datatypes used to store values of SCXM datamodel.
 
 Suppose there is a string A = 1234567891. This variable is sent in
 payload when event is fired and is assigned in the SCXML datamodel through
 assign tag.

Is it like assign ... expr='1234567891' / or assign ... expr=1234567891 
/?
The former is handed as a string, but the latter is handled as a number.

 Now when I am fetching this variable A in invoker class, its value is in
 exponential form. So, in order to get the actual value I have perform below
 steps:
 
                 double d =
 Double.parseDouble(String.valueOf(lastParams.get(A)));
                 String deviceId = BigDecimal.valueOf(d).toPlainString();

If it was passed as string, then you could use new 
BigDecimal(lastParams.get(A)).
But, I guess you got a numeric object from lastParams.get(A) instead.

 
 If the value of A does not reach to specific range then it simply convert
 it into float instead of converting it in exponential form.
 
 I would like to know how commons SCXML datatypes are mapped with the java
 datatypes? Is this the right way of doing converting Integer values from
 SCXML?
 Which document can I refer for such details?

Expressions are evaluated by an Evaluator. If you're using JexlEvaluator, then 
you can refer to this:
- http://commons.apache.org/proper/commons-jexl/reference/syntax.html

I think you can treat it as a string with single quotes or as a number with a 
suffix (e.g, 1234567891B or 1234567891.0H).

Regards,

Woonsan

 
 Thanks in advance.
 
 Regards,
 Anshul


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



Re: [scxml] passing datamodel elements into method call

2014-10-06 Thread Woonsan Ko
Hi Rinke,

I think you would get a node if you used DataNode function instead:

cs:var name=treatment1Name  
expr=DataNode(treatmentData,'treatments/treatment[1]/name') /

Could you try that?

Regards,

Woonsan



On Thursday, October 2, 2014 3:53 AM, R.C. Hoekstra r.c.hoeks...@erasmusmc.nl 
wrote:
 



Hi list, Hi people @ scxml commons,

Can I pass datamodel nodes to a rootContext var, in order to process it in 
java?

like this:
target event=bla cond=agent.check(datamodelNodeRef) .../,
where:
* agent is an object of a java class made available to the RootContext, having 
a check method returning Boolean. I want this check method to evaluate the 
datamodelNode, in order to return true or false depending on elements.
* datamodelNodeRef is a reference to some node in the datamodel.

I managed to pass final nodes as string here, like this:

cs:var name=treatment1Name  
expr=Data(treatmentData,'treatments/treatment[1]/name') /,
transition ... cond=agent.check(treament1Name)...

where the treatments/treatment[1]/name is a final node.


However, I would like to pass non final nodes of the datamodel, but everything 
seems to be evaluated as strings first, before it is passed into the method of 
the context var.

Hope you can give me a clue.

And, if these kind of constructions are possible, how would they do in terms 
of performance?

thanks, Rinke





Re: Re: [scxml] passing datamodel elements into method call

2014-10-08 Thread Woonsan Ko
Hi Rinke,

Sorry for my confusion. Indeed, DataNode function seems to exist only for 
assign element.

Regarding other possible options, I think you can set a holder object (named 
treatmentDataHolder for instance) in the root context before execution, and 
you can invoke the holder's method to set the data object. For example,
  script
treatmentDataHolder.setData(treatementData);
treatmentDataHolder.setLocation('treatments/treatment[1]/name');
  /script

After execution, you can invoke treatmentDataHolder#getData() and 
treatmentDataHolder#getLocation() to read what was set during execution.


Regards,

Woonsan



On Wednesday, October 8, 2014 5:31 AM, R.C. Hoekstra 
r.c.hoeks...@erasmusmc.nl wrote:
 



 Hi Rinke,
 I think you would get a node if you used DataNode function instead:
 cs:var name=treatment1Name 
 expr=DataNode(treatmentData,'treatments/treatment[1]/name') /
 Could you try that?

 Regards, Woonsan


Hi Woonsan,

thanks for your answer. But are you sure about that?
If I use it like that, I get an unknown, ambiguous or inaccessible method 
dataNode error.

I found the dataNode method in Builtin.java. Its javadoc says:

Manifests within location attribute of assign element, for Commons JEXL and 
Commons EL based documents.

So what I get from it, is that dataNode can only be used to assign something 
to a dataNode via assign.

That is not what I want. I want to pass a dataNode including subElements to 
some java object via the cond attribute, so I can write a java method which is 
able to check conditions with use of the passed dataNode.


So: is there a way in which I can pass a dataNode to a java object in the 
context which is used in a cond attribute? Data obviously doesn't work, as I 
can see in the Builtin code that it always is parsed to Double or String.

best regards, Rinke





 On Thursday, October 2, 2014 3:53 AM, R.C. Hoekstra 
 r.c.hoeks...@erasmusmc.nl wrote:

  Hi list, Hi people @ scxml commons,
 
  Can I pass datamodel nodes to a rootContext var, in order to process it in 
  java?
 
  like this:
  target event=bla cond=agent.check(datamodelNodeRef) .../,
  where:
  * agent is an object of a java class made available to the RootContext, 
  having a check method returning Boolean. I want this check method to 
  evaluate the
  datamodelNode, in order to return true or false depending on elements.
  * datamodelNodeRef is a reference to some node in the datamodel.
 
  I managed to pass final nodes as string here, like this:
 
  cs:var name=treatment1Name  
  expr=Data(treatmentData,'treatments/treatment[1]/name') /,
  transition ... cond=agent.check(treament1Name)...
 
  where the treatments/treatment[1]/name is a final node.
 
 
  However, I would like to pass non final nodes of the datamodel, but 
  everything seems to be evaluated as strings first, before it is passed 
  into the method of the context
  var.
 
  Hope you can give me a clue.
 
  And, if these kind of constructions are possible, how would they do in 
  terms of performance?
 
  thanks, Rinke




Re: [scxml] bug with script in combination of a chain of transitions

2015-05-05 Thread Woonsan Ko
Hi Rinke,

Did you run with commons-scxml2-2.0-SNAPSHOT?
I've tried to run the following similar to yours on latest revision, but the 
result seems different from what you're seeing:

?xml version=1.0 ?
scxml xmlns=http://www.w3.org/2005/07/scxml;
   version=1.0
   datamodel=jexl
   initial=test1

  state id=test1 initial=test1.1

state id=test1.1
  onentry
log expr='logging in test1.1' /
  /onentry
  transition event=test1.1.positive target=test1.2/
/state

state id=test1.2
  onentry
log expr='logging in test1.2' /
  /onentry
  transition event=test1.2.positive target=test1.3/
/state

state id=test1.3
  onentry
log expr='logging in test1.3' /
  /onentry
/state

  /state

/scxml

I removed the custom action tags and replaced the script tag with simple log 
tags.
And I see the following when I tested it with the stanadlone tool [1]:

$ ./scxml.sh test.scxml 
?xml version=1.0 encoding=UTF-8?scxml 
xmlns=http://www.w3.org/2005/07/scxml; 
xmlns:cs=http://commons.apache.org/scxml; version=1.0 initial=test1 
datamodel=jexl
 8  8 
/scxml

May 05, 2015 11:44:51 PM org.apache.commons.scxml2.env.SimpleSCXMLListener 
onEntry
INFO: enter /test1
May 05, 2015 11:44:51 PM org.apache.commons.scxml2.model.Log execute
INFO: null: logging in test1.1
May 05, 2015 11:44:51 PM org.apache.commons.scxml2.env.SimpleSCXMLListener 
onEntry
INFO: enter /test1/test1.1
test1.1.positive
May 05, 2015 11:45:16 PM org.apache.commons.scxml2.env.SimpleSCXMLListener 
onExit
INFO: exit /test1/test1.1
May 05, 2015 11:45:16 PM org.apache.commons.scxml2.env.SimpleSCXMLListener 
onTransition
INFO: transition (event = test1.1.positive, cond = null, from = /test1/test1.1, 
to = /test1/test1.2)
May 05, 2015 11:45:16 PM org.apache.commons.scxml2.model.Log execute
INFO: null: logging in test1.2
May 05, 2015 11:45:16 PM org.apache.commons.scxml2.env.SimpleSCXMLListener 
onEntry
INFO: enter /test1/test1.2
test1.2.positive
May 05, 2015 11:45:47 PM org.apache.commons.scxml2.env.SimpleSCXMLListener 
onExit
INFO: exit /test1/test1.2
May 05, 2015 11:45:47 PM org.apache.commons.scxml2.env.SimpleSCXMLListener 
onTransition
INFO: transition (event = test1.2.positive, cond = null, from = /test1/test1.2, 
to = /test1/test1.3)
May 05, 2015 11:45:47 PM org.apache.commons.scxml2.model.Log execute
INFO: null: logging in test1.3
May 05, 2015 11:45:47 PM org.apache.commons.scxml2.env.SimpleSCXMLListener 
onEntry
INFO: enter /test1/test1.3

(I typed 'test1.1.positive' and 'test1.2.positive' to trigger those events 
manually.)

So, the execution order is as follows:
1. enter into test1 state
2. execute actions in onentry of test1.1 state
3. enter into test1.1 state and wait
4. 'test1.1.positive' event triggered manually
5. exit from test1.1 state
6. transition from test1.1 to test 1.2 state
7. execute actions in onentry of test1.2 state
8. enter into test1.2 state
9. 'test1.2.positive' event triggered manually
10. exit from test1.2 state
11. transition from test1.2 to test1.3 state
12. execute actions in onentry of test1.3 state
13. enter into test1.3 state

I don't think script action would be different from log action in execution 
ordering, so I think you're seeing a different result on your end for some 
reason. Maybe you can try to find what the difference comes from?

Regards,

Woonsan

[1] http://commons.apache.org/proper/commons-scxml/guide/testing-standalone.html



On Fri, 4/17/15, R.C. Hoekstra r.c.hoeks...@erasmusmc.nl wrote:

 Subject: [scxml] bug with script in combination of a chain of transitions
 To: user@commons.apache.org user@commons.apache.org
 Date: Friday, April 17, 2015, 4:12 AM
 
 Dear people at scxml, 
 
 I found a bug in the scxml commons project. 
 
 Consider this scxml file: 
 
     state id=test1 initial=test1.1
         state id=test1.1
             onentry
                
 ntd:test id=test1.1 isIn=test1.1 /
                
 script agent.storeInMemory(test1.1);
 /script
             /onentry
             transition
 event=test1.1.positive target=test1.2/
         /state
         state id=test1.2
             onentry
                
 ntd:test id=test1.2 isIn=test1.1 memory=true
 /
             /onentry
             transition
 event=test1.2.positive target=test1.3/
         /state
         state id=test1.3/
     /state
 
 There is a custom tag, which simply tests if the state
 machine is at present in the state specified in the isIn
 attribute. If it is, it sends an event id.positive,
 else it sends id.negative.
 The purpose of this is that we needed a memory: a test that
 the state machine has at any moment been in a certain state.
 That is done via the script tag: via the
 agent.storeInMemory(test1.1) call, the test1.1 state is
 stored in the memory of the agent, and ntd:test tag
 considers this memory if the memory=true attribute is
 specified. As the state test1.1 is stored in memory while

Re: [lang] StrSubstitutor - a dollar sign before a variable

2015-07-23 Thread Woonsan Ko
Gotcha! Now I can understand the escape character means: Ignore the
following variable reference.
Thank you so much for the explanation with a good solution.

Cheers,

Woonsan

On Thu, Jul 23, 2015 at 2:42 PM, Anthony Brice
anthonybr...@lateachiever.com wrote:
 Sorry, the second sentence in the first paragraph should read: When you
 change the default escape character, you don't need to use it _to_ get a
 dollar sign before a variable reference in your interpolated string.

 To explain a little more, consider what happens to  $${amount} when
 you're using StrSubstitutor's default escape character. StrSubstitutor sees
 that you've got a variable reference (${amount}), and that you've got the
 escape character ($) before it, so it replaces $${amount} with
 ${amount}.

 Now consider what happens to  $${amount} when you've set StrSubstitutor's
 escape character to something other than the default. StrSubstitutor sees
 the variable reference (${amount}), notes that the character ($) before
 the variable reference is _not_ the user-defined escape character, and so
 replaces ${amount} with the appropriate value form the map.

 Regards,
 Anthony Brice

 On Thu, Jul 23, 2015 at 11:24 AM, Anthony Brice 
 anthonybr...@lateachiever.com wrote:

 The escape character just tells StrSubstitutor Ignore the following
 variable reference. When you change the default escape character, you
 don't need to use it get a dollar sign before a variable reference in your
 interpolated string. Try the following:

 @Test
 public void testReplaceEscapingDollarSign() {
 values.put(amount, 20.00);

 final StrSubstitutor sub = new StrSubstitutor(values);
 sub.setEscapeChar('');

 String replaceTemplate = The ${animal} jumps over the
 ${target}.;
 String expectedResult = The ${animal} jumps over the lazy dog.;
 String replacedResult = sub.replace(replaceTemplate);
 assertEquals(expectedResult, replacedResult);

 replaceTemplate = The ${animal} paid $${amount} to jump over
 the ${target}.;
 expectedResult = The quick brown fox paid $20.00 to jump over
 the lazy dog.;
 replacedResult = sub.replace(replaceTemplate);
 assertEquals(expectedResult, replacedResult);
 }

 Regards,
 Anthony Brice


 On Thu, Jul 23, 2015 at 7:42 AM, Woonsan Ko woon...@apache.org wrote:

 Sorry, the example was incomplete. It should be like this:

 @Test
 public void testReplaceEscapingDollarSign() {
 values.put(amount, 20.00);

 final StrSubstitutor sub = new StrSubstitutor(values);
 sub.setEscapeChar('');

 String replaceTemplate = The ${animal} jumps over the
 ${target}.;
 String expectedResult = The ${animal} jumps over the lazy dog.;
 String replacedResult = sub.replace(replaceTemplate);
 assertEquals(expectedResult, replacedResult);

 replaceTemplate = The ${animal} paid $${amount} to jump over
 the ${target}.;
 expectedResult = The quick brown fox paid $20.00 to jump over
 the lazy dog.;
 replacedResult = sub.replace(replaceTemplate);
 assertEquals(expectedResult, replacedResult);
 }

 The second assertion failed. So, it seems working in case of
 ${animal}, but not working in case of $${amount}.


 testReplaceEscapingDollarSign(org.apache.commons.lang3.text.StrSubstitutorTest)
  Time elapsed: 0.009 sec   FAILURE!
 org.junit.ComparisonFailure: expected:...uick brown fox paid []$20.00
 to jump over ... but was:...uick brown fox paid []$20.00 to jump
 over ...

 Regards,

 Woonsan

 On Thu, Jul 23, 2015 at 10:28 AM, Woonsan Ko woon...@apache.org wrote:
  Hi Anthony,
 
  Putting '$20.00' into the map is not an option in my use case, so I
  tried to use a different escape character. But it doesn't seem to be
  working either (another bug?):
 
  @Test
  public void testReplaceEscapingDollarSign() {
  values.put(amount, 20.00);
 
  final StrSubstitutor sub = new StrSubstitutor(values);
  sub.setEscapeChar('');
 
  String replaceTemplate = The ${animal} jumps over the
 ${target}.;
  String expectedResult = The ${animal} jumps over the lazy
 dog.;
  String replacedResult = sub.replace(replaceTemplate);
  assertEquals(expectedResult, replacedResult);
 
  //...
  }
 
  It fails like this:
 
  org.junit.ComparisonFailure: expected:...uick brown fox paid []$20.00
  to jump over ... but was:...uick brown fox paid []$20.00 to jump
  over ...
  at org.junit.Assert.assertEquals(Assert.java:115)
  at org.junit.Assert.assertEquals(Assert.java:144)
  at
 org.apache.commons.lang3.text.StrSubstitutorTest.testReplaceEscapingDollarSign(StrSubstitutorTest.java:182)
 
  I think I'd better file a bug regard to escape character handling.
 
  Regards,
 
  Woonsan
 
 
 
  On Wed, Jul 22, 2015 at 9:12 PM, Anthony Brice
  anthonybr...@lateachiever.com wrote:
  It's not a bug---that's a feature! :p
 
  From the javadoc

Re: [lang] StrSubstitutor - a dollar sign before a variable

2015-07-23 Thread Woonsan Ko
Hi Anthony,

Putting '$20.00' into the map is not an option in my use case, so I
tried to use a different escape character. But it doesn't seem to be
working either (another bug?):

@Test
public void testReplaceEscapingDollarSign() {
values.put(amount, 20.00);

final StrSubstitutor sub = new StrSubstitutor(values);
sub.setEscapeChar('');

String replaceTemplate = The ${animal} jumps over the ${target}.;
String expectedResult = The ${animal} jumps over the lazy dog.;
String replacedResult = sub.replace(replaceTemplate);
assertEquals(expectedResult, replacedResult);

//...
}

It fails like this:

org.junit.ComparisonFailure: expected:...uick brown fox paid []$20.00
to jump over ... but was:...uick brown fox paid []$20.00 to jump
over ...
at org.junit.Assert.assertEquals(Assert.java:115)
at org.junit.Assert.assertEquals(Assert.java:144)
at 
org.apache.commons.lang3.text.StrSubstitutorTest.testReplaceEscapingDollarSign(StrSubstitutorTest.java:182)

I think I'd better file a bug regard to escape character handling.

Regards,

Woonsan



On Wed, Jul 22, 2015 at 9:12 PM, Anthony Brice
anthonybr...@lateachiever.com wrote:
 It's not a bug---that's a feature! :p

 From the javadoc: If this character ['$'] is placed before a variable
 reference, this reference is ignored and won't be replaced. So even when
 you use three dollar signs, you still have a variable reference
 (${amount}) with the escape character placed before it, thus the variable
 reference will not be replaced.

 To achieve your desired effect, I think you either have to put the dollar
 sign in the mapping (e.g., values.put(amount, $20.00), use different
 delimiters, or just set a different escape character.

 Regards,
 Anthony Brice

 On Wed, Jul 22, 2015 at 2:50 PM, Woonsan Ko woon...@apache.org wrote:

 Hi there,

 I tried to use the following, expecting ...ick brown fox paid $20.00
 to jump over the la…:

 // In org.apache.commons.lang3.text.StrSubstitutorTest.java locally
 // after cloning https://github.com/woonsan/commons-lang.
 @Test
 public void testReplaceEscapingDollarSign() {
 values.put(amount, 20.00);
 doTestReplace(The quick brown fox paid $20.00 to jump over
 the lazy dog.,
   The ${animal} paid $$${amount} to jump over the
 ${target}., true);
 }

 (I put double dollar signs like $$${amount} because $ is the default
 escape character.)

 But, the result was:...ick brown fox paid $${amount} to jump over the
 la….

 Is it a bug or did I miss something?

 Regards,

 Woonsan

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



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



Re: [lang] StrSubstitutor - a dollar sign before a variable

2015-07-23 Thread Woonsan Ko
Sorry, the example was incomplete. It should be like this:

@Test
public void testReplaceEscapingDollarSign() {
values.put(amount, 20.00);

final StrSubstitutor sub = new StrSubstitutor(values);
sub.setEscapeChar('');

String replaceTemplate = The ${animal} jumps over the ${target}.;
String expectedResult = The ${animal} jumps over the lazy dog.;
String replacedResult = sub.replace(replaceTemplate);
assertEquals(expectedResult, replacedResult);

replaceTemplate = The ${animal} paid $${amount} to jump over
the ${target}.;
expectedResult = The quick brown fox paid $20.00 to jump over
the lazy dog.;
replacedResult = sub.replace(replaceTemplate);
assertEquals(expectedResult, replacedResult);
}

The second assertion failed. So, it seems working in case of
${animal}, but not working in case of $${amount}.

testReplaceEscapingDollarSign(org.apache.commons.lang3.text.StrSubstitutorTest)
 Time elapsed: 0.009 sec   FAILURE!
org.junit.ComparisonFailure: expected:...uick brown fox paid []$20.00
to jump over ... but was:...uick brown fox paid []$20.00 to jump
over ...

Regards,

Woonsan

On Thu, Jul 23, 2015 at 10:28 AM, Woonsan Ko woon...@apache.org wrote:
 Hi Anthony,

 Putting '$20.00' into the map is not an option in my use case, so I
 tried to use a different escape character. But it doesn't seem to be
 working either (another bug?):

 @Test
 public void testReplaceEscapingDollarSign() {
 values.put(amount, 20.00);

 final StrSubstitutor sub = new StrSubstitutor(values);
 sub.setEscapeChar('');

 String replaceTemplate = The ${animal} jumps over the ${target}.;
 String expectedResult = The ${animal} jumps over the lazy dog.;
 String replacedResult = sub.replace(replaceTemplate);
 assertEquals(expectedResult, replacedResult);

 //...
 }

 It fails like this:

 org.junit.ComparisonFailure: expected:...uick brown fox paid []$20.00
 to jump over ... but was:...uick brown fox paid []$20.00 to jump
 over ...
 at org.junit.Assert.assertEquals(Assert.java:115)
 at org.junit.Assert.assertEquals(Assert.java:144)
 at 
 org.apache.commons.lang3.text.StrSubstitutorTest.testReplaceEscapingDollarSign(StrSubstitutorTest.java:182)

 I think I'd better file a bug regard to escape character handling.

 Regards,

 Woonsan



 On Wed, Jul 22, 2015 at 9:12 PM, Anthony Brice
 anthonybr...@lateachiever.com wrote:
 It's not a bug---that's a feature! :p

 From the javadoc: If this character ['$'] is placed before a variable
 reference, this reference is ignored and won't be replaced. So even when
 you use three dollar signs, you still have a variable reference
 (${amount}) with the escape character placed before it, thus the variable
 reference will not be replaced.

 To achieve your desired effect, I think you either have to put the dollar
 sign in the mapping (e.g., values.put(amount, $20.00), use different
 delimiters, or just set a different escape character.

 Regards,
 Anthony Brice

 On Wed, Jul 22, 2015 at 2:50 PM, Woonsan Ko woon...@apache.org wrote:

 Hi there,

 I tried to use the following, expecting ...ick brown fox paid $20.00
 to jump over the la…:

 // In org.apache.commons.lang3.text.StrSubstitutorTest.java locally
 // after cloning https://github.com/woonsan/commons-lang.
 @Test
 public void testReplaceEscapingDollarSign() {
 values.put(amount, 20.00);
 doTestReplace(The quick brown fox paid $20.00 to jump over
 the lazy dog.,
   The ${animal} paid $$${amount} to jump over the
 ${target}., true);
 }

 (I put double dollar signs like $$${amount} because $ is the default
 escape character.)

 But, the result was:...ick brown fox paid $${amount} to jump over the
 la….

 Is it a bug or did I miss something?

 Regards,

 Woonsan

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



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



Re: [lang] StrSubstitutor - a dollar sign before a variable

2015-07-23 Thread Woonsan Ko
On Thu, Jul 23, 2015 at 4:21 AM, Jörg Schaible
joerg.schai...@swisspost.com wrote:
 Hi Woonsan,

 Woonsan Ko wrote:

 Hi there,

 I tried to use the following, expecting ...ick brown fox paid $20.00
 to jump over the la…:

 // In org.apache.commons.lang3.text.StrSubstitutorTest.java locally
 // after cloning https://github.com/woonsan/commons-lang.
 @Test
 public void testReplaceEscapingDollarSign() {
 values.put(amount, 20.00);
 doTestReplace(The quick brown fox paid $20.00 to jump over
 the lazy dog.,
   The ${animal} paid $$${amount} to jump over the
 ${target}., true);
 }

 (I put double dollar signs like $$${amount} because $ is the default
 escape character.)

 But, the result was:...ick brown fox paid $${amount} to jump over the
 la….

 Is it a bug or did I miss something?

 I'd call it a bug. You escaped the first dollar sign properly.

I think so, too. I've just filed a bug:
- https://issues.apache.org/jira/browse/LANG-1158

Cheers,

Woonsan


 Cheers,
 Jörg


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


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



[lang] StrSubstitutor - a dollar sign before a variable

2015-07-22 Thread Woonsan Ko
Hi there,

I tried to use the following, expecting ...ick brown fox paid $20.00
to jump over the la…:

// In org.apache.commons.lang3.text.StrSubstitutorTest.java locally
// after cloning https://github.com/woonsan/commons-lang.
@Test
public void testReplaceEscapingDollarSign() {
values.put(amount, 20.00);
doTestReplace(The quick brown fox paid $20.00 to jump over
the lazy dog.,
  The ${animal} paid $$${amount} to jump over the
${target}., true);
}

(I put double dollar signs like $$${amount} because $ is the default
escape character.)

But, the result was:...ick brown fox paid $${amount} to jump over the la….

Is it a bug or did I miss something?

Regards,

Woonsan

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



Re: SCXML and Script and context access

2015-08-31 Thread Woonsan Ko
On Tue, Aug 18, 2015 at 6:27 AM, Sinisa Zec  wrote:
> Dears,
>
>
>
> We are using Apache SCXML2 for the project which is based on FSM logic. I am
> trying for some time to achieve the following:
>
>
>
> 1.Set some variables in (Groovy)context from Java – X set of variables
>
> 2.Read those values in from the 

Re: [SCXML] Timers in SCXML

2015-09-05 Thread Woonsan Ko
Hi,

Which version of SCXML are you using? If you used a version older than
2.0-SNAPSHOT (sorry, 2.0 is still not released yet), could you try
with 2.0-SNAPSHOT by building locally by yourself from [1]?
Also, I wonder if you had a chance to follow Rahul's advice in the old
thread? I think he already gave good pointers.

Regards,

Woonsan

[1] https://github.com/apache/commons-scxml

On Thu, Sep 3, 2015 at 7:47 PM, giangttpham  wrote:
> I know this topic has been solved a long time ago but if anyone out there is
> listening, please help me. This is the scxml I have but the Timer delay
> doesn't work. I have the same problem as the person who started this post,
> after the send, the program just stops, it never goes to the next state.
>
> http://www.w3.org/2005/07/scxml;
>   version="1.0"
>   initial="player">
>
> 
> 
> 
> 
>
>  
>   
>
>   
>  
>
> 
>
> 
> 
> 
> 
>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>
>
>
> --
> View this message in context: 
> http://apache-commons.680414.n4.nabble.com/SCXML-Timers-in-SCXML-tp746934p4678456.html
> Sent from the Commons - User mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>

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



Re: Commons Lang substitution

2015-11-17 Thread Woonsan Ko
I think Jörg is right.

You may change the suffix StrMather through
#setVariableSuffixMatcher() on a StrSubstitutor.
I haven't tried it, but it should be something like this example:

final Map valueMap = ...;
StrSubstitutor  subst = new StrSubstitutor(valuesMap, "$", ""); //
NONE_MATCHER for suffix initially
subst.setVariableSuffixMatcher(StrMatcher.trimMatcher());

HTH,

Woonsan


On Tue, Nov 17, 2015 at 2:20 PM, Jörg Schaible  wrote:
> Alex Soto wrote:
>
>> Hi, thank you for your answers, Jörg I think that StrMatcher is for
>> implementing where you want to get information to be replaced on the
>> string, not for parsing issues.
>
> Instead of guessing, I'd rather have a look into the Javadocs of
> StrSubstitutor.
>
> Cheers,
> Jörg
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>

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



Re: scxml: nested custom actions

2016-03-24 Thread Woonsan Ko
Hi Rinke / Ate,

It looks like it has been changed as of SCXML-213 [1] with commit
eba2b2899787ef0476c1dd8852aba5b0adb4f5f3.
SCXMLReader#readCustomAction() seems to ignore the possibility of
nested custom actions by invoking #skipToEndElement(reader).
@Ate, is it probably a regression? (custom actions are commons-scxml
specific, not having to be compliant with scxml spec)

Regards,

Woonsan

[1] https://issues.apache.org/jira/browse/SCXML-213

On Thu, Mar 17, 2016 at 5:03 PM, R.C. Hoekstra
 wrote:
> Hi Ate, Woonsan,
>
> Is there a way to access nested child actions from a parent custom action in 
> scxml?
>
> In version scxml-2.0-M1 I could do this in the onexecute of a custom action:
>
> for (Action action : getParent().getActions()) {
>if (action instanceof MyChildAction) {
>   // do things with child action
>
>
> In M1 the Executable.getActions() would list all actions, also the nested 
> child actions contained in a parent action.  In the most recent code the 
> Executable.getActions() only lists the parent action, NOT it's children.
>
>
> I want to do something like this:
>
> 
>  
> 
> 
>  
> 
>
> So how to access the childActions from the parentAction's onExecute?
>
>
> thanks in advance,
>
> Rinke
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>

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



Re: [exec] how to use watchdog / wrong javadoc

2016-04-26 Thread Woonsan Ko
Hi Gary,

I've just fixed the javadoc:
- 
http://svn.apache.org/viewvc/commons/proper/exec/trunk/src/main/java/org/apache/commons/exec/ExecuteWatchdog.java?r1=1741116=1741115=1741116

Thanks for the suggestion! :-)

Woonsan


On Tue, Apr 26, 2016 at 5:23 PM, Gary Gregory <garydgreg...@gmail.com> wrote:
> Woonsan,
>
> Would you mind updating the Javadoc?
>
> Thank you,
> Gary
> On Apr 26, 2016 1:32 PM, "Woonsan Ko" <woon...@apache.org> wrote:
>
>> The javadoc seems to have outdated info. It should have been like the
>> following:
>>
>>   ExecuteWatchdog watchdog = new ExecuteWatchdog(3);
>>   Executor exec = new DefaultExecutor();
>>   exec.setStreamHandler(myStreamHandler);
>>   exec.setWatchdog(watchdog);
>>   int exitvalue = exec.execute(mycmdline);
>>   if (DefaultExecutor.isFailure(exitvalue) && watchdog.killedProcess()) {
>> // it was killed on purpose by the watchdog
>>   }
>>
>> Regards,
>>
>> Woonsan
>>
>>
>> On Tue, Apr 26, 2016 at 8:32 AM, Leonardo K. Shikida <shik...@gmail.com>
>> wrote:
>> > Hi
>> >
>> >
>> https://commons.apache.org/proper/commons-exec/apidocs/org/apache/commons/exec/ExecuteWatchdog.html
>> >
>> > says
>> >
>> >  ExecuteWatchdog watchdog = new ExecuteWatchdog(3);
>> >  Executer exec = new Executer(myloghandler, watchdog);
>> >  exec.setCommandLine(mycmdline);
>> >  int exitvalue = exec.execute();
>> >  if (Execute.isFailure(exitvalue) && watchdog.killedProcess()) {
>> >  // it was killed on purpose by the watchdog
>> >  }
>> >
>> > but
>> >
>> > "Executer" does not exist
>> >
>> > "Executor" does exist but it is an interface
>> >
>> > DefaultExecutor implements Executor but does not set a watchdog in the
>> > constructor
>> >
>> >
>> >
>> >
>> > []
>> >
>> > Leo
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>>

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



Re: [exec] how to use watchdog / wrong javadoc

2016-04-26 Thread Woonsan Ko
The javadoc seems to have outdated info. It should have been like the following:

  ExecuteWatchdog watchdog = new ExecuteWatchdog(3);
  Executor exec = new DefaultExecutor();
  exec.setStreamHandler(myStreamHandler);
  exec.setWatchdog(watchdog);
  int exitvalue = exec.execute(mycmdline);
  if (DefaultExecutor.isFailure(exitvalue) && watchdog.killedProcess()) {
// it was killed on purpose by the watchdog
  }

Regards,

Woonsan


On Tue, Apr 26, 2016 at 8:32 AM, Leonardo K. Shikida  wrote:
> Hi
>
> https://commons.apache.org/proper/commons-exec/apidocs/org/apache/commons/exec/ExecuteWatchdog.html
>
> says
>
>  ExecuteWatchdog watchdog = new ExecuteWatchdog(3);
>  Executer exec = new Executer(myloghandler, watchdog);
>  exec.setCommandLine(mycmdline);
>  int exitvalue = exec.execute();
>  if (Execute.isFailure(exitvalue) && watchdog.killedProcess()) {
>  // it was killed on purpose by the watchdog
>  }
>
> but
>
> "Executer" does not exist
>
> "Executor" does exist but it is an interface
>
> DefaultExecutor implements Executor but does not set a watchdog in the
> constructor
>
>
>
>
> []
>
> Leo

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



Re: [SCXML] How to obtain a collection of valid events

2016-05-23 Thread Woonsan Ko
On Fri, May 20, 2016 at 9:36 PM, Mansour Al Akeel
<mansour.alak...@gmail.com> wrote:
> Woonsan,
> Thank you for replying.
> From what you said, I can conclude that this is not supported or
> offered by SCXML. Am I right here?
If you mean finding available event names/patterns (see 3.12.1 in
https://www.w3.org/TR/scxml/#events) for a transition, there seems to
be no convenient method unless you implement a utility method by
yourself based on SCXMLSemanticsImpl.
But, basically the specification is more complex than your simple use
case. I guess that's why there has been no convenient utility yet.

> AFAIR an FSM should report if the token is recognized or not, and not
> just complete the transition/ignore the token silently.. If I am right
> here as well, then this use case is not specific to me.
Error reporting is a bit different from your use case, in my view.
I'm not really sure that SCXMLExecutor should report an error at the
moment when it cannot find any transition associated. I couldn't find
anything clear about that in the specification. If you find something,
please let us know. ;-)

> Do you see in the future, this will be supported by SCXML ? Should we
> open a JIRA ticket ?
commons-scxml has org.apache.commons.scxml2.ErrorReporter interface
which can be set through
org.apache.commons.scxml2.SCXMLExecutor.setErrorReporter(ErrorReporter).
Again, I'm not really sure it has to report an error when not finding
a transition to proceed on an event. It doesn't sound like an error to
me, but maybe a warning in that case.
What do others think?

Regards,

Woonsan

>
> Thank you
>
>
> On Mon, May 16, 2016 at 10:04 AM, Woonsan Ko <woon...@apache.org> wrote:
>> Hi Mansour,
>>
>> I don't see any convenient method to easily figure out what are
>> available event names for transitions like your use case needs.
>> All the knowledge about that is encapsulated in
>> org.apache.commons.scxml2.semantics.SCXMLSemanticsImpl internally, so
>> you might want to take a look at it. SCXMLSemantics is not exposed to
>> applications from the execution context.
>>
>> Regards,
>>
>> Woonsan
>>
>>
>> On Sat, May 14, 2016 at 9:19 AM, Mansour Al Akeel
>> <mansour.alak...@gmail.com> wrote:
>>> Hello all,
>>>
>>> Based on my understanding, a state machine provides feedback about the
>>> input. If the token is not recognized, it should report this.
>>>
>>> I am prototyping in SCXML, and trying to find a way to find if the
>>> supplied event/token is recognized or not. I am unable to find a way
>>> to tell. May be someone else had luck with this, and can share the way
>>> with me.
>>>
>>> So my question is, I am working in an AbstractStateMachine, and I have
>>> an instance of SCXMLExcutor obtained from getEngine(). How can I find
>>> the valid inputs ??
>>>
>>>
>>> Thank you
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>

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



Re: [SCXML] How to obtain a collection of valid events

2016-05-16 Thread Woonsan Ko
Hi Mansour,

I don't see any convenient method to easily figure out what are
available event names for transitions like your use case needs.
All the knowledge about that is encapsulated in
org.apache.commons.scxml2.semantics.SCXMLSemanticsImpl internally, so
you might want to take a look at it. SCXMLSemantics is not exposed to
applications from the execution context.

Regards,

Woonsan


On Sat, May 14, 2016 at 9:19 AM, Mansour Al Akeel
 wrote:
> Hello all,
>
> Based on my understanding, a state machine provides feedback about the
> input. If the token is not recognized, it should report this.
>
> I am prototyping in SCXML, and trying to find a way to find if the
> supplied event/token is recognized or not. I am unable to find a way
> to tell. May be someone else had luck with this, and can share the way
> with me.
>
> So my question is, I am working in an AbstractStateMachine, and I have
> an instance of SCXMLExcutor obtained from getEngine(). How can I find
> the valid inputs ??
>
>
> Thank you
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>

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



Re: [SCXML] Next states

2016-05-06 Thread Woonsan Ko
On Fri, May 6, 2016 at 2:56 AM, Mansour Al Akeel
<mansour.alak...@gmail.com> wrote:
> Thank you Woonsan,
> The use case is to report transition failure or invalid path.
> Using the listener is good, but it wont be triggered unless the
> transition happens.
> For example this was written to test commons SCXML 1:
>
> @Override
> public boolean fireEvent(String event) {
> List lst = 
> this.getCurrentState().getTransitionsList(event);
> if (lst == null) {
> System.out.println("unknown event: " + event);
> return false;  // this should return true if final only
> }
> State before = this.getCurrentState();
> boolean evnetFired = super.fireEvent(event);
>
> State after = this.getCurrentState();
>
> if (after.equals(before)) {
>
> Status stauts = this.getEngine().getCurrentStatus();
>
> Set valid = stauts.getStates();
>
> System.out.println("We are in " + before.getId() + ".
> Possible next states: ");
>
> for (Transition transition : lst) {
> System.out.println(transition.getTarget().getId());
> }
>
> List transitionList =
> this.getCurrentState().getTransitionsList();
>
> for (Transition transition : transitionList) {
> System.out.println(transition.getTarget().getId());
> }
> // throw new
> // IllegalStateException("Can not complete transition while in " +
> // before.getId());
> } else {
> System.out.println("succefully switched state " +
> before.getId() + " -> " + after.getId());
> }
> return evnetFired;
> }
>
>
> Is there a way to translate it to 2 ?

I guess the main change and challenge in API now is that you cannot
use #getCurrentState() any more.
Ate refactored a lot with SCXML-196, 197 and 200 in this (SCXML semantics) area.
For example, #getCurrentState() seems quite confusing because in SCXML
multiple states can be active at the same time. e.g, in parallel
states.
I guess that's why the old API cannot be supported any more.
So, you need to try with SCXMLExecutor#getStatus(), Status#getStates()
and Status#getActiveStates() to figure out which state you need to get
in your implementation. Please see each javadoc description.

Regards,

Woonsan

> Thank you
>
>
> On Wed, May 4, 2016 at 11:58 AM, Woonsan Ko <woon...@apache.org> wrote:
>> Not sure about the use case, but maybe you can add a listener
>> (AbstractStateMachine#getEngine()#addListener(stateMachine, new
>> MyListener())).
>> If you get a TransitionalState in your listener, you may possibly get
>> all the available Transitions and TransitionTargets.
>>
>> Regards,
>>
>> Woonsan
>>
>>
>> On Sun, May 1, 2016 at 8:19 PM, Mansour Al Akeel
>> <mansour.alak...@gmail.com> wrote:
>>> Is there a way to get the next valid states or transitions ?
>>> I am working with AbstractStateMachine
>>>
>>> Thank you
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>>> For additional commands, e-mail: user-h...@commons.apache.org
>>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
>> For additional commands, e-mail: user-h...@commons.apache.org
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>

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



Re: [SCXML] Next states

2016-05-04 Thread Woonsan Ko
Not sure about the use case, but maybe you can add a listener
(AbstractStateMachine#getEngine()#addListener(stateMachine, new
MyListener())).
If you get a TransitionalState in your listener, you may possibly get
all the available Transitions and TransitionTargets.

Regards,

Woonsan


On Sun, May 1, 2016 at 8:19 PM, Mansour Al Akeel
 wrote:
> Is there a way to get the next valid states or transitions ?
> I am working with AbstractStateMachine
>
> Thank you
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>

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



Re: [SCXML] Any release date

2016-05-04 Thread Woonsan Ko
Hi Mansour,

Sorry for late response.
There are some (radical) changes needed for 2.0, so it's getting
delayed. You can find more detail from Ate's message:
- http://markmail.org/thread/bb4ihxzhtprv675c

Regards,

Woonsan


On Sat, Apr 30, 2016 at 7:40 PM, Mansour Al Akeel
 wrote:
> Hello all,
>
> The website shows the latest unstable version is 2.0-SNAPSHOT.
>
> I am not sure the date the snapshot was updated but I can see
> extensive activity:
>
> https://git1-us-west.apache.org/repos/asf?p=commons-scxml.git
>
> Thanks to the development team. Are there any plans to release it any
> time soon ?
>
> Thank you
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>

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



Re: [SCXML] Question on Invoker Interface

2016-10-17 Thread Woonsan Ko
Please do not cross post a message and it is better to direct your
comments to the list in general. See more tips here:
http://www.apache.org/dev/contrib-email-tips

On Thu, Oct 13, 2016 at 6:09 PM, Prathib Kumar  wrote:
> Hi Woonsan,
>
> As you have suggested I have picked the M1 release from
> http://maven.onehippo.com/maven2/org/apache/commons/commons-scxml2/2.0-M1/
> but it looks like on the M1 release, setParentSCXMLExecutor() API is missing
> in the interface where as I could see it in the latest git repo.

I didn't suggest that. I just gave an example on how my organization
does in my reply to your personal e-mail question, trying to give you
a hint (e.g, you can deploy a tag or revision onto the repository of
your own).

>
> Do we have any tag'ed version which contains the latest version of this
> interface ?

No tag, no release yet.

Woonsan

>
> This API is very significant for us as the invoker would need to be aware of
> the executor to trigger the events on successful execution of the job.
>
> Regards
> Prathib Kumar.

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



Re: [scxml] looking for developer for adaptations on Commons SCXML

2017-11-29 Thread Woonsan Ko
On Wed, Nov 29, 2017 at 6:56 AM, r.c.hoekstra  wrote:
> Hi List,
>
> We are working at the ErasmusMC hospital at Rotterdam, Netherlands, on
> scientific simulations on the spread of infectious diseases through human
> populations.
> In this project we use Apache Commons SCXML to model diseases.

Just out of curiosity, would you mind sharing the reasons, in higher
level, why SCXML library was chosen for the simulation in the first
place? There are many tools and libs, specialized in simulation, such
as MASON. Was it mainly because of the declarative way of SCXML or
scriptability (e.g, in JEXL) or both? Is there any other background
reason?
Is it also a considerable option for you to use one of those
simulation-specialized tools or libs instead of SCXML if it can meets
the requirements?

>
> However, the problem with the present implementation is that it is too slow
> for us. We would need a version that is optimized for being instantiated
> 100 times in a running simulation.

It sounds really really slow, and the expectation is like 10+ days vs
1 sec. And is it concerned more on *loading* time before *execution*,
or both?

>
> For the coming 2 or 3 months we have money available to pay someone who
> could create an adapted, descaled version of apache commons scxml. The goal
> is to make it much faster, either by optimizing, rewriting, and dispose of
> elements not needed for us.

To be honest, in my gut feeling, it seems infeasible to improve or
rewrite the SCXML library in the shorter term to meet the expectation.
To me, SCXML in both spec and implementation, doesn't seem to be
designed for that kind of highly capable simulation use cases. It's
just too heavy and too much feature driven, IMHO, for that kind of use
cases. Please correct me if I'm wrong.
Also, I'm personally doubtful to try to improve SCXML project to cover
the simulation use cases even in the future. It is a reference
implementation and so it has to keep all the features in the spec, and
so on. Long-time less-activeness in this community is another thing.

Regards,

Woonsan

>
> Our preference would be to find someone who has developed for the commons
> scxml project, or who is at least an experienced user.
>
> In case of anyone interested please reply via this list and we can get into
> contact about the details.
>
> best regards,
>
> Rinke Hoekstra

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



Re: [scxml] looking for developer for adaptations on Commons SCXML

2017-12-01 Thread Woonsan Ko
Hi Rinke,

Thanks a lot for the info! Please see my comments inline.

On Thu, Nov 30, 2017 at 4:50 AM, r.c.hoekstra <r.c.hoeks...@scarlet.nl> wrote:
> On 30-11-17 01:49, Woonsan Ko wrote:
>
> Hi Woonsan,
>
> I'll go through your comments in the text below.
>
>> On Wed, Nov 29, 2017 at 6:56 AM, r.c.hoekstra <r.c.hoeks...@scarlet.nl>
>> wrote:
>>>
>>> Hi List,
>>>
>>> We are working at the ErasmusMC hospital at Rotterdam, Netherlands, on
>>> scientific simulations on the spread of infectious diseases through human
>>> populations.
>>> In this project we use Apache Commons SCXML to model diseases.
>>
>> Just out of curiosity, would you mind sharing the reasons, in higher
>> level, why SCXML library was chosen for the simulation in the first
>> place? There are many tools and libs, specialized in simulation, such
>> as MASON. Was it mainly because of the declarative way of SCXML or
>> scriptability (e.g, in JEXL) or both? Is there any other background
>> reason?
>
> Yes. The declarativeness was really important. We needed a way to declare
> the disease processes from state to state,
> with transitions. And as we were already using other xml files to define
> other input (population, etc), it fitted the rest
> of the input perfectly.
> Besides that, we also use the scripting. We use JEXL for that.
>
>> Is it also a considerable option for you to use one of those
>> simulation-specialized tools or libs instead of SCXML if it can meets
>> the requirements?
>
> Yes we looked into a few of those; I know there are many of them. For
> various reasons it mostly prooved better to develop our own libraries.
> But I must confess that I didn't look in those libraries for scxml-like
> features.
> I supposed that it would not support that.
>>
>>
>>> However, the problem with the present implementation is that it is too
>>> slow
>>> for us. We would need a version that is optimized for being instantiated
>>> 100 times in a running simulation.
>>
>> It sounds really really slow, and the expectation is like 10+ days vs
>> 1 sec. And is it concerned more on *loading* time before *execution*,
>> or both?
>
>
> Well, a million might be a bit exagerated for now, but eventually that is
> what we'd like. A run with about 50.000 takes
> 2 hours or so to run, if I remember it well. We'd like to scale that up to
> at least a few hundreds of thousands, without
> having to wait for hours or without the JVM crashing on out of memory
> exceptions.
> And indeed, both loading and execution do matter. A state machine is
> attached to a person, and persons may be born
> during a simulation, so that involves instantiating/loading a new state
> machine. But then, the runtime of a simulation is
> no extremely long in comparison to the life expectancy of persons (about 200
> years or so).

So, I assume you have your own simulation runtime engine
implementation which instantiates and executes environments and
agents. And each agent instance in your project is a SCXML state
machine, right?
I'm not an expert on this simulation thing and tools, but just
thinking aloud that it should also be possible to use an external
simulation tool's runtime engine (instead of your custom runtime
engine) and implement agents, embedding SCXML stuffs, based on their
API. I'm just wondering if it is a feasible idea and if there's a very
extensible tool meeting your needs. In other words, it could be about
creating a new bridging library to support smaller set of SCXML for
specific simulation tools (not improving/rewriting/forking hugely in
SCXML project). Again, just thinking aloud...

>
>
>>
>>> For the coming 2 or 3 months we have money available to pay someone who
>>> could create an adapted, descaled version of apache commons scxml. The
>>> goal
>>> is to make it much faster, either by optimizing, rewriting, and dispose
>>> of
>>> elements not needed for us.
>>
>> To be honest, in my gut feeling, it seems infeasible to improve or
>> rewrite the SCXML library in the shorter term to meet the expectation.
>> To me, SCXML in both spec and implementation, doesn't seem to be
>> designed for that kind of highly capable simulation use cases. It's
>> just too heavy and too much feature driven, IMHO, for that kind of use
>> cases. Please correct me if I'm wrong.
>
> No, I think you're right. It isn't designed to be instantiated many times.
> Maybe my wording was not chosen well enough. We're not exactly interested in
> rewriting the SCXML library. There are quite some features of it we don't
> use at all, for
> example the da

[JEXL] white list classes, not by interfaces?

2017-10-19 Thread Woonsan Ko
Hi,

I'm experimenting it with JexlSandbox (for blackbox mode) of v3.1 like
the following example:

JexlSandbox sandbox = new JexlSandbox(false);
sandbox.white(IFoo.class.getName());
// ...
JexlEngine engine = new JexlBuilder().sandbox(sandbox).create();

But if I put an instance of FooImpl (implementing IFoo interface) for
instance, the JEXL interpreter doesn't seem to be able to resolve
IFoo's methods. If I add FooImpl.class.getName() to the white list,
then it starts resolving the method call without a problem.
So, I assume the sandbox permission handling might be checking the
implementation class name only. Is it true? If so, wouldn't it be nice
if it can check its interfaces as well?
When providing an interpreting env using JEXL, I think it's very
common to separate the interfaces from various implementations.

Regards,

Woonsan

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



Re: [JEXL] white list classes, not by interfaces?

2018-01-25 Thread Woonsan Ko
I've created a ticket for this:
- https://issues.apache.org/jira/browse/JEXL-253

Cheers,

Woonsan


On Thu, Oct 19, 2017 at 10:09 AM, Woonsan Ko <woon...@apache.org> wrote:
> Hi,
>
> I'm experimenting it with JexlSandbox (for blackbox mode) of v3.1 like
> the following example:
>
> JexlSandbox sandbox = new JexlSandbox(false);
> sandbox.white(IFoo.class.getName());
> // ...
> JexlEngine engine = new JexlBuilder().sandbox(sandbox).create();
>
> But if I put an instance of FooImpl (implementing IFoo interface) for
> instance, the JEXL interpreter doesn't seem to be able to resolve
> IFoo's methods. If I add FooImpl.class.getName() to the white list,
> then it starts resolving the method call without a problem.
> So, I assume the sandbox permission handling might be checking the
> implementation class name only. Is it true? If so, wouldn't it be nice
> if it can check its interfaces as well?
> When providing an interpreting env using JEXL, I think it's very
> common to separate the interfaces from various implementations.
>
> Regards,
>
> Woonsan

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



Re: [SCXML] tag usage is giving location error

2019-03-01 Thread Woonsan Ko
Hi Diptendu,

Hmm... I think I stepped off on the wrong foot, and you're right: It
seems failing with 2.0-M1 tag.
When I execute the same thing [1] with the latest master branch
(2.0-SNAPSHOT), it works fine.
So, I assume it was fixed intentionally or it just cannot occur any
more as of SCXML-243.

Regards,

Woonsan

[1] https://github.com/woonsan/commons-scxml-examples/tree/master/hello-world
[2] https://issues.apache.org/jira/browse/SCXML-243

On Fri, Mar 1, 2019 at 5:27 AM Diptendu Dutta  wrote:
>
> Do simple assignments of the form 
> work in commons scxml?
>
> I have this state machine description:
>
> http://www.w3.org/2005/07/scxml;
>   version="1.0"
>   initial="Start">
>
> 
> 
> 
> 
> 
>
>  
>   
>
>   
>   
>   
>  
>
>  
>   
>
> />
>   
>   
>  
>
>
> INFO: transition (event = what-is-my-name, cond = null, from = /Start,
> to = /WhatIsMyName)
> Feb 28, 2019 9:04:53 PM org.apache.commons.scxml2.SCXMLExecutionContext 
> execute
> INFO: null: What is my name
> Feb 28, 2019 9:04:53 PM
> org.apache.commons.scxml2.env.SimpleErrorReporter
> handleErrorMessageWARNING: EXPRESSION_ERROR
> (evalLocation('currentResponse'): java.lang.String cannot be cast to
> org.w3c.dom.Node): Expression error inside /WhatIsMyNameFeb 28, 2019
> 9:04:53 PM org.apache.commons.scxml2.env.SimpleSCXMLListener onEntry
> INFO: enter /WhatIsMyName
>
> I have tried with both commons scxml version 0.9 as well as 2.0
>
> Regards,
>
> Diptendu Dutta

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



Re: [SCXML] Using to call a REST API

2019-03-11 Thread Woonsan Ko
Hi Diptendu,

On Mon, Mar 11, 2019 at 2:06 AM Diptendu Dutta  wrote:
>
> Is it possible to use the  tag to call a REST API?

Possible.

>
> How would one specify the various attributes such as method (GET/POST),
> headers, body, etc.?

You can pass any data in  to the target, and your
EventDispatcher may interpret the data to invoke an external service.

>
> Is there any example code that I can consult?

WizardsTest.java [1], to handle a custom type of send event used in
wizard-02.xml [2], registers a custom EventDispatcher which can read
type, target and data, and possibly invoke an external service.

FWIW, this is beyond the question, but it might be interesting to
implement a generic EventDispatcher to integrate with Apache Camel,
simply dispatching to a specific route based on  attributes.
e.g, type="camel" data="...", where data is passed to a Camel route as
message body.

Regards,

Woonsan

[1] 
https://github.com/apache/commons-scxml/blob/master/src/test/java/org/apache/commons/scxml2/WizardsTest.java#L62
[2] 
https://github.com/apache/commons-scxml/blob/master/src/test/java/org/apache/commons/scxml2/env/jexl/wizard-02.xml#L43

>
> Regards,
>
> Diptendu Dutta

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



Re: [SCXML] Problem with setting values in Context using 2.0-SNAPSHOT (works with 0.9)

2019-03-18 Thread Woonsan Ko
Hi Diptendu,

Please see my comments inline.

On Sat, Mar 16, 2019 at 8:19 AM Diptendu Dutta  wrote:
>
> I have the following code that is working in 0.9 but failing in 2.0-SNAPSHOT
> .
>
> SCXMLExecutor engine;
> Context rootContext;
> Evaluator evaluator;
>
> .
> rootContext = evaluator.newContext(null);
> engine.setRootContext(rootContext);
> engine.go();
>
> rootContext.set("intent", "StartBot");
> engine.triggerEvent("run", TriggerEvent.SIGNAL_EVENT);
>
>
> --
> http://www.w3.org/2005/07/scxml;
>   version="1.0"
>   datamodel="jexl"
>   initial="Start">
>
> 
> 
>  
> 
>
>  
>target="StartBot" />
>   
> 
>
>  
>   
>
>
>   
>   
>  
>
>  
> .
> --
> The StartBot state is not entered, rather the Default state is entered and
> the value
> of the "intent" datamodel item is printed as 'hello' rather than 'StartBot'
> as expected
>
> INFO: transition (event = run, cond = null, from = /Start, to = /Default)
> INFO: null: hello
>
> This same code is working with version 0.9.
>
> Do I have to do things differently with 2.0-SNAPHOT for it to work?

It looks like the evaluator in v2 is case-sensitive.
I think it would work with: cond="intent eq StartBot" -
'StartBot', not 'startBot'.

Regards,

Woonsan

>
> Regards,
>
> Diptendu Dutta

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



Re: [SCXML] Support for Commons JEXL in SCXML

2019-07-15 Thread Woonsan Ko
Hi Diptendu,

I don't think the 'target' attribute is meant to be used with
expressional values. [1]
I guess you might want to try with transition elements with cond
attribute, which is expressional [1], instead.
For example,




Regards,

Woonsan

[1] https://www.w3.org/TR/scxml/#transition

On Mon, Jul 15, 2019 at 10:51 AM Diptendu Dutta
 wrote:
>
> Some thing like
>
> 
> 
> 
> 
> ..
>  
> ..
>   
>  
>
> does not work.
>
> *SEVERE: Transition target with ID "${startState}" not found*
>
> However, the spec at
> https://commons.apache.org/proper/commons-jexl/reference/syntax.html
> mentions
>
> If a variable user valued JEXL is present in the environment - whether as a
> local or global variable -, the format
>
> `Hello ${user}`
>
> will evaluate as
>
> Hello JEXL
>
> How can I make this work?
>
> Regards,
>
> Diptendu Dutta

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