Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 84433 invoked from network); 7 Jan 2005 10:17:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 7 Jan 2005 10:17:03 -0000 Received: (qmail 24226 invoked by uid 500); 7 Jan 2005 10:17:00 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 24168 invoked by uid 500); 7 Jan 2005 10:17:00 -0000 Mailing-List: contact dev-help@cocoon.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: list-post: Reply-To: dev@cocoon.apache.org Delivered-To: mailing list dev@cocoon.apache.org Received: (qmail 24153 invoked by uid 99); 7 Jan 2005 10:17:00 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from v07274.home.net.pl (HELO v07274.home.net.pl) (212.85.125.162) by apache.org (qpsmtpd/0.28) with SMTP; Fri, 07 Jan 2005 02:16:58 -0800 Received: from sj162.internetdsl.tpnet.pl (HELO ?192.168.1.62?) (lgawron.mobilebox@home@80.55.87.162) by matrix15.home.net.pl with SMTP; 7 Jan 2005 10:16:52 -0000 Message-ID: <41DE6196.8000204@mobilebox.pl> Date: Fri, 07 Jan 2005 11:16:54 +0100 From: Leszek Gawron User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: [RT] Pre- and Postfunctions in FlowScript? References: <001501c4f49e$23e84050$7a020a0a@HW0441> In-Reply-To: <001501c4f49e$23e84050$7a020a0a@HW0441> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Jens Maukisch wrote: > Hi, > > I recently thought about if it would be useful to > have pre- and postfunctions in FlowScript which are > excecuted before and after a normal flow-function. > > The reason was that we needed some components in > every flow-function and it was not so nice to get > and release the components in each functions. > > Something like this: > > flow.js: > > var comp1; > var comp2; > > function preFunc() { > comp1 = cocoon.getComponent("comp1"); > comp2 = cocoon.getComponent("comp2"); > } > > function myFlowFunction1() { > comp1.doSomething(); > comp2.doSomething(); > } > > function myFlowFunction2() { > comp1.doIt(); > comp2.soIt(); > } > > function postFunc() { > cocoon.releaseComponent(comp1); > cocoon.releaseComponent(comp2); > } > > sitemap: > > > > > > > > This would call: > preFunc(); > myFlowFunction(); > postFunc(); > > I was wondering if it would be safe to use the 'global' vars > comp1 and comp2 e.g. if a user has tow parallel requests > (race conditions?)? > > This is just a basic thought and I'm not sure if it causes > more problems than it solves. :-) > There is a cocoon block with intercepted flowscript that was supposed to do a functionality similar to what you describe. I am not aware of current state of this block though. -- Leszek Gawron lgawron@mobilebox.pl Project Manager MobileBox sp. z o.o. +48 (61) 855 06 67 http://www.mobilebox.pl mobile: +48 (501) 720 812 fax: +48 (61) 853 29 65