cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r157249 - in cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline: AbstractProcessingPipeline.java ProcessingPipeline.java
Date Sat, 12 Mar 2005 12:23:53 GMT
Author: vgritsenko
Date: Sat Mar 12 04:23:50 2005
New Revision: 157249

URL: http://svn.apache.org/viewcvs?view=rev&rev=157249
Log:
whitespaces, etc

Modified:
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
    cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/ProcessingPipeline.java

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java?view=diff&r1=157248&r2=157249
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/AbstractProcessingPipeline.java
Sat Mar 12 04:23:50 2005
@@ -1,5 +1,5 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@
 import org.apache.avalon.framework.parameters.ParameterException;
 import org.apache.avalon.framework.parameters.Parameterizable;
 import org.apache.avalon.framework.parameters.Parameters;
+
 import org.apache.cocoon.ConnectionResetException;
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.components.CocoonComponentManager;
@@ -38,6 +39,7 @@
 import org.apache.cocoon.transformation.Transformer;
 import org.apache.cocoon.xml.XMLConsumer;
 import org.apache.cocoon.xml.XMLProducer;
+
 import org.apache.excalibur.source.SourceValidity;
 import org.xml.sax.SAXException;
 
@@ -57,8 +59,8 @@
  * @version CVS $Id$
  */
 public abstract class AbstractProcessingPipeline
