Return-Path: Delivered-To: apmail-cocoon-cvs-archive@www.apache.org Received: (qmail 3422 invoked from network); 25 Oct 2003 22:31:41 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 25 Oct 2003 22:31:41 -0000 Received: (qmail 13994 invoked by uid 500); 25 Oct 2003 22:31:27 -0000 Delivered-To: apmail-cocoon-cvs-archive@cocoon.apache.org Received: (qmail 13840 invoked by uid 500); 25 Oct 2003 22:31:26 -0000 Mailing-List: contact cvs-help@cocoon.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@cocoon.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list cvs@cocoon.apache.org Received: (qmail 13829 invoked by uid 500); 25 Oct 2003 22:31:26 -0000 Delivered-To: apmail-cocoon-2.1-cvs@apache.org Received: (qmail 13826 invoked from network); 25 Oct 2003 22:31:26 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 25 Oct 2003 22:31:26 -0000 Received: (qmail 3343 invoked by uid 1647); 25 Oct 2003 22:31:39 -0000 Date: 25 Oct 2003 22:31:39 -0000 Message-ID: <20031025223139.3342.qmail@minotaur.apache.org> From: ghoward@apache.org To: cocoon-2.1-cvs@apache.org Subject: cvs commit: cocoon-2.1/src/java/org/apache/cocoon/components/source/impl PartSource.java PartSourceFactory.java 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 ghoward 2003/10/25 15:31:39 Modified: src/java/org/apache/cocoon/components/source/impl PartSource.java PartSourceFactory.java Log: use contextualize instead of static CocoonComponentManager.getCurrentEnvironment() Revision Changes Path 1.2 +2 -7 cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/PartSource.java Index: PartSource.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/PartSource.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PartSource.java 23 Oct 2003 01:45:34 -0000 1.1 +++ PartSource.java 25 Oct 2003 22:31:39 -0000 1.2 @@ -58,8 +58,6 @@ import org.apache.cocoon.servlet.multipart.Part; import org.apache.cocoon.environment.ObjectModelHelper; import org.apache.cocoon.environment.Request; -import org.apache.cocoon.components.CocoonComponentManager; - import java.net.MalformedURLException; import java.util.Map; import java.io.IOException; @@ -91,7 +89,7 @@ * @throws SourceException * @throws MalformedURLException */ - public PartSource(String uri) throws MalformedURLException, SourceException + public PartSource(String uri, Map objectModel) throws MalformedURLException, SourceException { // set the uri for use in getURI() this.uri = uri; @@ -110,9 +108,6 @@ // get the request parameter name: the bit after :// String location = uri.substring(position + 2); - - // get the object model from the component managers curr env. - Map objectModel = CocoonComponentManager.getCurrentEnvironment().getObjectModel(); // get the cocoon request from the object model. Request request = ObjectModelHelper.getRequest(objectModel); 1.2 +16 -3 cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/PartSourceFactory.java Index: PartSourceFactory.java =================================================================== RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/components/source/impl/PartSourceFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- PartSourceFactory.java 23 Oct 2003 01:45:34 -0000 1.1 +++ PartSourceFactory.java 25 Oct 2003 22:31:39 -0000 1.2 @@ -50,6 +50,9 @@ */ package org.apache.cocoon.components.source.impl; +import org.apache.avalon.framework.context.ContextException; +import org.apache.avalon.framework.context.Contextualizable; +import org.apache.cocoon.components.ContextHelper; import org.apache.excalibur.source.Source; import org.apache.excalibur.source.SourceFactory; @@ -62,16 +65,18 @@ * * @author Paul Crabtree */ -public class PartSourceFactory implements SourceFactory +public class PartSourceFactory implements SourceFactory, Contextualizable { - /* + Map objectModel; + + /* * Returns a new {@link PartSource} based on the uri. * * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map) */ public Source getSource(String uri, Map parameters) throws IOException, MalformedURLException { - return new PartSource(uri); + return new PartSource(uri, this.objectModel); } /** @@ -82,5 +87,13 @@ public void release(Source source) { // Nothing to do here + } + + /** + * Get the objectModel from the Context + */ + public void contextualize(org.apache.avalon.framework.context.Context context) + throws ContextException { + this.objectModel = ContextHelper.getObjectModel(context); } }