cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r643396 - in /cocoon/whiteboard/corona/trunk: corona-core/src/main/java/org/apache/cocoon/corona/pipeline/ corona-core/src/main/java/org/apache/cocoon/corona/pipeline/action/ corona-core/src/main/java/org/apache/cocoon/corona/pipeline/compo...
Date Tue, 01 Apr 2008 13:42:16 GMT
Author: reinhard
Date: Tue Apr  1 06:42:01 2008
New Revision: 643396

URL: http://svn.apache.org/viewvc?rev=643396&view=rev
Log:
refactor Sitemap-specific Invocation so that the pipeline API doesn't need it (source resolving
still needs to be moved to JNet)

Modified:
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/AbstractPipeline.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/CachingPipeline.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/Pipeline.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/action/Action.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/action/ErrorThrowingAction.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/CachingPipelineComponent.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileReaderComponent.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/RedirectorComponent.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/RequestParametersGenerator.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/Starter.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLSerializer.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ClassPathResourceResolver.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/HttpContextHelper.java
    cocoon/whiteboard/corona/trunk/corona-core/src/test/java/org/apache/cocoon/corona/pipeline/PipelineTest.java
    cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
    cocoon/whiteboard/corona/trunk/corona-servlet/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/AbstractPipeline.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/AbstractPipeline.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/AbstractPipeline.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/AbstractPipeline.java
Tue Apr  1 06:42:01 2008
@@ -18,9 +18,11 @@
  */
 package org.apache.cocoon.corona.pipeline;
 
+import java.io.OutputStream;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.Map;
 
 import org.apache.cocoon.corona.pipeline.action.Action;
 import org.apache.cocoon.corona.pipeline.component.Consumer;
@@ -28,7 +30,6 @@
 import org.apache.cocoon.corona.pipeline.component.PipelineComponent;
 import org.apache.cocoon.corona.pipeline.component.Producer;
 import org.apache.cocoon.corona.pipeline.component.Starter;
