You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/09/14 11:49:42 UTC

svn commit: r280810 - in /cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor: InvokeContext.java sitemap/PipelineNode.java

Author: cziegeler
Date: Wed Sep 14 02:49:38 2005
New Revision: 280810

URL: http://svn.apache.org/viewcvs?rev=280810&view=rev
Log:
Create pipeline only if it is used

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java?rev=280810&r1=280809&r2=280810&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/InvokeContext.java Wed Sep 14 02:49:38 2005
@@ -25,6 +25,7 @@
 import org.apache.cocoon.components.pipeline.ProcessingPipeline;
 import org.apache.cocoon.components.treeprocessor.variables.VariableResolver;
 import org.apache.cocoon.environment.Redirector;
+import org.apache.cocoon.sitemap.SitemapErrorHandler;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -83,6 +84,8 @@
     /** The ProcessingPipeline used */
     protected ProcessingPipeline processingPipeline;
 
+    /** The error handler for the pipeline. */
+    protected SitemapErrorHandler errorHandler;
 
     /**
      * Create an <code>InvokeContext</code> without existing pipelines. This also means
@@ -129,14 +132,6 @@
     public void inform(String pipelineName,
                        Map    parameters,
                        Map    objectModel) {
-        // FIXME quick fix to get pipeline section running again
-        if ( this.processingPipeline != null ) {
-            this.pipelineSelector.release(this.processingPipeline);
-            this.pipelinesManager.release(this.pipelineSelector);
-            this.pipelineSelector = null;
-            this.pipelinesManager = null;
-            this.processingPipeline = null;
-        }
         this.processingPipelineName = pipelineName;
         this.processingPipelineParameters = parameters;
         this.processingPipelineObjectModel = objectModel;
@@ -164,6 +159,7 @@
                                                                        this.processingPipeline,
                                                                        this.pipelinesManager);
             }
+            this.processingPipeline.setErrorHandler(this.errorHandler);
         }
         return this.processingPipeline;
     }
@@ -293,6 +289,15 @@
             this.processingPipelineName = null;
             this.processingPipelineParameters = null;
             this.processingPipelineObjectModel = null;
+
+            this.errorHandler = null;
         }
+    }
+
+    /**
+     * Set the error handler for the pipeline.
+     */
+    public void setErrorHandler(SitemapErrorHandler handler) {
+        this.errorHandler = handler;
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java?rev=280810&r1=280809&r2=280810&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java (original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java Wed Sep 14 02:49:38 2005
@@ -132,11 +132,11 @@
         try {
             if (this.errorHandlerHelper.isInternal()) {
                 // Set internal error handler in the pipeline
-                context.getProcessingPipeline().setErrorHandler(
+                context.setErrorHandler(
                         new SitemapErrorHandler(this.errorHandlerHelper, env, context));
             } else {
                 // Reset internal error handler (previous pipeline might had set it) 
-                context.getProcessingPipeline().setErrorHandler(null);
+                context.setErrorHandler(null);
             }
 
             if (invokeNodes(children, env, context)) {