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/08/13 19:26:52 UTC

svn commit: r232509 - in /cocoon: blocks/profiler/trunk/java/org/apache/cocoon/components/profiler/ blocks/profiler/trunk/java/org/apache/cocoon/profiler/ blocks/profiler/trunk/java/org/apache/cocoon/profiler/debugging/ trunk/src/java/org/apache/cocoon...

Author: cziegeler
Date: Sat Aug 13 10:26:07 2005
New Revision: 232509

URL: http://svn.apache.org/viewcvs?rev=232509&view=rev
Log:
Add mount and redirect to executor, move simple executor into own package

Added:
    cocoon/blocks/profiler/trunk/java/org/apache/cocoon/profiler/
    cocoon/blocks/profiler/trunk/java/org/apache/cocoon/profiler/debugging/
    cocoon/blocks/profiler/trunk/java/org/apache/cocoon/profiler/debugging/SimpleSitemapExecutor.java
      - copied, changed from r232503, cocoon/blocks/profiler/trunk/java/org/apache/cocoon/components/profiler/SimpleSitemapExecutor.java
Removed:
    cocoon/blocks/profiler/trunk/java/org/apache/cocoon/components/profiler/SimpleSitemapExecutor.java
Modified:
    cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
    cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/RedirectToURINode.java
    cocoon/trunk/src/java/org/apache/cocoon/sitemap/SitemapExecutor.java

Copied: cocoon/blocks/profiler/trunk/java/org/apache/cocoon/profiler/debugging/SimpleSitemapExecutor.java (from r232503, cocoon/blocks/profiler/trunk/java/org/apache/cocoon/components/profiler/SimpleSitemapExecutor.java)
URL: http://svn.apache.org/viewcvs/cocoon/blocks/profiler/trunk/java/org/apache/cocoon/profiler/debugging/SimpleSitemapExecutor.java?p2=cocoon/blocks/profiler/trunk/java/org/apache/cocoon/profiler/debugging/SimpleSitemapExecutor.java&p1=cocoon/blocks/profiler/trunk/java/org/apache/cocoon/components/profiler/SimpleSitemapExecutor.java&r1=232503&r2=232509&rev=232509&view=diff
==============================================================================
--- cocoon/blocks/profiler/trunk/java/org/apache/cocoon/components/profiler/SimpleSitemapExecutor.java (original)
+++ cocoon/blocks/profiler/trunk/java/org/apache/cocoon/profiler/debugging/SimpleSitemapExecutor.java Sat Aug 13 10:26:07 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 2004-2005 The Apache Software Foundation.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package org.apache.cocoon.components.profiler;
+package org.apache.cocoon.profiler.debugging;
 
 import java.util.Iterator;
 import java.util.Map;
@@ -36,13 +36,13 @@
  * Sample sitemap executor that prints out everything to a logger
  * 
  * @since 2.2