-  extends AbstractLogEnabled
-  implements ProcessingPipeline, Parameterizable, Recyclable {
+        extends AbstractLogEnabled
+        implements ProcessingPipeline, Parameterizable, Recyclable {
 
     // Generator stuff
     protected Generator generator;
@@ -88,14 +90,12 @@
     protected String sitemapReaderMimeType;
     protected OutputComponentSelector readerSelector;
 
-    /**
-     * True when pipeline has been prepared.
-     */
+    /** True when pipeline has been prepared. */
     private boolean prepared;
 
     /**
      * This is the last component in the pipeline, either the serializer
-     * or a custom xmlconsumer for the cocoon: protocol etc.
+     * or a custom XML consumer in case of internal processing.
      */
     protected XMLConsumer lastConsumer;
 
@@ -108,20 +108,20 @@
     /** The configuration */
     protected Parameters configuration;
 
-    /** The parameters */
-    protected Parameters parameters;
-
-    /** Expires value */
-    protected long expires;
-
     /** Configured Expires value */
     protected long configuredExpires;
 
     /** Configured Output Buffer Size */
     protected int  configuredOutputBufferSize;
 
+    /** The parameters */
+    protected Parameters parameters;
+
+    /** Expires value */
+    protected long expires;
+
     /** Output Buffer Size */
-    protected int  outputBufferSize;
+    protected int outputBufferSize;
 
     /**
      * Composable Interface
@@ -169,7 +169,7 @@
     }
 
     /**
-     * Release this component
+     * Release this component.
      * If you get an instance not by a component manager but for example
      * by a processor, you have to release this component by calling
      * this method and NOT by using a component manager!
@@ -184,18 +184,18 @@
     }
 
     /**
-     * Get the generator - used for content aggregation
+     * Informs pipeline we have come across a branch point.
+     * Default behaviour is do nothing.
      */
-    public Generator getGenerator() {
-        return this.generator;
+    public void informBranchPoint() {
+        // this can be overwritten in subclasses
     }
 
     /**
-     * Informs pipeline we have come across a branch point
-     * Default Behaviour is do nothing
+     * Get the generator - used for content aggregation
      */
-    public void informBranchPoint() {
-        // this can be overwritten in subclasses
+    public Generator getGenerator() {
+        return this.generator;
     }
 
     /**
@@ -214,11 +214,11 @@
     throws ProcessingException {
         if (this.generator != null) {
             throw new ProcessingException ("Generator already set. Cannot set generator '"
+ role +
-                "' at " + getLocation(param));
+                                           "' at " + getLocation(param));
         }
         if (this.reader != null) {
             throw new ProcessingException ("Reader already set. Cannot set generator '" +
role +
-                "' at " + getLocation(param));
+                                           "' at " + getLocation(param));
         }
         try {
             this.generatorSelector = (ComponentSelector) this.newManager.lookup(Generator.ROLE
+ "Selector");
@@ -251,11 +251,11 @@
         if (this.reader != null) {
             // Should normally never happen as setting a reader starts pipeline processing
             throw new ProcessingException ("Reader already set. Cannot add transformer '"
+ role +
-                "' at " + getLocation(param));
+                                           "' at " + getLocation(param));
         }
         if (this.generator == null) {
             throw new ProcessingException ("Must set a generator before adding transformer
'" + role +
-                "' at " + getLocation(param));
+                                           "' at " + getLocation(param));
         }
         ComponentSelector selector = null;
         try {
@@ -282,16 +282,16 @@
         if (this.serializer != null) {
             // Should normally not happen as adding a serializer starts pipeline processing
             throw new ProcessingException ("Serializer already set. Cannot set serializer
'" + role +
-                "' at " + getLocation(param));
+                                           "' at " + getLocation(param));
         }
         if (this.reader != null) {
             // Should normally never happen as setting a reader starts pipeline processing
             throw new ProcessingException ("Reader already set. Cannot set serializer '"
+ role +
-                "' at " + getLocation(param));
+                                           "' at " + getLocation(param));
         }
         if (this.generator == null) {
             throw new ProcessingException ("Must set a generator before setting serializer
'" + role +
-                "' at " + getLocation(param));
+                                           "' at " + getLocation(param));
         }
 
         try {
@@ -320,12 +320,12 @@
         if (this.reader != null) {
             // Should normally never happen as setting a reader starts pipeline processing
             throw new ProcessingException ("Reader already set. Cannot set reader '" + role
+
-                "' at " + getLocation(param));
+                                           "' at " + getLocation(param));
         }
         if (this.generator != null) {
             // Should normally never happen as setting a reader starts pipeline processing
             throw new ProcessingException ("Generator already set. Cannot use reader '" +
role +
-                "' at " + getLocation(param));
+                                           "' at " + getLocation(param));
         }
 
         try {
@@ -344,6 +344,7 @@
         this.sitemapReaderMimeType = readerSelector.getMimeTypeForHint(role);
     }
 
+
     /**
      * Sanity check
      * @return true if the pipeline is 'sane', false otherwise.
@@ -491,8 +492,8 @@
     }
 
     /**
-     * Prepare an internal processing
-     * @param environment          The current environment.
+     * Prepare an internal processing.
+     * @param environment The current environment.
      * @throws ProcessingException
      */
     public void prepareInternal(Environment environment)
@@ -508,7 +509,6 @@
     throws ProcessingException {
 
         setMimeTypeForSerializer(environment);
-
         try {
             if (this.lastConsumer == null) {
                 // internal processing
@@ -536,6 +536,7 @@
             // TODO: Unwrap SAXException ?
             throw new ProcessingException("Failed to execute pipeline.", e);
         }
+
         return true;
     }
 
@@ -575,7 +576,7 @@
         //     the reader can use MIME type declared in WEB-INF/web.xml or
         //     by the server.
         if ( this.readerMimeType != null ) {
-            // there was a mime-type defined on map:read in the sitemap 
+            // there was a mime-type defined on map:read in the sitemap
             environment.setContentType(this.readerMimeType);
         } else if ( this.sitemapReaderMimeType != null ) {
             // there was a mime-type defined on map:reader in the sitemap
@@ -587,7 +588,7 @@
                 environment.setContentType(mimeType);
             }
             // If no mimeType available, leave to to upstream proxy
-            // or browser to deduce content-type from URL extension.    
+            // or browser to deduce content-type from URL extension.
         }
     }
 
@@ -625,7 +626,7 @@
     }
 
     protected boolean checkIfModified(Environment environment,
-                                        long lastModified)
+                                      long lastModified)
     throws ProcessingException {
         // has the read resource been modified?
         if(!environment.isResponseModified(lastModified)) {
@@ -663,7 +664,7 @@
 
     public void recycle() {
         this.prepared = false;
-        
+
         // Release reader.
         if (this.readerSelector != null) {
             this.readerSelector.release(this.reader);
@@ -709,7 +710,7 @@
 
     /**
      * Process the given <code>Environment</code>, but do not use the
-     * serializer. Instead the sax events are streamed to the XMLConsumer.
+     * serializer. Instead all SAX events are streamed to the XMLConsumer.
      */
     public boolean process(Environment environment, XMLConsumer consumer)
     throws ProcessingException {
@@ -717,6 +718,7 @@
         if (this.reader != null) {
             throw new ProcessingException("Streaming of an internal pipeline is not possible
with a reader.");
         }
+
         connectPipeline(environment);
         return processXMLPipeline(environment);
     }
@@ -732,6 +734,17 @@
     }
 
     /**
+     * Return the key for the event pipeline
+     * If the "event pipeline" (= the complete pipeline without the
+     * serializer) is cacheable and valid, return a key.
+     * Otherwise return <code>null</code>
+     */
+    public String getKeyForEventPipeline() {
+        return null;
+    }
+
+
+    /**
      * Parse the expires parameter
      */
     private long parseExpires(String expire) {
@@ -801,13 +814,6 @@
         }
 
         return expires;
-    }
-
-    /* (non-Javadoc)
-     * @see org.apache.cocoon.components.pipeline.ProcessingPipeline#getKeyForEventPipeline()
-     */
-    public String getKeyForEventPipeline() {
-        return null;
     }
 
     protected String getLocation(Parameters param) {

Modified: cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/ProcessingPipeline.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/ProcessingPipeline.java?view=diff&r1=157248&r2=157249
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/ProcessingPipeline.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/java/org/apache/cocoon/components/pipeline/ProcessingPipeline.java
Sat Mar 12 04:23:50 2005
@@ -1,12 +1,12 @@
 /*
- * Copyright 1999-2004 The Apache Software Foundation.
- * 
+ * Copyright 1999-2005 The Apache Software Foundation.
+ *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * 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.
@@ -18,46 +18,46 @@
 import org.apache.avalon.framework.component.Component;
 import org.apache.avalon.framework.component.Recomposable;
 import org.apache.avalon.framework.parameters.Parameters;
+
 import org.apache.cocoon.ProcessingException;
 import org.apache.cocoon.environment.Environment;
 import org.apache.cocoon.generation.Generator;
 import org.apache.cocoon.xml.XMLConsumer;
+
 import org.apache.excalibur.source.SourceValidity;
 
 /**
  * A <code>ProcessingPipeline<code> produces the response for a given request.
  * It is assembled according to the commands in the sitemap and can either
  * <ul>
- *  <li>collect a <code>Reader</code> and let it produce a character stream</li>
- *  <li>or connect a <code>Generator</code> with zero or more
- *      <code>Transformer</code>s and a <code>Serializer</code> and
let them
+ *  <li>Collect a <code>Reader</code> and let it produce a byte stream,</li>
+ *  <li>Or connect a <code>Generator</code> with zero or more
+ *      <code>Transformer</code>s and a <code>Serializer</code>,
and let them
  *      produce the byte stream. This pipeline uses SAX events for
  *      communication.
  *  </li>
  * </ul>
  *
- * <p>
- * A <code>ProcessingPipeline</code> is <code>Recomposable</code>
since the
- * <code>ComponentManager</code> used to get the generato, transformers etc.
+ * <p>A <code>ProcessingPipeline</code> is <code>Recomposable</code>
since the
+ * <code>ComponentManager</code> used to get the generator, transformers, etc.
  * depends on the pipeline assembly engine where they are defined (i.e. a given
  * sitemap file).
  *
  * @author <a href="mailto:cziegeler@apache.org">Carsten Ziegeler</a>
  * @author <a href="mailto:Giacomo.Pati@pwr.ch">Giacomo Pati</a>
- * @version CVS $Id: ProcessingPipeline.java,v 1.4 2004/03/05 13:02:50 bdelacretaz Exp $
+ * @version $Id$
  */
-public interface ProcessingPipeline
-       extends   Component, Recomposable {
+public interface ProcessingPipeline extends Component, Recomposable {
 
     String ROLE = ProcessingPipeline.class.getName();
 
     /**
-     * Setup this component
+     * Setup this component.
      */
     void setup(Parameters params);
 
     /**
-     * Release this component
+     * Release this component.
      * If you get an instance not by a component manager but for example
      * by a processor, you have to release this component by calling
      * this method and NOT by using a component manager!
@@ -76,7 +76,7 @@
      * @param param the parameters for the generator.
      * @throws ProcessingException if the generator couldn't be obtained.
      */
-    void setGenerator (String role, String source, Parameters param, Parameters hintParam)
+    void setGenerator(String role, String source, Parameters param, Parameters hintParam)
     throws ProcessingException;
 
     /**
@@ -87,7 +87,7 @@
     /**
      * Informs pipeline we have come across a branch point
      */
-    void informBranchPoint(); 
+    void informBranchPoint();
 
     /**
      * Add a transformer at the end of the pipeline.
@@ -101,21 +101,21 @@
      * @param param the parameters for the transfomer.
      * @throws ProcessingException if the generator couldn't be obtained.
      */
-    void addTransformer (String role, String source, Parameters param, Parameters hintParam)
+    void addTransformer(String role, String source, Parameters param, Parameters hintParam)
     throws ProcessingException;
 
     /**
      * Set the serializer for this pipeline
      * @param mimeType Can be null
      */
-    void setSerializer (String role, String source, Parameters param, Parameters hintParam,
String mimeType)
+    void setSerializer(String role, String source, Parameters param, Parameters hintParam,
String mimeType)
     throws ProcessingException;
 
     /**
      * Set the reader for this pipeline
      * @param mimeType Can be null
      */
-    void setReader (String role, String source, Parameters param, String mimeType)
+    void setReader(String role, String source, Parameters param, String mimeType)
     throws ProcessingException;
 
     /**
@@ -147,7 +147,7 @@
      * Otherwise return <code>null</code>
      */
     SourceValidity getValidityForEventPipeline();
-    
+
     /**
      * Return the key for the event pipeline
      * If the "event pipeline" (= the complete pipeline without the



Mime
View raw message