Return-Path: Delivered-To: apmail-cocoon-dev-archive@www.apache.org Received: (qmail 49010 invoked from network); 27 Jan 2004 22:33:13 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 27 Jan 2004 22:33:13 -0000 Received: (qmail 74237 invoked by uid 500); 27 Jan 2004 22:32:55 -0000 Delivered-To: apmail-cocoon-dev-archive@cocoon.apache.org Received: (qmail 74182 invoked by uid 500); 27 Jan 2004 22:32:55 -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 74161 invoked from network); 27 Jan 2004 22:32:54 -0000 Received: from unknown (HELO postfix3-1.free.fr) (213.228.0.44) by daedalus.apache.org with SMTP; 27 Jan 2004 22:32:54 -0000 Received: from apache.org (nantes-2-62-147-44-64.dial.proxad.net [62.147.44.64]) by postfix3-1.free.fr (Postfix) with ESMTP id C6EE9C4130 for ; Tue, 27 Jan 2004 23:32:54 +0100 (CET) Message-ID: <4016E2BD.5040000@apache.org> Date: Tue, 27 Jan 2004 23:14:21 +0100 From: Sylvain Wallez User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007 X-Accept-Language: fr, en, en-us MIME-Version: 1.0 To: dev@cocoon.apache.org Subject: Re: source resolving in 2.2 References: <84F0A43A4248CE45B5C0E20F4C40779C600B49@naomi.webworks.nl> In-Reply-To: <84F0A43A4248CE45B5C0E20F4C40779C600B49@naomi.webworks.nl> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Unico Hommes wrote: >Carsten Ziegeler wrote: > > >>>I am currently trying to get act nodes to work and am have a question about the source resolving in 2.2. Currently the environment source resolver is put into the object model in the PipelinesNode. However, now that the environment no longer implements SourceResolver but appears to be implemented by EnvironmentHelper instead I no longer have access to it there. So, I was thinking whether we should move that logic into EnvironmentHelper.enterProcessor() / leaveProcessor() ? Does that make any sense to you? >>> >>> >>Ok, I never liked putting such objects into the object model as the om is available to all sitemap components and users *can* take those objects out of the om and use them. >>IMHO we should avoid putting any internal objects into the om or into the environment if possible. But that's only my personal opinion :) >> >> +1 ;-) Actually, I don't remember why I added it to the OM. It could have been better as an environment attribute, but actually this isn't even needed (see below). >>The Processor holds an EnvironmentHelper instance and each node can simply (and should) pass on this instance to a sitemap component. So, you can do a >>resolver = this.processor.getEnvironmentHelper(); >> >>in the ActNode (if this node has access to the processor). >>The pipeline implementation e.g. does it this way. >>If the ActNode doesn't have access to the processor, than there are two choices: >>a) Use the attributes of the environment or >>b) Use the new EnvironmentContext mechanism This allows to store arbitrary objects "at" the environment without directly adding them to the environment. This keeps the env. clear Perhaps this is FS or overdoing things, I don't know. Anyway, you can get an EnvironmentContext using a static method on the EnvironmentHelper getEnvironmentContext(Environment) and add/get attributes from there. >> >>Personally, I would prefer passing the processor to the act node as this is imho the cleanest but also the fastest solution (no lookup required during runtime). >> >> > >OK thanks. It looks like we had the same idea :-). I went ahead and implemented it the way you describe in option b) . I also added two static helper methods to EnvironmentHelper: getSourceResolver and getRedirector so we don't have to pass in the processor instance. > >If you find the time perhaps you can proof-read the changes? > > Two suggestions regarding sourceResolver and redirector: SourceResolver (the Cocoon one) is a legacy requirement because we can't change the interface of actions, generators, etc, and is used by the Processor (for Actions) and the pipelines (for SitemapModelComponents). Now since 2.1, the Excalibur resolver is available to every Serviceable component. So why don't we simply write a wrapper that implement the legacy interface around the looked-up excalibur resolver? That way, there's no need to store the legacy resolver neither in Environment nor EnvironmentHelper (and even less in the object model!) The Redirector is needed only within the Processor, so we can simply add it as a property of the InvokeContext. Again, no need to clutter other classes with processor-only concerns. WDYT? Sylvain -- Sylvain Wallez Anyware Technologies http://www.apache.org/~sylvain http://www.anyware-tech.com { XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects } Orixo, the opensource XML business alliance - http://www.orixo.com