- * @version CVS $Id: SimpleSitemapExecutor.java,v 1.5 2004/07/14 13:17:45 cziegeler Exp $
+ * @version CVS $Id$
  */
 public class SimpleSitemapExecutor 
     extends AbstractLogEnabled
     implements ThreadSafe, SitemapExecutor {
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.sitemap.SitemapExecutor#invokeAction(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.acting.Action, org.apache.cocoon.environment.Redirector, org.apache.cocoon.environment.SourceResolver, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
      */
     public Map invokeAction(final ExecutionContext context,
@@ -64,7 +64,7 @@
         return result;
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.sitemap.SitemapExecutor#invokeMatcher(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.matching.Matcher, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
      */
     public Map invokeMatcher(ExecutionContext context, 
@@ -84,7 +84,7 @@
         return result;
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.sitemap.SitemapExecutor#invokePreparableMatcher(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.matching.PreparableMatcher, java.lang.Object, org.apache.avalon.framework.parameters.Parameters)
      */
     public Map invokePreparableMatcher(ExecutionContext  context,
@@ -104,7 +104,7 @@
         return result;
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.sitemap.SitemapExecutor#invokeSelector(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.selection.Selector, java.lang.String, org.apache.avalon.framework.parameters.Parameters)
      */
     public boolean invokeSelector(ExecutionContext context, Map objectModel,
@@ -120,7 +120,7 @@
         return result;
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.sitemap.SitemapExecutor#invokeSwitchSelector(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.selection.SwitchSelector, java.lang.String, org.apache.avalon.framework.parameters.Parameters, java.lang.Object)
      */
     public boolean invokeSwitchSelector(ExecutionContext context,
@@ -137,7 +137,7 @@
         return result;
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.sitemap.SitemapExecutor#popVariables(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map)
      */
     public void popVariables(ExecutionContext context,
@@ -145,7 +145,7 @@
         this.getLogger().info("- Variable Context ends");
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.sitemap.SitemapExecutor#pushVariables(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, java.lang.String, java.util.Map)
      */
     public Map pushVariables(ExecutionContext context, 
@@ -159,8 +159,8 @@
         }
         return variables;
     }
-    
-    /* (non-Javadoc)
+
+    /**
      * @see org.apache.cocoon.sitemap.SitemapExecutor#enterSitemap(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, java.lang.String)
      */
     public String enterSitemap(ExecutionContext context, 
@@ -170,7 +170,7 @@
         return source;
     }
 
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.sitemap.SitemapExecutor#addGenerator(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.sitemap.SitemapExecutor.PipelineComponentDescription)
      */
     public PipelineComponentDescription addGenerator(ExecutionContext context,
@@ -180,7 +180,7 @@
         return desc;
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.sitemap.SitemapExecutor#addReader(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.sitemap.SitemapExecutor.PipelineComponentDescription)
      */
     public PipelineComponentDescription addReader(ExecutionContext context,
@@ -190,7 +190,7 @@
         return desc;
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.sitemap.SitemapExecutor#addSerializer(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.sitemap.SitemapExecutor.PipelineComponentDescription)
      */
     public PipelineComponentDescription addSerializer(ExecutionContext context,
@@ -200,7 +200,7 @@
         return desc;
     }
     
-    /* (non-Javadoc)
+    /**
      * @see org.apache.cocoon.sitemap.SitemapExecutor#addTransformer(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, org.apache.cocoon.sitemap.SitemapExecutor.PipelineComponentDescription)
      */
     public PipelineComponentDescription addTransformer(
@@ -210,5 +210,21 @@
                 context.getLocation() + ").");
         return desc;
     }
+
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#leaveSitemap(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map)
+     */
+    public void leaveSitemap(ExecutionContext context, Map objectModel) {
+        this.getLogger().info("- Leaving sitemap");
+    }
+
+    /**
+     * @see org.apache.cocoon.sitemap.SitemapExecutor#redirectTo(org.apache.cocoon.sitemap.ExecutionContext, java.util.Map, java.lang.String, boolean, boolean, boolean)
+     */
+    public String redirectTo(ExecutionContext context, Map objectModel, String uri, boolean createSession, boolean global, boolean permanent) {
+        this.getLogger().info("- Redirecting to " + uri);
+        return uri;
+    }
+
 }
 

Modified: cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java?rev=232509&r1=232508&r2=232509&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/MountNode.java Sat Aug 13 10:26:07 2005
@@ -118,6 +118,7 @@
                 env.removeAttribute(COCOON_PASS_THROUGH);
             }
 
+            this.executor.leaveSitemap(this, objectModel);
             // 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/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/RedirectToURINode.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/RedirectToURINode.java?rev=232509&r1=232508&r2=232509&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/RedirectToURINode.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/components/treeprocessor/sitemap/RedirectToURINode.java Sat Aug 13 10:26:07 2005
@@ -60,6 +60,12 @@
             getLogger().info("Redirecting to '" + resolvedURI + "' at " + this.getLocation());
         }
 
+        resolvedURI = this.executor.redirectTo(this,
+                                               env.getObjectModel(),
+                                               resolvedURI,
+                                               this.createSession,
+                                               this.global,
+                                               this.permanent);
         final Redirector redirector = context.getRedirector();
 
         if( this.global ) {

Modified: cocoon/trunk/src/java/org/apache/cocoon/sitemap/SitemapExecutor.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/sitemap/SitemapExecutor.java?rev=232509&r1=232508&r2=232509&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/sitemap/SitemapExecutor.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/sitemap/SitemapExecutor.java Sat Aug 13 10:26:07 2005
@@ -36,7 +36,7 @@
  * TODO - we should add invocation of a Redirector as well
  * 
  * @since 2.2
- * @version CVS $Id: SitemapExecutor.java,v 1.6 2004/07/14 13:17:45 cziegeler Exp $
+ * @version CVS $Id$
  */
 public interface SitemapExecutor {
     
@@ -151,6 +151,12 @@
                         String           source);
 
     /**
+     * Leaves a sitemap.
+     */
+    void leaveSitemap(ExecutionContext context,
+                      Map              objectModel);
+
+    /**
      * Add a generator
      * @param context
      * @param objectModel
@@ -193,4 +199,16 @@
     PipelineComponentDescription addReader(ExecutionContext context, 
                                            Map              objectModel,
                                            PipelineComponentDescription desc);
+
+    /**
+     * Informs about a redirect.
+     * @return The uri to redirect to.
+     */
+    String redirectTo(ExecutionContext context,
+                      Map              objectModel,
+                      String           uri,
+                      boolean          createSession,
+                      boolean          global,
+                      boolean          permanent);
+    
 }