Return-Path: Delivered-To: apmail-commons-user-archive@www.apache.org Received: (qmail 89138 invoked from network); 6 May 2010 16:53:24 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 6 May 2010 16:53:24 -0000 Received: (qmail 80993 invoked by uid 500); 6 May 2010 16:53:23 -0000 Delivered-To: apmail-commons-user-archive@commons.apache.org Received: (qmail 80918 invoked by uid 500); 6 May 2010 16:53:23 -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 80909 invoked by uid 99); 6 May 2010 16:53:23 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 May 2010 16:53:23 +0000 X-ASF-Spam-Status: No, hits=-0.4 required=10.0 tests=AWL,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of rahul.akolkar@gmail.com designates 209.85.212.43 as permitted sender) Received: from [209.85.212.43] (HELO mail-vw0-f43.google.com) (209.85.212.43) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 May 2010 16:53:17 +0000 Received: by vws5 with SMTP id 5so151622vws.30 for ; Thu, 06 May 2010 09:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=0z2tIYcRcoEvU8RTTI48Sbs+5xscRFwrBMJAqlq192Y=; b=wYAaHuBY8vs8MMF0ekRC0+KP3R3qfR92W97uGf8XwPDQW6quVK2vccR6vyfkDXvA8v vkhZKxsEmR5nYeXps0tRpeARdGV4DExYI5pt2AgfeyPGXPXgRpp8H58L67RRyb6F4+A+ SyCO/gx+TqLz05WKLufFOxbuoW5V8uPYA5sOY= 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=EJALe34jn2UMGQoabsSgwH1H5SNYVTuyePiYByS+U8e+Ib+5Pa3XX2zLo+MaJ183+o lNdvMU/Ccsz6XmyTVMbmA/Z+xD+TXULeAffoF7Z2oeiG6ccnYfgs9cJ03ubjzXXNoiPJ KojLHSAEXfEVMACMxeXShkNeWYhvmG4ZVzdgI= MIME-Version: 1.0 Received: by 10.220.108.79 with SMTP id e15mr2367958vcp.21.1273164776253; Thu, 06 May 2010 09:52:56 -0700 (PDT) Received: by 10.220.77.161 with HTTP; Thu, 6 May 2010 09:52:56 -0700 (PDT) In-Reply-To: References: Date: Thu, 6 May 2010 12:52:56 -0400 Message-ID: Subject: Re: [scxml] templating/src/xinclude and returning a value(through datamodel/donedata) From: Rahul Akolkar To: Commons Users List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Thu, May 6, 2010 at 11:34 AM, Fabrizio Morbini wrot= e: > Hi, i'm experimenting with the src attribute to reuse fsm. I'm having > some trouble with returning a value from an included fsm to the > calling state. > > I'm using this description at > http://shale.apache.org/shale-dialog-scxml/index.html, in particular > the section about subdialogs from which it seems possible to return a > value from an included scxml fsm. > However i have been unable to do so. I've tried several variants but > none with the expected outcome. The Commons SCXML v0.9 release does not use a flat / global datamodel by default, therefore the value would need to be copied up to a datamodel with a superior position in the states topology (such as document root to be available across any other state). I will outline this approach using your example below. Alternatively, provide the SCXMLExecutor with a custom Evaluator implementation that returns the same context (the root context) on every Evaluator#newContext() call to obtain a flat datamodel. If you do this, there would be no changes required to the example below. Now, for the first approach with the default cascading datamodel, see below= : > Here is the current variant: > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dfile a.scxml=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0xmlns:cs=3D"http://commons.apache.org/scxm= l" > =A0 =A0 =A0 version=3D"1.0" > =A0 =A0 =A0 profile=3D"ecmascript" > =A0 =A0 =A0 initial=3D"s1"> > > =A0 > =A0 > =A0 > =A0 =A0 Define a global 'aaa' variable here, say like so (note different case used here, i.e. chose a different name of choice): =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 > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dend of file a.scxml=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dfile b.scxml=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > xmlns:cs=3D"http://commons.apache.org/scxml" initial=3D"s111"> > =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 Change the above to point to the variable defined in the parent document above like so: =A0 =A0 =A0 =A0 Obviously, this would imply that b.scxml could only be executed when included in a.scxml since it references a datamodel variable in a.scxml. If that is not desired, the second approach i.e. the flat datamodel approach should be used. > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 > =A0 =A0 > > =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > =A0 =A0 =A0 =A0 > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3Dend of file b.scxml=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > > i tried to use also instead of a previously defined variable in > the datamodel, without success. > > the simple way would be to use the donedata in a final state in the > included fsm but it doesn't seem that donedata is supported, is this > correct? > Yes, not in v0.9, we will look to add it soon. You could open a JIRA issue as a reminder. > given that src is not going to be supported in the next standard, do > you have some pointer to examples/doc of how to use xinclude to do > what the src is supposed to do? > Don't have a ready example, but the idea is to pull in as much of the document as needs to be reused using XInclude. See XInclude specification for more details. It certain cases, the XInclude approach requires more work but is favored since its a standard way to do includes. -Rahul > thanks, > fabrizio. > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@commons.apache.org For additional commands, e-mail: user-help@commons.apache.org