You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by ni...@apache.org on 2004/09/22 17:53:42 UTC

svn commit: rev 47056 - in cocoon/branches/BRANCH_2_1_X: . src/java/org/apache/cocoon/components/treeprocessor/sitemap

Author: nicolaken
Date: Wed Sep 22 08:53:39 2004
New Revision: 47056

Modified:
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java
   cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java
   cocoon/branches/BRANCH_2_1_X/status.xml
Log:
Synch pass-through mount atttribute with trunk

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java	Wed Sep 22 08:53:39 2004
@@ -57,14 +57,22 @@
     /** The component manager to be used by the mounted processor */
     private ComponentManager manager;
 
+    /** The value of the 'pass-through' attribute */
+    private final boolean passThrough;
+        
+    /** The  key to get the pass_through value fron the Environment*/
+    protected final static String COCOON_PASS_THROUGH = new String("COCOON_PASS_THROUGH");    
+        
     public MountNode(VariableResolver prefix, 
                      VariableResolver source, 
                      TreeProcessor parentProcessor,
-                     boolean checkReload) {
+                     boolean checkReload,
+                     boolean passThrough) {
         this.prefix = prefix;
         this.source = source;
         this.parentProcessor = parentProcessor;
         this.checkReload = checkReload;
+        this.passThrough = passThrough;
     }
 
     public void compose(ComponentManager manager) throws ComponentException {
@@ -74,7 +82,10 @@
     public final boolean invoke(Environment env, InvokeContext context)
       throws Exception {
 
-        Map objectModel = env.getObjectModel();
+        Object previousPassThrough = env.getAttribute(COCOON_PASS_THROUGH);
+        env.setAttribute(COCOON_PASS_THROUGH,new Boolean(passThrough));
+        
+        final Map objectModel = env.getObjectModel();
 
         String resolvedSource = this.source.resolve(context, objectModel);
         String resolvedPrefix = this.prefix.resolve(context, objectModel);
@@ -107,7 +118,11 @@
         } finally {
             // Restore context
             env.setContext(oldPrefix, oldURI, oldContext);
-
+            if(previousPassThrough != null){
+               env.setAttribute(COCOON_PASS_THROUGH,previousPassThrough);
+            }else{
+               env.removeAttribute(COCOON_PASS_THROUGH);
+            }    
             // Turning recomposing as a test, according to:
             // http://marc.theaimsgroup.com/?t=106802211400005&r=1&w=2
             // Recompose pipelines which may have been recomposed by subsitemap

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNodeBuilder.java	Wed Sep 22 08:53:39 2004
@@ -40,7 +40,8 @@
             VariableResolverFactory.getResolver(config.getAttribute("uri-prefix"), manager),
             VariableResolverFactory.getResolver(config.getAttribute("src"), manager),
             this.treeBuilder.getProcessor().getWrappingProcessor(),
-            config.getAttributeAsBoolean("check-reload", true)
+            config.getAttributeAsBoolean("check-reload", true),
+            config.getAttributeAsBoolean("pass-through", false)
         );
         return (this.treeBuilder.setupNode(node, config));
     }

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/treeprocessor/sitemap/PipelineNode.java
==============================================================================
--- 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 22 08:53:39 2004
@@ -26,6 +26,7 @@
 import org.apache.cocoon.components.treeprocessor.InvokeContext;
 import org.apache.cocoon.components.treeprocessor.ParameterizableProcessingNode;
 import org.apache.cocoon.components.treeprocessor.ProcessingNode;
+import org.apache.cocoon.components.treeprocessor.sitemap.MountNode;
 import org.apache.cocoon.environment.Environment;
 
 /**
@@ -36,7 +37,7 @@
  * @author <a href="mailto:sylvain@apache.org">Sylvain Wallez</a>
  * @author <a href="mailto:gianugo@apache.org">Gianugo Rabellino</a>
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
- * @version CVS $Id: PipelineNode.java,v 1.15 2004/03/18 15:08:13 cziegeler Exp $
+ * @version CVS $Id$
  */
 public class PipelineNode
         extends AbstractParentProcessingNode
@@ -114,6 +115,17 @@
     public final boolean invoke(Environment env, InvokeContext context)
             throws Exception {
 
+        boolean passThrough;
+
+        Object passThroughRaw = env.getAttribute(MountNode.COCOON_PASS_THROUGH);
+       
+        if(passThroughRaw == null){
+            //use legacy default value
+            passThrough = false;
+        }else{
+            passThrough = ((Boolean)passThroughRaw).booleanValue() ;
+        }
+        
         boolean externalRequest = env.isExternal();
 
         // Always fail on external request if pipeline is internal only.
@@ -125,7 +137,7 @@
         try {
             if (invokeNodes(children, env, context)) {
                 return true;
-            } else if (!this.isLast) {
+            } else if (!this.isLast || passThrough) {
                 return false;
             } else {
                 throw new ResourceNotFoundException(

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml	(original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml	Wed Sep 22 08:53:39 2004
@@ -229,6 +229,13 @@
      accepts application/xhtml+xml and HTML otherwise; potentially do
      automatic i18n according to the accept-language header.
    </action>
+   <action dev="NKB" type="add">
+     New @pass-through attribute for the sitemap mount node.
+     If true, processing will resume in the base sitemap just after the mount node
+     if the mounted sitemap has not already generated output (usually if no match 
+     is found). Previous behaviour was always to throw a ResourceNotFoundException.
+     The attribute defaults to "false" for backwards compatibility.
+   </action>
    <action dev="CZ" type="add">
      Portal block: New Group Based Profile Manager.
    </action>