Re: [SCXML] Timers in SCXML
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 rahul.akol...@gmail.comwrote: On Tue, Apr 14, 2009 at 8:19 AM, Linda Erlenhov linda.erlen...@gmail.com 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? snip/ 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, log is nested in send which isn't legal, so the nested log will be ignored. -Rahul [1] http://commons.apache.org/scxml/guide/testing-standalone.html --- scxml version=1.0 initialstate=167 xmlns:cs= http://commons.apache.org/scxml; xmlns=http://www.w3.org/2005/07/scxml state id = 167 transition target=StateA/ /state state id =StateA onentry log label=Renegade expr='Entering state: A'/ send sendid=1 event='ToB' delay='1000ms' log label=Renegade expr='Timer starting...'/ /send /onentry transition event=ToB target=StateB/ /state state id=StateB onentry log label=Renegade expr='Entering state: B'/ send sendid=2 event='ToA' delay='2000ms' log label=Renegade expr='Timer starting...'/ /send /onentry transition event=ToA target=StateA/ /state /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
StrTokenizer not handling quotes correctly?
I am trying to use StrTokenizer for some parsing and I am probably not using it correctly. Let's say I have this string: 11a,b11,22c,d22 I would like to split it by the comma ,, but ignoring any commas embedded in quotes. I try this: String test = 11\a,b\11,22\c,d\22; StrTokenizer str = new StrTokenizer(test,',',''); String[] tokens = str.getTokenArray(); for(String t: tokens) { System.out.println(t); } and expect to have two strings print out: 11a,b11 22c,d22 but instead I get 4 : 11a b11 22c d22 It seems the tokenizer is splitting on the comma, even if it is embedded in quotes. I tried different options on the StrTokenizer, but not been able to get it to work correctly. Any idea as to what am I doing wrong? Using latest version 2.4. Thanks, Jacek
HTTP proxy for commons XMLConfiguration
Hi, I need some advice with the Commons Configuration library. I use a XML file for configuration storage which has a DTD specified being reachable by a HTTP URI. I need to use a HTTP proxy on the executing machine. When I try to load the XML configuration, also with setValidate() to false I get a ConfigurationException with the message: Unable to load the configuration. When removing the DTD statement the configuration loads just fine. So: is Apache commons-configuration HTTP proxy aware? Does it use the actual JVM settings? I also tried to use the -Dhttp.proxyHost system properties settings with no success. So, how to do it? Btw. machine is WinXP and I'm using Eclipse as IDE with m2eclipse for Maven support. Thx Chris - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: StrTokenizer not handling quotes correctly?
On 15/04/2009, Jacek Furmankiewicz jace...@gmail.com wrote: I am trying to use StrTokenizer for some parsing and I am probably not using it correctly. Let's say I have this string: 11a,b11,22c,d22 I would like to split it by the comma ,, but ignoring any commas embedded in quotes. I try this: String test = 11\a,b\11,22\c,d\22; StrTokenizer str = new StrTokenizer(test,',',''); String[] tokens = str.getTokenArray(); for(String t: tokens) { System.out.println(t); } and expect to have two strings print out: 11a,b11 22c,d22 but instead I get 4 : 11a b11 22c d22 It seems the tokenizer is splitting on the comma, even if it is embedded in quotes. Quotes are only allowed in quoted strings. From the Javadoc: Each token may be surrounded by quotes. The quote matcher specifies the quote character(s). A quote may be escaped within a quoted section by duplicating itself. I tried different options on the StrTokenizer, but not been able to get it to work correctly. Any idea as to what am I doing wrong? Using latest version 2.4. The input needs to look like this: 11a,b11,22c,d22 Thanks, Jacek - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
[dbcp] connection autocommit property
Hi, i am trying to find the behaviour of dbcp about autocommit property. i am getting the connection from pool and then setting autocommit property false . after doing a few transactions,i commit or rollback the transaction and then i close the connection so it goes back to the pool. everthing is ok up to now. if i get that connection one more time after theese operations, then what is the autocommit property? False or True ? i expect to be false because i set it false and sent to pool. what do you think?
RE: [dbcp] connection autocommit property
We do the same thing, and, yes, the pool doesn't change the state of autocommit. It is easy to check when you borrow the connection back from the pool. -Original Message- From: Melih Utkan UNSAL [mailto:melihut...@yahoo.com] Sent: Wednesday, April 15, 2009 7:52 AM To: user@commons.apache.org Subject: [dbcp] connection autocommit property Hi, i am trying to find the behaviour of dbcp about autocommit property. i am getting the connection from pool and then setting autocommit property false . after doing a few transactions,i commit or rollback the transaction and then i close the connection so it goes back to the pool. everthing is ok up to now. if i get that connection one more time after theese operations, then what is the autocommit property? False or True ? i expect to be false because i set it false and sent to pool. what do you think? - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org
Re: [SCXML] Timers in SCXML
On Wed, Apr 15, 2009 at 11:02 AM, Linda Erlenhov linda.erlen...@gmail.com wrote: 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! snip/ This isn't remotely close to spam, in fact its quite useful to know when issues are resolved so thanks for following up. -Rahul //Linda On Wed, Apr 15, 2009 at 2:16 PM, Linda Erlenhov linda.erlen...@gmail.comwrote: 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 rahul.akol...@gmail.comwrote: On Tue, Apr 14, 2009 at 8:19 AM, Linda Erlenhov linda.erlen...@gmail.com 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? snip/ 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, log is nested in send which isn't legal, so the nested log will be ignored. -Rahul [1] http://commons.apache.org/scxml/guide/testing-standalone.html --- scxml version=1.0 initialstate=167 xmlns:cs= http://commons.apache.org/scxml; xmlns=http://www.w3.org/2005/07/scxml state id = 167 transition target=StateA/ /state state id =StateA onentry log label=Renegade expr='Entering state: A'/ send sendid=1 event='ToB' delay='1000ms' log label=Renegade expr='Timer starting...'/ /send /onentry transition event=ToB target=StateB/ /state state id=StateB onentry log label=Renegade expr='Entering state: B'/ send sendid=2 event='ToA' delay='2000ms' log label=Renegade expr='Timer starting...'/ /send /onentry transition event=ToA target=StateA/ /state /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] getting set datats in the datamodel
On Wed, Apr 15, 2009 at 12:34 PM, Linda Erlenhov linda.erlen...@gmail.com wrote: 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. snip/ I'd do it the other way, extend the Context implementation and add observable functionality since I claim the latter is the simpler bit (lower case o here, not referring to the java.util class -- minimally, (a) maintain a list of observers as an instance field, (b) have an adder method that adds observers to the list and (c) have the notify method in question iterate over the observers to notify them of the value change). 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. snap/ Timers don't need JEXL, you can continue using whatever EL you were using (extend the corresponding Context and Evaluator implementations -- if you were in fact using Commons JEXL, you'd extend JexlContext and JexlEvaluator and so on). 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? snip/ Its a bit more of a Java question than an SCXML question, yes. You could post to any Java forums / try search engines. -Rahul 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 snip/ 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
[Digester] HTML entity decoding?
Hello, I'm using Digester 2.0 and trying to process XML that may include HTML entities and trying to get Digester to decode them when parsing. For example, my XML contains: name![CDATA[Gruuml;ber]]/name Currently, Digester is parses this as: Gruuml;ber But what I am really after is Grüber, so I am looking for a way to get this uuml; entity decoded by Digester. How do I tell Digester to decode HTML entities? Also, if I don't use CDATA, like this: nameGruuml;ber/name Digester gives me: Grber Any help would be very appreciated. Thanks, Otis -- Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch - To unsubscribe, e-mail: user-unsubscr...@commons.apache.org For additional commands, e-mail: user-h...@commons.apache.org