cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r647802 - in /cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline: ./ component/ resource/
Date Mon, 14 Apr 2008 14:04:15 GMT
Author: reinhard
Date: Mon Apr 14 07:04:07 2008
New Revision: 647802

URL: http://svn.apache.org/viewvc?rev=647802&view=rev
Log:
COCOON-2195 Apply Steven's patch:

. add an abstract transformers implementation as base class for transformers
. add XSLT transformer
. tidy up pipeline implementations
. add content-type handling

Added:
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/AbstractTransformer.java   (with props)
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/TraxErrorListener.java   (with props)
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLConsumerAdapter.java   (with props)
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTProcessorErrorListener.java   (with props)
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTTransformer.java   (with props)
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/component/AbstractXMLProducer.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/Finisher.java
    cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/PipelineComponent.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/pipeline/resource/ClassPathResourceResolver.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=647802&r1=647801&r2=647802&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 Mon Apr 14 07:04:07 2008
@@ -39,7 +39,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.pipeline.Pipeline#addAction(org.apache.cocoon.corona.pipeline.action.Action)
      */
     public void addAction(Action action) {
@@ -48,7 +48,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.pipeline.Pipeline#addComponent(org.apache.cocoon.corona.pipeline.component.PipelineComponent)
      */
     public void addComponent(PipelineComponent pipelineComponent) {
@@ -57,28 +57,27 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.pipeline.Pipeline#execute(OutputStream)
      */
     public void execute(Map<String, Object> parameters, OutputStream outputStream) throws Exception {
-        // execute the actions first
-        for (Action action : this.actions) {
-            action.execute(parameters);
-        }
+        this.invokeActions(parameters);
 
-        // now setup the components
-        this.setupComponents(outputStream);
+        this.setupComponents(parameters, outputStream);
 
-        // and execute the Starter
-        Starter starter = (Starter) this.components.getFirst();
-        starter.execute(parameters);
+        this.invokeStarter();
     }
 
     protected LinkedList<PipelineComponent> getComponents() {
         return this.components;
     }
 
-    protected void setupComponents(OutputStream outputStream) {
+    protected void invokeStarter() {
+        Starter starter = (Starter) this.components.getFirst();
+        starter.execute();
+    }
+
+    protected void setupComponents(Map<String, Object> parameters, OutputStream outputStream) {
         PipelineComponent first = this.components.getFirst();
 
         // first component must be a Starter
@@ -95,19 +94,29 @@
         // now try to link the components, always two components at a time
         // start at the first component
         PipelineComponent currentComponent = first;
+        first.setInputParameters(parameters);
+
         // next component to link is the second in the list
         for (ListIterator<PipelineComponent> i = this.components.listIterator(1); i.hasNext();) {
             // link the current with the next component
             PipelineComponent nextComponent = i.next();
             this.linkComponents(currentComponent, nextComponent);
+
             // now advance to the next component
             currentComponent = nextComponent;
+            currentComponent.setInputParameters(parameters);
         }
 
         // configure the finisher
         ((Finisher) last).setOutputStream(outputStream);
     }
 
+    protected void invokeActions(Map<String, Object> parameters) throws Exception {
+        for (Action action : this.actions) {
+            action.execute(parameters);
+        }
+    }
+
     private void linkComponents(PipelineComponent firstComponent, PipelineComponent secondComponent) {
         // first component must be a Producer
         if (!(firstComponent instanceof Producer)) {
@@ -121,5 +130,11 @@
 
         // let the Producer accept the Consumer (the Producer might reject it)
         ((Producer) firstComponent).setConsumer((Consumer) secondComponent);
+    }
+
+    public String getContentType() {
+        Finisher last = (Finisher) this.components.getLast();
+        System.out.println("Retrieving mime-type from component " + last);
+        return last.getContentType();
     }
 }

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=647802&r1=647801&r2=647802&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 Mon Apr 14 07:04:07 2008
@@ -36,9 +36,14 @@
 
     @Override
     public void execute(Map<String, Object> parameters, OutputStream outputStream) throws Exception {
-        // construct the current cache key
-        CacheKey cacheKey = this.constructCacheKey(parameters);
+        this.invokeActions(parameters);
+
+        // create a caching output stream to intercept the result
+        CachingOutputStream cachingOutputStream = new CachingOutputStream(outputStream);
+        this.setupComponents(parameters, cachingOutputStream);
 
+        // construct the current cache key
+        CacheKey cacheKey = this.constructCacheKey();
         // checked for a cached value first
         CacheValue cachedValue = this.getCachedValue(cacheKey);
         if (cachedValue != null) {
@@ -47,26 +52,27 @@
             return;
         }
 
-        // create a caching output stream to intercept the result
-        CachingOutputStream cachingOutputStream = new CachingOutputStream(outputStream);
         // execute the pipeline
-        super.execute(parameters, cachingOutputStream);
+        this.invokeStarter();
 
-        this.pipelineCache.put(cacheKey, new CompleteCacheValue(cachingOutputStream.getContent()));
+        // cache the result
+        if (cacheKey != null) {
+            this.pipelineCache.put(cacheKey, new CompleteCacheValue(cachingOutputStream.getContent()));
+        }
     }
 
     public void setPipelineCache(PipelineCache pipelineCache) {
         this.pipelineCache = pipelineCache;
     }
 
-    private CacheKey constructCacheKey(Map<String, Object> parameters) {
+    private CacheKey constructCacheKey() {
         CompoundCacheKey result = new CompoundCacheKey();
 
         for (PipelineComponent pipelineComponent : this.getComponents()) {
             if (pipelineComponent instanceof CachingPipelineComponent) {
                 CachingPipelineComponent cachablePipelineComponent = (CachingPipelineComponent) pipelineComponent;
 
-                result.addCacheKey(cachablePipelineComponent.constructCacheKey(parameters));
+                result.addCacheKey(cachablePipelineComponent.constructCacheKey());
                 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=647802&r1=647801&r2=647802&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 Mon Apr 14 07:04:07 2008
@@ -32,4 +32,5 @@
 
     void execute(Map<String, Object> parameters, OutputStream outputStream) throws Exception;
 
+    String getContentType();
 }

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/AbstractTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/AbstractTransformer.java?rev=647802&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/AbstractTransformer.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/AbstractTransformer.java Mon Apr 14 07:04:07 2008
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.corona.pipeline.component;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+
+public abstract class AbstractTransformer extends AbstractXMLProducer implements XMLConsumer {
+
+    public void characters(char[] ch, int start, int length) throws SAXException {
+        this.getXMLConsumer().characters(ch, start, length);
+    }
+
+    public void comment(char[] ch, int start, int length) throws SAXException {
+        this.getXMLConsumer().comment(ch, start, length);
+    }
+
+    public void endCDATA() throws SAXException {
+        this.getXMLConsumer().endCDATA();
+    }
+
+    public void endDocument() throws SAXException {
+        this.getXMLConsumer().endDocument();
+    }
+
+    public void endDTD() throws SAXException {
+        this.getXMLConsumer().endDTD();
+    }
+
+    public void endElement(String uri, String localName, String name) throws SAXException {
+        this.getXMLConsumer().endElement(uri, localName, name);
+    }
+
+    public void endEntity(String name) throws SAXException {
+        this.getXMLConsumer().endEntity(name);
+    }
+
+    public void endPrefixMapping(String prefix) throws SAXException {
+        this.getXMLConsumer().endPrefixMapping(prefix);
+    }
+
+    public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+        this.getXMLConsumer().ignorableWhitespace(ch, start, length);
+    }
+
+    public void processingInstruction(String target, String data) throws SAXException {
+        this.getXMLConsumer().processingInstruction(target, data);
+    }
+
+    public void setDocumentLocator(Locator locator) {
+        this.getXMLConsumer().setDocumentLocator(locator);
+    }
+
+    public void skippedEntity(String name) throws SAXException {
+        this.getXMLConsumer().skippedEntity(name);
+    }
+
+    public void startCDATA() throws SAXException {
+        this.getXMLConsumer().startCDATA();
+    }
+
+    public void startDocument() throws SAXException {
+        this.getXMLConsumer().startDocument();
+    }
+
+    public void startDTD(String name, String publicId, String systemId) throws SAXException {
+        this.getXMLConsumer().startDTD(name, publicId, systemId);
+    }
+
+    public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException {
+        this.getXMLConsumer().startElement(uri, localName, name, atts);
+    }
+
+    public void startEntity(String name) throws SAXException {
+        this.getXMLConsumer().startEntity(name);
+    }
+
+    public void startPrefixMapping(String prefix, String uri) throws SAXException {
+        this.getXMLConsumer().startPrefixMapping(prefix, uri);
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/AbstractTransformer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/AbstractTransformer.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/AbstractTransformer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/AbstractXMLProducer.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/AbstractXMLProducer.java?rev=647802&r1=647801&r2=647802&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/AbstractXMLProducer.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/AbstractXMLProducer.java Mon Apr 14 07:04:07 2008
@@ -29,23 +29,36 @@
      * 
      * @see org.apache.cocoon.corona.pipeline.component.Producer#setConsumer(org.apache.cocoon.corona.pipeline.component.Consumer)
      */
-    public void setConsumer(Consumer consumer) {
+    public final void setConsumer(Consumer consumer) {
         if (!(consumer instanceof XMLConsumer)) {
             throw new IllegalArgumentException("XMLProducer requires an XMLConsumer.");
         }
 
-        this.xmlConsumer = (XMLConsumer) consumer;
+        this.setXMLConsumer((XMLConsumer) consumer);
     }
 
     /**
      * {@inheritDoc}
      * 
-     * @see org.apache.cocoon.corona.pipeline.component.PipelineComponent#setParameters(java.util.Map)
+     * @see org.apache.cocoon.corona.pipeline.component.PipelineComponent#setConfiguration(java.util.Map)
      */
-    public void setParameters(Map<String, ? extends Object> parameters) {
+    public void setConfiguration(Map<String, ? extends Object> parameters) {
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.pipeline.component.PipelineComponent#setInputParameters(java.util.Map)
+     */
+    public void setInputParameters(Map<String, Object> parameters) {
     }
 
     protected XMLConsumer getXMLConsumer() {
         return this.xmlConsumer;
     }
+
+    protected void setXMLConsumer(XMLConsumer xmlConsumer) {
+        this.xmlConsumer = xmlConsumer;
+    }
+
 }

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=647802&r1=647801&r2=647802&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 Mon Apr 14 07:04:07 2008
@@ -18,11 +18,10 @@
  */
 package org.apache.cocoon.corona.pipeline.component;
 
-import java.util.Map;
 
 import org.apache.cocoon.corona.pipeline.caching.CacheKey;
 
 public interface CachingPipelineComponent {
 
-    CacheKey constructCacheKey(Map<String, ? extends Object> parameters);
+    CacheKey constructCacheKey();
 }

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=647802&r1=647801&r2=647802&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 Mon Apr 14 07:04:07 2008
@@ -46,9 +46,9 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.apache.cocoon.corona.pipeline.component.CachingPipelineComponent#constructCacheKey(Map)
+     * @see org.apache.cocoon.corona.pipeline.component.CachingPipelineComponent#constructCacheKey()
      */
-    public CacheKey constructCacheKey(Map<String, ? extends Object> parameters) {
+    public CacheKey constructCacheKey() {
         try {
             return new TimestampCacheKey(this.source, this.source.openConnection().getLastModified());
         } catch (IOException e) {
@@ -62,9 +62,9 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.apache.cocoon.corona.pipeline.component.Starter#execute(Map)
+     * @see org.apache.cocoon.corona.pipeline.component.Starter#execute()
      */
-    public void execute(Map<String, ? extends Object> parameters) {
+    public void execute() {
         if (this.source == null) {
             // failed to resolve
             throw new IllegalArgumentException("FileGenerator cannot resolve source '" + this.source + "'");
@@ -87,10 +87,10 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.apache.cocoon.corona.pipeline.component.AbstractXMLProducer#setParameters(java.util.Map)
+     * @see org.apache.cocoon.corona.pipeline.component.AbstractXMLProducer#setConfiguration(java.util.Map)
      */
     @Override
-    public void setParameters(Map<String, ? extends Object> parameters) {
+    public void setConfiguration(Map<String, ? extends Object> parameters) {
         this.setSource((URL) parameters.get("source"));
     }
 

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=647802&r1=647801&r2=647802&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 Mon Apr 14 07:04:07 2008
@@ -45,9 +45,9 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.apache.cocoon.corona.pipeline.component.CachingPipelineComponent#constructCacheKey(java.util.Map)
+     * @see org.apache.cocoon.corona.pipeline.component.CachingPipelineComponent#constructCacheKey()
      */
-    public CacheKey constructCacheKey(Map<String, ? extends Object> parameters) {
+    public CacheKey constructCacheKey() {
         try {
             URLConnection connection = this.source.openConnection();
             return new TimestampCacheKey(this.source, connection.getLastModified());
@@ -62,9 +62,9 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.apache.cocoon.corona.pipeline.component.Starter#execute(Map)
+     * @see org.apache.cocoon.corona.pipeline.component.Starter#execute()
      */
-    public void execute(Map<String, ? extends Object> parameters) {
+    public void execute() {
         try {
             if (this.source == null) {
                 throw new IllegalArgumentException("FileReaderComponent has no source configured to read from.");
@@ -93,19 +93,27 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.apache.cocoon.corona.pipeline.component.Finisher#setOutputStream(java.io.OutputStream)
+     * @see org.apache.cocoon.corona.pipeline.component.PipelineComponent#setConfiguration(java.util.Map)
      */
-    public void setOutputStream(OutputStream outputStream) {
-        this.outputStream = outputStream;
+    public void setConfiguration(Map<String, ? extends Object> parameters) {
+        this.setSource((URL) parameters.get("source"));
     }
 
     /**
      * {@inheritDoc}
      * 
-     * @see org.apache.cocoon.corona.pipeline.component.PipelineComponent#setParameters(java.util.Map)
+     * @see org.apache.cocoon.corona.pipeline.component.PipelineComponent#setInputParameters(java.util.Map)
      */
-    public void setParameters(Map<String, ? extends Object> parameters) {
-        this.setSource((URL) parameters.get("source"));
+    public void setInputParameters(Map<String, Object> parameters) {
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.corona.pipeline.component.Finisher#setOutputStream(java.io.OutputStream)
+     */
+    public void setOutputStream(OutputStream outputStream) {
+        this.outputStream = outputStream;
     }
 
     public void setSource(URL source) {
@@ -120,5 +128,13 @@
     @Override
     public String toString() {
         return "ReaderComponent(" + this.source + ")";
+    }
+
+    public String getContentType() {
+        try {
+            return this.source.openConnection().getContentType();
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        }
     }
 }

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/Finisher.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/Finisher.java?rev=647802&r1=647801&r2=647802&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/Finisher.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/Finisher.java Mon Apr 14 07:04:07 2008
@@ -23,4 +23,6 @@
 public interface Finisher extends PipelineComponent {
 
     void setOutputStream(OutputStream outputStream);
+
+    String getContentType();
 }

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/PipelineComponent.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/PipelineComponent.java?rev=647802&r1=647801&r2=647802&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/PipelineComponent.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/PipelineComponent.java Mon Apr 14 07:04:07 2008
@@ -22,5 +22,7 @@
 
 public interface PipelineComponent {
 
-    void setParameters(Map<String, ? extends Object> parameters);
+    void setConfiguration(Map<String, ? extends Object> configuration);
+
+    void setInputParameters(Map<String, Object> parameters);
 }

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=647802&r1=647801&r2=647802&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 Mon Apr 14 07:04:07 2008
@@ -18,10 +18,9 @@
  */
 package org.apache.cocoon.corona.pipeline.component;
 
-import java.util.Map;
 
 
 public interface Starter extends PipelineComponent {
 
-    void execute(Map<String, ? extends Object> parameters);
+    void execute();
 }

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/TraxErrorListener.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/TraxErrorListener.java?rev=647802&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/TraxErrorListener.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/TraxErrorListener.java Mon Apr 14 07:04:07 2008
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.corona.pipeline.component;
+
+import javax.xml.transform.ErrorListener;
+import javax.xml.transform.TransformerException;
+
+import org.apache.commons.logging.Log;
+
+/**
+ * A smart error listener for <code>javax.xml.tranform</code> that does its best to provide useful error messages.
+ * 
+ * @version $Id$
+ */
+public class TraxErrorListener implements ErrorListener {
+
+    /** The exception we had from error() or fatalError() */
+    private TransformerException exception;
+    private final Log log;
+    private String uri;
+    /** The exception we had from warning() */
+    private TransformerException warningEx;
+
+    public TraxErrorListener(Log log, String uri) {
+        this.log = log;
+        this.uri = uri;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see javax.xml.transform.ErrorListener#error(javax.xml.transform.TransformerException)
+     */
+    public void error(TransformerException ex) throws TransformerException {
+        // If we had a warning previoulsy, and the current exception has no cause, then use the warning.
+        // This is how Xalan behaves on <xsl:message terminate="yes">: it first issues a warning with all
+        // the useful information, then a useless "stylesheed directed termination" error.
+        if (this.warningEx != null && ex.getCause() == null) {
+            ex = this.warningEx;
+        }
+        this.warningEx = null;
+
+        // Keep the exception for later use.
+        this.exception = ex;
+        // and rethrow it
+        throw ex;
+    }
+
+    public void fatalError(TransformerException ex) throws TransformerException {
+        if (this.warningEx != null && ex.getCause() == null) {
+            ex = this.warningEx;
+        }
+        this.warningEx = null;
+
+        this.exception = ex;
+        throw ex;
+    }
+
+    /**
+     * Get the exception that was catched by this listener, if any.
+     * 
+     * @return the exception
+     */
+    public Throwable getThrowable() {
+        if (this.exception == null) {
+            return null;
+        }
+
+        // Location loc = LocationUtils.getLocation(this.exception);
+        // if (LocationUtils.isKnown(loc)) {
+        // // Has a location: don't loose this precious information!
+        // return this.exception;
+        // }
+
+        // No location: if it's just a wrapper, consider only the wrapped exception
+        if (this.exception.getCause() != null) {
+            return this.exception.getCause();
+        }
+
+        // That's the actual exception!
+        return this.exception;
+    }
+
+    public void warning(TransformerException ex) throws TransformerException {
+        // TODO: We may want here to allow some special formatting of the messages, such as
+        // "DEBUG:A debug message" or "INFO:Transforming <foo> in mode 'bar'" to use the different
+        // log levels. This can include also deprecation logs for system-defined stylesheets
+        // using "DEPRECATED:WARN:Styling 'foo' is replaced by 'bar'".
+
+        if (this.log.isWarnEnabled()) {
+            // Location loc = LocationUtils.getLocation(ex);
+            // getLogger().warn(ex.getMessage() + " at " + (loc == null ? this.uri : loc.toString()));
+            this.log.warn(ex.getMessage() + " at " + this.uri);
+        }
+
+        // Keep the warning (see below)
+        this.warningEx = ex;
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/TraxErrorListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/TraxErrorListener.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/TraxErrorListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLConsumerAdapter.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLConsumerAdapter.java?rev=647802&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLConsumerAdapter.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLConsumerAdapter.java Mon Apr 14 07:04:07 2008
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.corona.pipeline.component;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.ext.LexicalHandler;
+
+public class XMLConsumerAdapter implements XMLConsumer {
+
+    private ContentHandler contentHandler;
+    private LexicalHandler lexicalHandler;
+
+    public XMLConsumerAdapter(ContentHandler contentHandler, LexicalHandler lexicalHandler) {
+        super();
+        this.contentHandler = contentHandler;
+        this.lexicalHandler = lexicalHandler;
+    }
+
+    public void characters(char[] ch, int start, int length) throws SAXException {
+        this.contentHandler.characters(ch, start, length);
+    }
+
+    public void comment(char[] ch, int start, int length) throws SAXException {
+        this.lexicalHandler.comment(ch, start, length);
+    }
+
+    public void endCDATA() throws SAXException {
+        this.lexicalHandler.endCDATA();
+    }
+
+    public void endDocument() throws SAXException {
+        this.contentHandler.endDocument();
+    }
+
+    public void endDTD() throws SAXException {
+        this.lexicalHandler.endDTD();
+    }
+
+    public void endElement(String uri, String localName, String name) throws SAXException {
+        this.contentHandler.endElement(uri, localName, name);
+    }
+
+    public void endEntity(String name) throws SAXException {
+        this.lexicalHandler.endEntity(name);
+    }
+
+    public void endPrefixMapping(String prefix) throws SAXException {
+        this.contentHandler.endPrefixMapping(prefix);
+    }
+
+    public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+        this.contentHandler.ignorableWhitespace(ch, start, length);
+    }
+
+    public void processingInstruction(String target, String data) throws SAXException {
+        this.contentHandler.processingInstruction(target, data);
+    }
+
+    public void setDocumentLocator(Locator locator) {
+        this.contentHandler.setDocumentLocator(locator);
+    }
+
+    public void skippedEntity(String name) throws SAXException {
+        this.contentHandler.skippedEntity(name);
+    }
+
+    public void startCDATA() throws SAXException {
+        this.lexicalHandler.startCDATA();
+    }
+
+    public void startDocument() throws SAXException {
+        this.contentHandler.startDocument();
+    }
+
+    public void startDTD(String name, String publicId, String systemId) throws SAXException {
+        this.lexicalHandler.startDTD(name, publicId, systemId);
+    }
+
+    public void startElement(String uri, String localName, String name, Attributes atts) throws SAXException {
+        this.contentHandler.startElement(uri, localName, name, atts);
+    }
+
+    public void startEntity(String name) throws SAXException {
+        this.lexicalHandler.startEntity(name);
+    }
+
+    public void startPrefixMapping(String prefix, String uri) throws SAXException {
+        this.contentHandler.startPrefixMapping(prefix, uri);
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLConsumerAdapter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLConsumerAdapter.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XMLConsumerAdapter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

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=647802&r1=647801&r2=647802&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 Mon Apr 14 07:04:07 2008
@@ -39,6 +39,7 @@
 
     private static final SAXTransformerFactory SAX_TRANSFORMER_FACTORY = (SAXTransformerFactory) TransformerFactory.newInstance();
 
+    private String contentType;
     private Properties format = new Properties();
 
     private TransformerHandler transformerHandler;
@@ -51,7 +52,7 @@
         this.transformerHandler.comment(ch, start, length);
     }
 
-    public CacheKey constructCacheKey(Map<String, ? extends Object> parameters) {
+    public CacheKey constructCacheKey() {
         return new SimpleCacheKey();
     }
 
@@ -79,6 +80,10 @@
         this.transformerHandler.endPrefixMapping(prefix);
     }
 
+    public String getContentType() {
+        return this.contentType;
+    }
+
     public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
         this.transformerHandler.ignorableWhitespace(ch, start, length);
     }
@@ -87,6 +92,16 @@
         this.transformerHandler.processingInstruction(target, data);
     }
 
+    public void setConfiguration(Map<String, ? extends Object> parameters) {
+        if (parameters.containsKey("mime-type")) {
+            this.contentType = (String) parameters.get("mime-type");
+        }
+    }
+
+    public void setContentType(String contentType) {
+        this.contentType = contentType;
+    }
+
     public void setDocumentLocator(Locator locator) {
         this.transformerHandler.setDocumentLocator(locator);
     }
@@ -95,6 +110,9 @@
         this.format = format;
     }
 
+    public void setInputParameters(Map<String, Object> parameters) {
+    }
+
     public void setOutputStream(OutputStream outputStream) {
         try {
             this.transformerHandler = SAX_TRANSFORMER_FACTORY.newTransformerHandler();
@@ -104,10 +122,6 @@
         } catch (TransformerConfigurationException e) {
             e.printStackTrace();
         }
-    }
-
-    public void setParameters(Map<String, ? extends Object> parameters) {
-        // currently no parameters...
     }
 
     public void skippedEntity(String name) throws SAXException {

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTProcessorErrorListener.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTProcessorErrorListener.java?rev=647802&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTProcessorErrorListener.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTProcessorErrorListener.java Mon Apr 14 07:04:07 2008
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.corona.pipeline.component;
+
+import javax.xml.transform.ErrorListener;
+import javax.xml.transform.TransformerException;
+
+import org.apache.commons.logging.Log;
+
+/**
+ * A smart error listener for <code>javax.xml.tranform</code> that does its best to provide useful error messages.
+ * 
+ * @version $Id$
+ */
+public class XSLTProcessorErrorListener implements ErrorListener {
+
+    /** The exception we had from error() or fatalError() */
+    private TransformerException exception;
+    private final Log logger;
+    private final String uri;
+    /** The exception we had from warning() */
+    private TransformerException warningEx;
+
+    public XSLTProcessorErrorListener(Log logger, String uri) {
+        this.logger = logger;
+        this.uri = uri;
+    }
+
+    public void error(TransformerException ex) throws TransformerException {
+        // If we had a warning previoulsy, and the current exception has no cause, then use the warning.
+        // This is how Xalan behaves on <xsl:message terminate="yes">: it first issues a warning with all
+        // the useful information, then a useless "stylesheed directed termination" error.
+        if (this.warningEx != null && ex.getCause() == null) {
+            ex = this.warningEx;
+        }
+        this.warningEx = null;
+
+        // Keep the exception for later use.
+        this.exception = ex;
+        // and rethrow it
+        throw ex;
+    }
+
+    public void fatalError(TransformerException ex) throws TransformerException {
+        if (this.warningEx != null && ex.getCause() == null) {
+            ex = this.warningEx;
+        }
+        this.warningEx = null;
+
+        this.exception = ex;
+        throw ex;
+    }
+
+    /**
+     * Get the exception that was catched by this listener, if any.
+     * 
+     * @return the exception
+     */
+    public Throwable getThrowable() {
+        if (this.exception == null) {
+            return null;
+        }
+
+        // Location loc = LocationUtils.getLocation(this.exception);
+        // if (LocationUtils.isKnown(loc)) {
+        // // Has a location: don't loose this precious information!
+        // return this.exception;
+        // }
+
+        // No location: if it's just a wrapper, consider only the wrapped exception
+        if (this.exception.getCause() != null) {
+            return this.exception.getCause();
+        }
+
+        // That's the actual exception!
+        return this.exception;
+    }
+
+    public void warning(TransformerException ex) throws TransformerException {
+        // TODO: We may want here to allow some special formatting of the messages, such as
+        // "DEBUG:A debug message" or "INFO:Transforming <foo> in mode 'bar'" to use the different
+        // log levels. This can include also deprecation logs for system-defined stylesheets
+        // using "DEPRECATED:WARN:Styling 'foo' is replaced by 'bar'".
+
+        if (this.logger.isWarnEnabled()) {
+            // Location loc = LocationUtils.getLocation(ex);
+            // this.logger.warn(ex.getMessage() + " at " + loc == null ? this.uri : loc.toString());
+            this.logger.warn(ex.getMessage() + " at " + this.uri);
+        }
+        // Keep the warning (see below)
+        this.warningEx = ex;
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTProcessorErrorListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTProcessorErrorListener.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTProcessorErrorListener.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTTransformer.java?rev=647802&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTTransformer.java (added)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTTransformer.java Mon Apr 14 07:04:07 2008
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.corona.pipeline.component;
+
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TemplatesHandler;
+import javax.xml.transform.sax.TransformerHandler;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+public class XSLTTransformer extends AbstractTransformer {
+
+    private final Log log = LogFactory.getLog(XSLTTransformer.class);
+    private Map<String, Object> parameters;
+    private URL source;
+
+    /**
+     * Test if the name is a valid parameter name for XSLT
+     */
+    private static boolean isValidXSLTParameterName(String name) {
+        return name.matches("[a-zA-Z_][\\w\\-\\.]*");
+    }
+
+    @Override
+    public void setConfiguration(Map<String, ? extends Object> parameters) {
+        this.source = (URL) parameters.get("source");
+
+        this.parameters = new HashMap<String, Object>(parameters);
+    }
+
+    @Override
+    protected void setXMLConsumer(XMLConsumer consumer) {
+        TransformerHandler transformerHandler;
+        try {
+            transformerHandler = this.createTransformerHandler();
+        } catch (Exception ex) {
+            throw new RuntimeException("Could not initialize transformer handler.", ex);
+        }
+
+        final Map<String, Object> map = this.getLogicSheetParameters();
+        if (map != null) {
+            final Transformer transformer = transformerHandler.getTransformer();
+
+            for (Entry<String, Object> entry : map.entrySet()) {
+                transformer.setParameter(entry.getKey(), entry.getValue());
+            }
+        }
+
+        final SAXResult result = new SAXResult();
+        result.setHandler(consumer);
+        // According to TrAX specs, all TransformerHandlers are LexicalHandlers
+        result.setLexicalHandler(consumer);
+        transformerHandler.setResult(result);
+
+        TraxErrorListener traxErrorListener = new TraxErrorListener(this.log, this.source.toExternalForm());
+        transformerHandler.getTransformer().setErrorListener(traxErrorListener);
+
+        super.setXMLConsumer(new XMLConsumerAdapter(transformerHandler, transformerHandler));
+    }
+
+    private TransformerHandler createTransformerHandler() throws Exception {
+        SAXTransformerFactory transformerFactory = (SAXTransformerFactory) TransformerFactory.newInstance();
+        TemplatesHandler templatesHandler = transformerFactory.newTemplatesHandler();
+
+        XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+        xmlReader.setContentHandler(templatesHandler);
+        xmlReader.parse(new InputSource(this.source.toURI().toString()));
+
+        // Create transformer handler
+        final TransformerHandler handler = transformerFactory.newTransformerHandler(templatesHandler.getTemplates());
+        handler.getTransformer().setErrorListener(new XSLTProcessorErrorListener(this.log, this.source.toExternalForm()));
+        // TODO: apparently this is currently not needed
+        // handler.getTransformer().setURIResolver(this);
+
+        return handler;
+    }
+
+    private Map<String, Object> getLogicSheetParameters() {
+        if (this.parameters == null) {
+            return null;
+        }
+
+        Map<String, Object> result = new HashMap<String, Object>();
+
+        for (Entry<String, Object> entry : this.parameters.entrySet()) {
+            String name = entry.getKey();
+
+            if (isValidXSLTParameterName(name)) {
+                result.put(name, entry.getValue());
+            }
+        }
+
+        return result;
+    }
+}

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTTransformer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTTransformer.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/component/XSLTTransformer.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/resource/ClassPathResourceResolver.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/resource/ClassPathResourceResolver.java?rev=647802&r1=647801&r2=647802&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/resource/ClassPathResourceResolver.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-core/src/main/java/org/apache/cocoon/corona/pipeline/resource/ClassPathResourceResolver.java Mon Apr 14 07:04:07 2008
@@ -26,14 +26,18 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.pipeline.resource.ResourceResolver#resolve(java.lang.String)
      */
     public URL resolve(String resource) {
         URL url = this.getClass().getResource(resource);
 
-        if (url == null && resource.charAt(0) != '/') {
+        if (url == null && !resource.startsWith("/")) {
             url = this.getClass().getResource("/" + resource);
+        }
+
+        if (url == null && !resource.startsWith("/COB-INF/")) {
+            url = this.getClass().getResource("/COB-INF/" + resource);
         }
 
         return url;



Mime
View raw message