Return-Path: X-Original-To: apmail-commons-user-archive@www.apache.org Delivered-To: apmail-commons-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3521C51BC for ; Tue, 10 May 2011 13:09:52 +0000 (UTC) Received: (qmail 9787 invoked by uid 500); 10 May 2011 13:09:51 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 9723 invoked by uid 500); 10 May 2011 13:09:50 -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 9700 invoked by uid 99); 10 May 2011 13:09:50 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 May 2011 13:09:50 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of rahul.akolkar@gmail.com designates 74.125.82.49 as permitted sender) Received: from [74.125.82.49] (HELO mail-ww0-f49.google.com) (74.125.82.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 10 May 2011 13:09:43 +0000 Received: by wwb39 with SMTP id 39so6186074wwb.6 for ; Tue, 10 May 2011 06:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=UyNPRsjOUUCLvv1Z+Pg4E09l+jfvsTL48jC232i4fEo=; b=xDT0+n4lPpkUZ/8R3h9ioM0Etfxp1pVDR6KdL0FIctFA46h9FhY0LP2RQuq+fKoRA3 MAfWP0r9VwJMfKncIqLe5Iv0lq00btcfzTUI0qzaN9utgCL8HxmZt043WX/RnOpaYgon O7wvlV4vi3oPaB94NgJnO671B3TM3NT8zZudc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=qe81wcNNSbvxgX4GywEsvs16WeX3ifDJhqJ1n1EKwF1/uhL9znWFWdxdbHPwvxF9Wf GPf8nfjs4MViFuWd3h9S2uOCrQHi0roSuxYwZ6657vi6gli3SDZhP2YXX7PEiOBanrh/ /Jns21/RpZ3WaQ307lHdRahltEXfTnHRIaURw= MIME-Version: 1.0 Received: by 10.216.59.81 with SMTP id r59mr1753103wec.40.1305032963445; Tue, 10 May 2011 06:09:23 -0700 (PDT) Received: by 10.216.186.66 with HTTP; Tue, 10 May 2011 06:09:23 -0700 (PDT) In-Reply-To: References: Date: Tue, 10 May 2011 09:09:23 -0400 Message-ID: Subject: Re: [scxml] Calling go() twice From: Rahul Akolkar To: Commons Users List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org On Tue, May 10, 2011 at 8:51 AM, Dario D wrote: > Rahul, in regards to triggering events, I am trying to trigger them from > within the workflow like this: > > =A0 =A0 > =A0 =A0 =A0 =A0 > =A0 =A0 > > =A0 =A0 > =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > =A0 =A0 > =A0 =A0 > =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > =A0 =A0 > > As you can see, I am trying to trigger an event from within "action1" sta= te > and then move to "action2". However, this does not happen and the log out= put > shows only "entering action1". If the event is being triggered, why the > transition does not take place? > I'll assume you're using JEXL given your previous post. If so, you'll need single quotes around the event name like so (its treated as an expression - spaces added below for readability): event=3D" 'testEvent' " If you pass in an application log, you'll see a warn level message to the effect of expression not resolving to a (non-empty) event name string. -Rahul > Thank you. > > 2011/5/3 Rahul Akolkar > >> On Tue, May 3, 2011 at 10:13 AM, Dario D wrote: >> > Thanks Jocke. How would you suggest to resume the the last state befor= e >> the >> > condition was not met? Let's say that the condition was made valid >> somehow. >> > How to resume from the last state? >> > >> > To continue the previous example: >> > >> > =A0 =A0 =A0 =A0try { >> > =A0 =A0 =A0 =A0 =A0 =A0exec.go(); >> > =A0 =A0 =A0 =A0 =A0 =A0// Execution stops at state2, condition is not = met >> > =A0 =A0 =A0 =A0 =A0 =A0// Condition is made valid through some means >> > =A0 =A0 =A0 =A0 =A0 =A0// How to resume? >> > =A0 =A0 =A0 =A0} catch (ModelException e) { >> > =A0 =A0 =A0 =A0 =A0 =A0e.printStackTrace(); >> > =A0 =A0 =A0 =A0} >> > >> >> >> Triggering events is here: >> >> =A0http://commons.apache.org/scxml/guide/core-events.html >> >> The main page for the user guide, which has more, is here: >> >> =A0http://commons.apache.org/scxml/guide.html >> >> If you're using EL, you've have to use the EL syntax for expressions, >> so rather than the following from your example ... >> >> =A0 >> >> ... the syntax will be like below: >> >> =A0 >> >> -Rahul >> >> >> > >> > 2011/5/3 jocke eriksson >> > >> >> =A0exec.go(); should only be called once. It will start the state >> >> machine and it will go through all steps that meets the criteria >> >> (event cond). >> >> >> >> Regards Jocke. >> >> >> >> 2011/5/3 Dario D : >> >> > Hello all, >> >> > >> >> > I've just started using SCXML and it's great. However, I've hit a >> brick >> >> wall >> >> > and I can't seem to figure out something. I have the following XML >> file: >> >> > >> >> > > >> > =A0 =A0 =A0 version=3D"1.0" >> >> > =A0 =A0 =A0 initialstate=3D"state1"> >> >> > >> >> > =A0 =A0 >> >> > =A0 =A0 =A0 =A0 >> >> > =A0 =A0 =A0 =A0 =A0 =A0 >> >> > =A0 =A0 =A0 =A0 >> >> > =A0 =A0 =A0 =A0 >> >> > =A0 =A0 >> >> > >> >> > =A0 =A0 >> >> > =A0 =A0 =A0 =A0 >> >> > =A0 =A0 =A0 =A0 =A0 =A0 >> >> > =A0 =A0 =A0 =A0 >> >> > =A0 =A0 =A0 =A0 >> >> > =A0 =A0 >> >> > >> >> > =A0 =A0 >> >> > =A0 =A0 =A0 =A0 >> >> > =A0 =A0 =A0 =A0 =A0 =A0 >> >> > =A0 =A0 =A0 =A0 >> >> > =A0 =A0 >> >> > >> >> > >> >> > >> >> > Now, I execute the state machine like this: >> >> > >> >> > =A0 =A0 =A0 =A0SCXMLExecutor exec =3D null; >> >> > =A0 =A0 =A0 =A0exec =3D new SCXMLExecutor(new ELEvaluator(), new >> >> SimpleDispatcher(), >> >> > new SimpleErrorReporter()); >> >> > =A0 =A0 =A0 =A0Context ctx =3D new ELContext(); >> >> > =A0 =A0 =A0 =A0exec.setRootContext(ctx); >> >> > =A0 =A0 =A0 =A0exec.setStateMachine(scxml); >> >> > =A0 =A0 =A0 =A0exec.setSuperStep(true); >> >> > =A0 =A0 =A0 =A0// Start execution >> >> > =A0 =A0 =A0 =A0try { >> >> > =A0 =A0 =A0 =A0 =A0 =A0exec.go(); >> >> > =A0 =A0 =A0 =A0 =A0 =A0exec.go(); >> >> > =A0 =A0 =A0 =A0} catch (ModelException e) { >> >> > =A0 =A0 =A0 =A0 =A0 =A0e.printStackTrace(); >> >> > =A0 =A0 =A0 =A0} >> >> > >> >> > As you can see I call exec.go() two times. I would expect that in t= he >> >> first >> >> > time, the state machine will stop in the "state2" state and remain >> there, >> >> > because condition is not satisfied for going into "state3". However= , >> when >> >> > exec.go() is called the second time, it goes from the start. >> Effectively, >> >> it >> >> > acts as exec.reset()? Following output is provided: >> >> > >> >> > =A0 =A0 =A0 =A003.05.2011. 14:01:32 org.apache.commons.scxml.model.= Log execute >> >> > =A0 =A0 =A0 =A0INFO: null: State 1 >> >> > =A0 =A0 =A0 =A003.05.2011. 14:01:32 org.apache.commons.scxml.model.= Log execute >> >> > =A0 =A0 =A0 =A0INFO: null: State 2 >> >> > =A0 =A0 =A0 =A003.05.2011. 14:01:32 org.apache.commons.scxml.model.= Log execute >> >> > =A0 =A0 =A0 =A0INFO: null: State 1 >> >> > =A0 =A0 =A0 =A003.05.2011. 14:01:32 org.apache.commons.scxml.model.= Log execute >> >> > =A0 =A0 =A0 =A0INFO: null: State 2 >> >> > >> >> > Could you explain this behavior? >> >> > >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org >> For additional commands, e-mail: user-help@commons.apache.org >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org