-import org.apache.cocoon.corona.sitemap.Invocation;
 
 public abstract class AbstractPipeline implements Pipeline {
 
@@ -38,7 +39,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.pipeline.Pipeline#addAction(org.apache.cocoon.corona.pipeline.action.Action)
      */
     public void addAction(Action action) {
@@ -47,7 +48,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.pipeline.Pipeline#addComponent(org.apache.cocoon.corona.pipeline.component.PipelineComponent)
      */
     public void addComponent(PipelineComponent pipelineComponent) {
@@ -56,31 +57,28 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * @see org.apache.cocoon.corona.pipeline.Pipeline#execute(org.apache.cocoon.corona.sitemap.InvocationImpl)
+     *
+     * @see org.apache.cocoon.corona.pipeline.Pipeline#execute(OutputStream)
      */
-    public void execute(Invocation invocation) throws Exception {
-        System.out.println("AbstractPipeline.execute(" + invocation.getRequestURI() + ")");
-
+    public void execute(Map<String, Object> parameters, OutputStream outputStream)
throws Exception {
         // execute the actions first
         for (Action action : this.actions) {
-            System.out.println(action + ".execute(" + invocation.getRequestURI() + ")");
-            action.execute(invocation);
+            action.execute(parameters);
         }
 
         // now setup the components
-        this.setupComponents(invocation);
+        this.setupComponents(outputStream);
 
         // and execute the Starter
         Starter starter = (Starter) this.components.getFirst();
-        starter.execute(invocation);
+        starter.execute(parameters);
     }
 
     protected LinkedList<PipelineComponent> getComponents() {
         return this.components;
     }
 
-    protected void setupComponents(Invocation invocation) {
+    protected void setupComponents(OutputStream outputStream) {
         PipelineComponent first = this.components.getFirst();
 
         // first component must be a Starter
@@ -107,7 +105,7 @@
         }
 
         // configure the finisher
-        ((Finisher) last).setOutputStream(invocation.getOutputStream());
+        ((Finisher) last).setOutputStream(outputStream);
     }
 
     private void linkComponents(PipelineComponent firstComponent, PipelineComponent secondComponent)
{

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/CachingPipeline.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/CachingPipeline.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/CachingPipeline.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/CachingPipeline.java
Tue Apr  1 06:42:01 2008
@@ -18,12 +18,15 @@
  */
 package org.apache.cocoon.corona.pipeline;
 
+import java.io.OutputStream;
+import java.util.Map;
+
+import org.apache.cocoon.corona.pipeline.caching.CacheKey;
+import org.apache.cocoon.corona.pipeline.caching.CacheValue;
 import org.apache.cocoon.corona.pipeline.caching.CachingOutputStream;
 import org.apache.cocoon.corona.pipeline.caching.CompleteCacheValue;
 import org.apache.cocoon.corona.pipeline.caching.CompoundCacheKey;
 import org.apache.cocoon.corona.pipeline.caching.PipelineCache;
-import org.apache.cocoon.corona.pipeline.caching.CacheKey;
-import org.apache.cocoon.corona.pipeline.caching.CacheValue;
 import org.apache.cocoon.corona.pipeline.component.CachingPipelineComponent;
 import org.apache.cocoon.corona.pipeline.component.PipelineComponent;
 import org.apache.cocoon.corona.sitemap.Invocation;
@@ -33,25 +36,22 @@
     private PipelineCache pipelineCache;
 
     @Override
-    public void execute(Invocation invocation) throws Exception {
+    public void execute(Map<String, Object> parameters, OutputStream outputStream)
throws Exception {
         // construct the current cache key
-        CacheKey cacheKey = this.constructCacheKey(invocation);
+        CacheKey cacheKey = this.constructCacheKey(parameters);
 
         // checked for a cached value first
         CacheValue cachedValue = this.getCachedValue(cacheKey);
         if (cachedValue != null) {
             // cached value found
-            cachedValue.writeTo(invocation.getOutputStream());
+            cachedValue.writeTo(outputStream);
             return;
         }
 
         // create a caching output stream to intercept the result
-        CachingOutputStream cachingOutputStream = new CachingOutputStream(invocation.getOutputStream());
-        invocation.setOutputStream(cachingOutputStream);
+        CachingOutputStream cachingOutputStream = new CachingOutputStream(outputStream);
         // execute the pipeline
-        super.execute(invocation);
-        // reset the output stream
-        invocation.setOutputStream(cachingOutputStream.getOutputStream());
+        super.execute(parameters, cachingOutputStream);
 
         this.pipelineCache.put(cacheKey, new CompleteCacheValue(cachingOutputStream.getContent()));
     }
@@ -60,14 +60,14 @@
         this.pipelineCache = pipelineCache;
     }
 
-    private CacheKey constructCacheKey(Invocation invocation) {
+    private CacheKey constructCacheKey(Map<String, Object> parameters) {
         CompoundCacheKey result = new CompoundCacheKey();
 
         for (PipelineComponent pipelineComponent : this.getComponents()) {
             if (pipelineComponent instanceof CachingPipelineComponent) {
                 CachingPipelineComponent cachablePipelineComponent = (CachingPipelineComponent)
pipelineComponent;
 
-                result.addCacheKey(cachablePipelineComponent.constructCacheKey(invocation));
+                result.addCacheKey(cachablePipelineComponent.constructCacheKey(parameters));
                 continue;
             }
 

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/Pipeline.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/Pipeline.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/Pipeline.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/Pipeline.java
Tue Apr  1 06:42:01 2008
@@ -18,9 +18,11 @@
  */
 package org.apache.cocoon.corona.pipeline;
 
+import java.io.OutputStream;
+import java.util.Map;
+
 import org.apache.cocoon.corona.pipeline.action.Action;
 import org.apache.cocoon.corona.pipeline.component.PipelineComponent;
-import org.apache.cocoon.corona.sitemap.Invocation;
 
 public interface Pipeline {
 
@@ -28,6 +30,6 @@
 
     void addComponent(PipelineComponent pipelineComponent);
 
-    void execute(Invocation invocation) throws Exception;
+    void execute(Map<String, Object> parameters, OutputStream outputStream) throws
Exception;
 
 }

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/action/Action.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/action/Action.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/action/Action.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/action/Action.java
Tue Apr  1 06:42:01 2008
@@ -18,9 +18,10 @@
  */
 package org.apache.cocoon.corona.pipeline.action;
 
-import org.apache.cocoon.corona.sitemap.Invocation;
+import java.util.Map;
+
 
 public interface Action {
 
-    void execute(Invocation invocation) throws Exception;
+    void execute(Map<String, Object> parameters) throws Exception;
 }

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/action/ErrorThrowingAction.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/action/ErrorThrowingAction.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/action/ErrorThrowingAction.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/action/ErrorThrowingAction.java
Tue Apr  1 06:42:01 2008
@@ -18,17 +18,18 @@
  */
 package org.apache.cocoon.corona.pipeline.action;
 
+import java.util.Map;
+
 import org.apache.cocoon.corona.sitemap.CustomException;
-import org.apache.cocoon.corona.sitemap.Invocation;
 
 public class ErrorThrowingAction implements Action {
 
     /**
      * {@inheritDoc}
      * 
-     * @see org.apache.cocoon.corona.pipeline.action.Action#execute(org.apache.cocoon.corona.sitemap.Invocation)
+     * @see org.apache.cocoon.corona.pipeline.action.Action#execute(Map)
      */
-    public void execute(Invocation invocation) throws Exception {
+    public void execute(Map<String, Object> parameters) throws Exception {
         throw new CustomException();
     }
 

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/CachingPipelineComponent.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/CachingPipelineComponent.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/CachingPipelineComponent.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/CachingPipelineComponent.java
Tue Apr  1 06:42:01 2008
@@ -18,10 +18,11 @@
  */
 package org.apache.cocoon.corona.pipeline.component;
 
+import java.util.Map;
+
 import org.apache.cocoon.corona.pipeline.caching.CacheKey;
-import org.apache.cocoon.corona.sitemap.Invocation;
 
 public interface CachingPipelineComponent {
 
-    CacheKey constructCacheKey(Invocation invocation);
+    CacheKey constructCacheKey(Map<String, ? extends Object> parameters);
 }

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileGenerator.java
Tue Apr  1 06:42:01 2008
@@ -26,7 +26,7 @@
 
 import org.apache.cocoon.corona.pipeline.caching.CacheKey;
 import org.apache.cocoon.corona.pipeline.caching.TimestampCacheKey;
-import org.apache.cocoon.corona.sitemap.Invocation;
+import org.apache.cocoon.corona.sitemap.resource.ClassPathResourceResolver;
 import org.xml.sax.InputSource;
 import org.xml.sax.XMLReader;
 import org.xml.sax.helpers.XMLReaderFactory;
@@ -37,11 +37,11 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * @see org.apache.cocoon.corona.pipeline.component.CachingPipelineComponent#constructCacheKey(org.apache.cocoon.corona.sitemap.Invocation)
+     *
+     * @see org.apache.cocoon.corona.pipeline.component.CachingPipelineComponent#constructCacheKey(Map)
      */
-    public CacheKey constructCacheKey(Invocation invocation) {
-        URL url = invocation.resolve(this.src);
+    public CacheKey constructCacheKey(Map<String, ? extends Object> parameters) {
+        URL url = ClassPathResourceResolver.getInstance().resolve(this.src);
         try {
             return new TimestampCacheKey(url, url.openConnection().getLastModified());
         } catch (IOException e) {
@@ -54,12 +54,12 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * @see org.apache.cocoon.corona.pipeline.component.Starter#execute(org.apache.cocoon.corona.sitemap.Invocation)
+     *
+     * @see org.apache.cocoon.corona.pipeline.component.Starter#execute(Map)
      */
-    public void execute(final Invocation invocation) {
+    public void execute(Map<String, ? extends Object> parameters) {
         // resolve the "src" parameter before using it
-        URL url = invocation.resolve(this.src);
+        URL url = ClassPathResourceResolver.getInstance().resolve(this.src);
         if (url == null) {
             // failed to resolve
             throw new IllegalArgumentException("FileGenerator cannot resolve source '" +
this.src + "'");
@@ -81,7 +81,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.pipeline.component.AbstractXMLProducer#setParameters(java.util.Map)
      */
     @Override

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileReaderComponent.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileReaderComponent.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileReaderComponent.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/FileReaderComponent.java
Tue Apr  1 06:42:01 2008
@@ -26,15 +26,15 @@
 
 import org.apache.cocoon.corona.pipeline.caching.CacheKey;
 import org.apache.cocoon.corona.pipeline.caching.TimestampCacheKey;
-import org.apache.cocoon.corona.sitemap.Invocation;
+import org.apache.cocoon.corona.sitemap.resource.ClassPathResourceResolver;
 
 public class FileReaderComponent implements Starter, Finisher, CachingPipelineComponent {
 
     private OutputStream outputStream;
     private String src;
 
-    public CacheKey constructCacheKey(Invocation invocation) {
-        URL url = invocation.resolve(this.src);
+    public CacheKey constructCacheKey(Map<String, ? extends Object> parameters) {
+        URL url = ClassPathResourceResolver.getInstance().resolve(this.src);
         try {
             return new TimestampCacheKey(url, url.openConnection().getLastModified());
         } catch (IOException e) {
@@ -47,12 +47,12 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * @see org.apache.cocoon.corona.pipeline.component.Starter#execute(org.apache.cocoon.corona.sitemap.Invocation)
+     *
+     * @see org.apache.cocoon.corona.pipeline.component.Starter#execute(Map)
      */
-    public void execute(Invocation invocation) {
+    public void execute(Map<String, ? extends Object> parameters) {
         try {
-            URL url = invocation.resolve(this.src);
+            URL url = ClassPathResourceResolver.getInstance().resolve(this.src);
             if (url == null) {
                 throw new IllegalArgumentException("FileReaderComponent could not resolve
'" + this.src + "'");
             }
@@ -77,7 +77,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.pipeline.component.Finisher#setOutputStream(java.io.OutputStream)
      */
     public void setOutputStream(OutputStream outputStream) {
@@ -86,7 +86,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.pipeline.component.PipelineComponent#setParameters(java.util.Map)
      */
     public void setParameters(Map<String, ? extends Object> parameters) {
@@ -95,7 +95,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see java.lang.Object#toString()
      */
     @Override

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/RedirectorComponent.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/RedirectorComponent.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/RedirectorComponent.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/RedirectorComponent.java
Tue Apr  1 06:42:01 2008
@@ -24,7 +24,6 @@
 
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.cocoon.corona.sitemap.Invocation;
 import org.apache.cocoon.corona.sitemap.util.HttpContextHelper;
 
 public class RedirectorComponent implements Starter, Finisher {
@@ -33,11 +32,11 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * @see org.apache.cocoon.corona.pipeline.component.Starter#execute(org.apache.cocoon.corona.sitemap.Invocation)
+     *
+     * @see org.apache.cocoon.corona.pipeline.component.Starter#execute(Map)
      */
-    public void execute(final Invocation invocation) {
-        HttpServletResponse response = HttpContextHelper.getResponse(invocation);
+    public void execute(Map<String, ? extends Object> parameters) {
+        HttpServletResponse response = HttpContextHelper.getResponse(parameters);
 
         try {
             String location = response.encodeRedirectURL(this.uri);
@@ -49,7 +48,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.pipeline.component.Finisher#setOutputStream(java.io.OutputStream)
      */
     public void setOutputStream(OutputStream outputStream) {
@@ -57,7 +56,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.pipeline.component.PipelineComponent#setParameters(java.util.Map)
      */
     public void setParameters(Map<String, ? extends Object> parameters) {
@@ -66,7 +65,7 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see java.lang.Object#toString()
      */
     @Override

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/RequestParametersGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/RequestParametersGenerator.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/RequestParametersGenerator.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/RequestParametersGenerator.java
Tue Apr  1 06:42:01 2008
@@ -19,10 +19,10 @@
 package org.apache.cocoon.corona.pipeline.component;
 
 import java.util.Enumeration;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.cocoon.corona.sitemap.Invocation;
 import org.apache.cocoon.corona.sitemap.InvocationException;
 import org.apache.cocoon.corona.sitemap.util.HttpContextHelper;
 import org.xml.sax.SAXException;
@@ -32,12 +32,12 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * @see org.apache.cocoon.corona.pipeline.component.Starter#execute(org.apache.cocoon.corona.sitemap.Invocation)
+     *
+     * @see org.apache.cocoon.corona.pipeline.component.Starter#execute(Map)
      */
     @SuppressWarnings("unchecked")
-    public void execute(Invocation invocation) {
-        HttpServletRequest request = HttpContextHelper.getRequest(invocation);
+    public void execute(Map<String, ? extends Object> parameters) {
+        HttpServletRequest request = HttpContextHelper.getRequest(parameters);
         Enumeration<String> parameterNames = request.getParameterNames();
 
         try {

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/Starter.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/Starter.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/Starter.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/Starter.java
Tue Apr  1 06:42:01 2008
@@ -18,9 +18,10 @@
  */
 package org.apache.cocoon.corona.pipeline.component;
 
-import org.apache.cocoon.corona.sitemap.Invocation;
+import java.util.Map;
+
 
 public interface Starter extends PipelineComponent {
 
-    void execute(Invocation invocation);
+    void execute(Map<String, ? extends Object> parameters);
 }

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLSerializer.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLSerializer.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLSerializer.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLSerializer.java
Tue Apr  1 06:42:01 2008
@@ -31,7 +31,6 @@
 
 import org.apache.cocoon.corona.pipeline.caching.CacheKey;
 import org.apache.cocoon.corona.pipeline.caching.SimpleCacheKey;
-import org.apache.cocoon.corona.sitemap.Invocation;
 import org.xml.sax.Attributes;
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
@@ -52,7 +51,7 @@
         this.transformerHandler.comment(ch, start, length);
     }
 
-    public CacheKey constructCacheKey(Invocation invocation) {
+    public CacheKey constructCacheKey(Map<String, ? extends Object> parameters) {
         return new SimpleCacheKey();
     }
 

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java
Tue Apr  1 06:42:01 2008
@@ -24,8 +24,6 @@
 
 public interface Invocation {
 
-    void addParameter(String key, Object value);
-
     void execute() throws Exception;
 
     OutputStream getOutputStream();

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
Tue Apr  1 06:42:01 2008
@@ -38,7 +38,7 @@
 
     private OutputStream outputStream;
 
-    private Map<String, Object> parameters;
+    private Map<String, Object> parameters = new HashMap<String, Object>();
 
     private Pipeline pipeline;
 
@@ -87,20 +87,6 @@
     /**
      * {@inheritDoc}
      *
-     * @see org.apache.cocoon.corona.sitemap.Invocation#addParameter(java.lang.String,
-     *      java.lang.Object)
-     */
-    public void addParameter(String key, Object value) {
-        if (this.parameters == null) {
-            this.parameters = new HashMap<String, Object>();
-        }
-
-        this.parameters.put(key, value);
-    }
-
-    /**
-     * {@inheritDoc}
-     *
      * @see org.apache.cocoon.corona.sitemap.Invocation#execute()
      */
     public void execute() throws Exception {
@@ -108,7 +94,7 @@
             throw new IllegalStateException("InvocationImpl has been executed without having
a pipeline.");
         }
 
-        this.pipeline.execute(this);
+        this.pipeline.execute(this.parameters, this.outputStream);
     }
 
     /**

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/node/SerializeNode.java
Tue Apr  1 06:42:01 2008
@@ -45,7 +45,7 @@
         invocation.installComponent(SERIALIZER_CATEGORY + this.type, this.getParameters());
 
         if (this.statusCode != null) {
-            HttpServletResponse response = HttpContextHelper.getResponse(invocation);
+            HttpServletResponse response = HttpContextHelper.getResponse(invocation.getParameters());
             if (response != null) {
                 response.setStatus(Integer.parseInt(this.statusCode));
             }

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ClassPathResourceResolver.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ClassPathResourceResolver.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ClassPathResourceResolver.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/resource/ClassPathResourceResolver.java
Tue Apr  1 06:42:01 2008
@@ -22,9 +22,11 @@
 
 public class ClassPathResourceResolver implements ResourceResolver {
 
+    private static final ClassPathResourceResolver INSTANCE = new ClassPathResourceResolver();
+
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.corona.sitemap.resource.ResourceResolver#resolve(java.lang.String)
      */
     public URL resolve(String resource) {
@@ -35,5 +37,9 @@
         }
 
         return url;
+    }
+
+    public static ResourceResolver getInstance() {
+        return INSTANCE;
     }
 }

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/HttpContextHelper.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/HttpContextHelper.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/HttpContextHelper.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/sitemap/util/HttpContextHelper.java
Tue Apr  1 06:42:01 2008
@@ -18,10 +18,11 @@
  */
 package org.apache.cocoon.corona.sitemap.util;
 
+import java.util.Map;
+
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.cocoon.corona.sitemap.Invocation;
 
 public class HttpContextHelper {
 
@@ -29,8 +30,8 @@
 
     private static final String HTTP_SERVLET_RESPONSE_KEY = HttpServletResponse.class.getName();
 
-    public static HttpServletRequest getRequest(Invocation invocation) {
-        Object parameter = invocation.getParameter(HTTP_SERVLET_REQUEST_KEY);
+    public static HttpServletRequest getRequest(Map<String, ? extends Object> parameters)
{
+        Object parameter = parameters.get(HTTP_SERVLET_REQUEST_KEY);
         if (parameter instanceof HttpServletRequest) {
             return (HttpServletRequest) parameter;
         }
@@ -39,8 +40,8 @@
                 "A HttpServletRequest is not available. This might indicate an invocation
outside a servlet.");
     }
 
-    public static HttpServletResponse getResponse(Invocation invocation) {
-        Object parameter = invocation.getParameter(HTTP_SERVLET_RESPONSE_KEY);
+    public static HttpServletResponse getResponse(Map<String, ? extends Object> parameters)
{
+        Object parameter = parameters.get(HTTP_SERVLET_RESPONSE_KEY);
         if (parameter instanceof HttpServletResponse) {
             return (HttpServletResponse) parameter;
         }
@@ -49,11 +50,11 @@
                 "A HttpServletResponse is not available. This might indicate an invocation
outside a servlet.");
     }
 
-    public static void storeRequest(HttpServletRequest httpServletRequest, Invocation invocation)
{
-        invocation.addParameter(HTTP_SERVLET_REQUEST_KEY, httpServletRequest);
+    public static void storeRequest(HttpServletRequest httpServletRequest, Map<String,
Object> parameters) {
+        parameters.put(HTTP_SERVLET_REQUEST_KEY, httpServletRequest);
     }
 
-    public static void storeResponse(HttpServletResponse httpServletResponse, Invocation
invocation) {
-        invocation.addParameter(HTTP_SERVLET_RESPONSE_KEY, httpServletResponse);
+    public static void storeResponse(HttpServletResponse httpServletResponse, Map<String,
Object> parameters) {
+        parameters.put(HTTP_SERVLET_RESPONSE_KEY, httpServletResponse);
     }
 }

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/test/java/org/apache/cocoon/corona/pipeline/PipelineTest.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/test/java/org/apache/cocoon/corona/pipeline/PipelineTest.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/test/java/org/apache/cocoon/corona/pipeline/PipelineTest.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/test/java/org/apache/cocoon/corona/pipeline/PipelineTest.java
Tue Apr  1 06:42:01 2008
@@ -24,9 +24,6 @@
 import junit.framework.TestCase;
 
 import org.apache.cocoon.corona.pipeline.component.FileReaderComponent;
-import org.apache.cocoon.corona.sitemap.SpringComponentProvider;
-import org.apache.cocoon.corona.sitemap.InvocationImpl;
-import org.apache.cocoon.corona.sitemap.resource.ClassPathResourceResolver;
 
 public class PipelineTest extends TestCase {
 
@@ -43,13 +40,6 @@
         fileReaderComponent.setParameters(parameters);
         pipeline.addComponent(fileReaderComponent);
 
-        InvocationImpl invocationImpl = new InvocationImpl(System.out);
-
-        SpringComponentProvider componentProviderImpl = new SpringComponentProvider();
-        componentProviderImpl.setResourceResolver(new ClassPathResourceResolver());
-        invocationImpl.setComponentProvider(componentProviderImpl);
-
-        pipeline.execute(invocationImpl);
+        pipeline.execute(null, System.out);
     }
-
 }

Modified: cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-servlet/src/main/java/org/apache/cocoon/corona/servlet/SitemapServlet.java
Tue Apr  1 06:42:01 2008
@@ -67,8 +67,8 @@
             InvocationImpl invocation = (InvocationImpl) this.beanFactory.getBean(Invocation.class.getName());
             // parameters
             invocation.setParameters(this.getInvocationParameters(request));
-            HttpContextHelper.storeRequest(request, invocation);
-            HttpContextHelper.storeResponse(response, invocation);
+            HttpContextHelper.storeRequest(request, invocation.getParameters());
+            HttpContextHelper.storeResponse(response, invocation.getParameters());
 
             // request
             invocation.setRequestURI(request.getRequestURI());

Modified: cocoon/whiteboard/corona/trunk/corona-servlet/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-servlet/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java?rev=643396&r1=643395&r2=643396&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-servlet/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java
(original)
+++ cocoon/whiteboard/corona/trunk/corona-servlet/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java
Tue Apr  1 06:42:01 2008
@@ -59,7 +59,7 @@
     public void testErrorHandlingPipeline() {
         Invocation invocation = this.buildInvocation("error-handling/custom-error-per-pipeline-error-handling");
         MockHttpServletResponse mockHttpServletResponse = new MockHttpServletResponse();
-        HttpContextHelper.storeResponse(mockHttpServletResponse, invocation);
+        HttpContextHelper.storeResponse(mockHttpServletResponse, invocation.getParameters());
 
         this.sitemap.invoke(invocation);
         // invocation should be marked as error-invocation
@@ -74,7 +74,7 @@
     public void testGenerator() {
         Invocation invocation = this.buildInvocation("sax-pipeline/unauthorized");
         MockHttpServletResponse mockHttpServletResponse = new MockHttpServletResponse();
-        HttpContextHelper.storeResponse(mockHttpServletResponse, invocation);
+        HttpContextHelper.storeResponse(mockHttpServletResponse, invocation.getParameters());
 
         InvocationResult invocationResult = this.sitemap.invoke(invocation);
         assertNotNull(invocationResult);
@@ -100,7 +100,7 @@
         requestParameters.put("a", "1");
         requestParameters.put("b", "2");
         requestParameters.put("c", "3");
-        HttpContextHelper.storeRequest(new MockHttpServletRequest(requestParameters), invocation);
+        HttpContextHelper.storeRequest(new MockHttpServletRequest(requestParameters), invocation.getParameters());
         this.sitemap.invoke(invocation);
         // invocation not should be marked as error-invocation
         assertFalse(invocation.isErrorInvocation());



Mime
View raw message