You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by sy...@apache.org on 2005/10/03 13:06:03 UTC

svn commit: r293304 - /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/PartSourceFactory.java

Author: sylvain
Date: Mon Oct  3 04:05:59 2005
New Revision: 293304

URL: http://svn.apache.org/viewcvs?rev=293304&view=rev
Log:
Make ThreadSafe

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/PartSourceFactory.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/PartSourceFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/PartSourceFactory.java?rev=293304&r1=293303&r2=293304&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/PartSourceFactory.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/source/impl/PartSourceFactory.java Mon Oct  3 04:05:59 2005
@@ -15,8 +15,10 @@
  */
 package org.apache.cocoon.components.source.impl;
 
+import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.ContextException;
 import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.cocoon.components.ContextHelper;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceFactory;
@@ -29,22 +31,24 @@
  * A factory for {@link org.apache.cocoon.servlet.multipart.Part} based sources (see {@link PartSource}).
  *
  * @author <a href="mailto:paul.crabtree@dna.co.uk">Paul Crabtree</a>
+ * @version $Id$
  */
-public class PartSourceFactory implements SourceFactory, Contextualizable
+public class PartSourceFactory implements SourceFactory, Contextualizable, ThreadSafe
 {
-	Map objectModel;
+    Context context;
     
     /*
-	 * Returns a new {@link PartSource} based on the uri.
-	 *
-	 * @see org.apache.excalibur.source.SourceFactory#getSource(java.lang.String, java.util.Map)
-	 */
+     * 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, this.objectModel);
+        Map objectModel = ContextHelper.getObjectModel(context);
+        return new PartSource(uri, objectModel);
     }
 
-	/**
+    /**
      * Do nothing, {@link PartSource}s don't need to be released.
      *
      * @see org.apache.excalibur.source.SourceFactory#release(org.apache.excalibur.source.Source)
@@ -54,11 +58,11 @@
         // 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);
+         this.context = context;
     }
 }