Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 76761 invoked from network); 18 Jul 2008 08:06:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 18 Jul 2008 08:06:37 -0000 Received: (qmail 65156 invoked by uid 500); 18 Jul 2008 08:06:33 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 65094 invoked by uid 500); 18 Jul 2008 08:06:33 -0000 Mailing-List: contact user-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Commons Users List" Delivered-To: mailing list user@commons.apache.org Received: (qmail 65083 invoked by uid 99); 18 Jul 2008 08:06:33 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Jul 2008 01:06:33 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [87.193.12.202] (HELO extmail.dtnet.de) (87.193.12.202) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 18 Jul 2008 08:05:40 +0000 Received: from mail2.dtnet.de (smtp.dtnet.de [192.168.127.27]) by extmail.dtnet.de (Postfix) with ESMTP id AB36113FD1 for ; Fri, 18 Jul 2008 10:04:24 +0200 (CEST) Received: by mail2.dtnet.de (Postfix, from userid 8) id CA5825B375; Fri, 18 Jul 2008 10:04:24 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.1.7-deb (2006-10-05) on mail2.dtnet.de X-Spam-Level: Received: from mail2.dtnet.de (mailscanner.dtnet.de [192.168.127.29]) by mail2.dtnet.de (Postfix) with ESMTP id DF63F5B372 for ; Fri, 18 Jul 2008 10:04:13 +0200 (CEST) Received: from exchange.dtnet.de (exchange.dtnet.de [192.168.101.139]) by mail2.dtnet.de (Postfix) with ESMTP id CF8895B371 for ; Fri, 18 Jul 2008 10:04:13 +0200 (CEST) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: AW: [SCXML] JEXL, object setter does not work ? X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Fri, 18 Jul 2008 10:03:56 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [SCXML] JEXL, object setter does not work ? Thread-Index: AcjoMUaUnKe/cGuATvOYe8QfgL4NbwAesF6A References: From: "Daniel Schwager" To: "Commons Users List" X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.7-deb Hi Rahul, > wrote: > > Hi Rahul, > > > > i created a statemachine with an JEXL context. In > > my XML-description, I do the following: > > ..... > > So, I'm not able to set my job.setStateInformation() ... >=20 > Von: Rahul Akolkar > Usage for is really limited to the variants described at the > bottom of this page: >=20 > http://commons.apache.org/scxml/guide/datamodel.html >=20 > It is not intelligent enough to do the kind of property assignment > you're attempting here. It will take the "name" to be the variable > name in its entirety and not attempt to parse it in any fashion. >=20 > When using JEXL, I'd recommend implementing a custom > action and solving a broad suite of such issues. Using the > ScriptFactory [1] API in JEXL 1.1 that should be fairly trivial. >=20 > Ofcourse, JEXL allows you to call the setter directly i.e. > job.setStateInformation('SOME INFO') as the expression. >=20 Great idea - the action is realy simple !! Thanks for this. Regards Danny public class JexlScriptAction extends Action { private static final long serialVersionUID =3D 1L; private String command; private String outputvar; public JexlScriptAction() { super(); } public void execute(final EventDispatcher evtDispatcher, final ErrorReporter errRep, final SCInstance scInstance, final Log appLog, final Collection derivedEvents) throws ModelException, SCXMLExpressionException { try { Script script =3D ScriptFactory.createScript(command); Object result =3D script.execute((JexlContext) scInstance .getRootContext()); if (outputvar !=3D null) =09 scInstance.getRootContext().getVars().put(outputvar, result); } catch (Exception e) { String err =3D "Execution of jexl-script:' " + command + "' failed: " + e.getMessage(); errRep.onError("DTS02", err, null); } } public String getCommand() { return command; } public void setCommand(String command) { this.command =3D command; } public String getOutputvar() { return outputvar; } public void setOutputvar(String outputVar) { this.outputvar =3D outputVar; } } --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org