svn commit: r1347566 - in /cocoon/cocoon3/trunk: cocoon-sax/src/main/java/org/apache/cocoon/sax/component/ cocoon-sax/src/main/java/org/apache/cocoon/sax/util/ cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/component/ cocoon-stringtemplate/src/...

[email protected]
Newsgroups gmane.text.xml.cocoon.cvs
Message-ID <[email protected]>
Author: ilgrosso
Date: Thu Jun  7 10:52:16 2012
New Revision: 1347566

URL: http://svn.apache.org/viewvc?rev=1347566&view=rev
Log:
Formatting commit - please ignore

Modified:
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/SchemaProcessorTransformer.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XMLGenerator.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XSLTTransformer.java
    cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/InMemoryLRUResourceCache.java
    cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/component/FileReaderComponent.java
    cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java
    cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateReader.java
    cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateTransformer.java

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/SchemaProcessorTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/SchemaProcessorTransformer.java?rev=1347566&r1=1347565&r2=1347566&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/SchemaProcessorTransformer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/SchemaProcessorTransformer.java Thu Jun  7 10:52:16 2012
@@ -22,12 +22,10 @@ import java.io.File;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.util.Map;
-
 import javax.xml.XMLConstants;
 import javax.xml.validation.Schema;
 import javax.xml.validation.SchemaFactory;
 import javax.xml.validation.ValidatorHandler;
-
 import org.apache.cocoon.pipeline.SetupException;
 import org.apache.cocoon.pipeline.util.StringRepresentation;
 import org.apache.cocoon.sax.AbstractSAXTransformer;
@@ -44,16 +42,13 @@ public final class SchemaProcessorTransf
     /**
      * Logger.
      */
-    private static final Logger LOG =
-            LoggerFactory.getLogger(SchemaProcessorTransformer.class);
+    private static final Logger LOG = LoggerFactory.getLogger(SchemaProcessorTransformer.class);
 
     private static final String SOURCE = "source";
 
-    private static final InMemoryLRUResourceCache<Schema> SCHEMA_LRU_CACHE =
-            new InMemoryLRUResourceCache<Schema>();
+    private static final InMemoryLRUResourceCache<Schema> SCHEMA_LRU_CACHE = new InMemoryLRUResourceCache<Schema>();
 
-    private static final SchemaFactory SCHEMA_FACTORY =
-            SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+    private static final SchemaFactory SCHEMA_FACTORY = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
 
     private Schema schema;
 
@@ -81,8 +76,7 @@ public final class SchemaProcessorTransf
     @Override
     protected void setSAXConsumer(SAXConsumer xmlConsumer) {
         ValidatorHandler validatorHandler = this.schema.newValidatorHandler();
-        validatorHandler.setErrorHandler(new SchemaErrorHandler(LOG,
-                this.source.toExternalForm()));
+        validatorHandler.setErrorHandler(new SchemaErrorHandler(LOG, this.source.toExternalForm()));
         validatorHandler.setContentHandler(xmlConsumer);
 
         SAXConsumerAdapter saxConsumerAdapter = new SAXConsumerAdapter();
@@ -92,8 +86,7 @@ public final class SchemaProcessorTransf
 
     private void init(URL source) {
         if (source == null) {
-            throw new IllegalArgumentException("The parameter 'source' "
-                    + "mustn't be null.");
+            throw new IllegalArgumentException("The parameter 'source' mustn't be null.");
         }
 
         this.source = source;
@@ -109,11 +102,8 @@ public final class SchemaProcessorTransf
 
         this.schema = null;
         if (SCHEMA_LRU_CACHE.containsKey(source.toExternalForm())) {
-            ValidityValue<Schema> cacheEntry =
-                    SCHEMA_LRU_CACHE.get(source.toExternalForm());
-            if (schemaFile == null || cacheEntry.getLastModified()
-                    >= schemaFile.lastModified()) {
-
+            ValidityValue<Schema> cacheEntry = SCHEMA_LRU_CACHE.get(source.toExternalForm());
+            if (schemaFile == null || cacheEntry.getLastModified() >= schemaFile.lastModified()) {
                 this.schema = cacheEntry.getValue();
             }
         }
@@ -124,8 +114,7 @@ public final class SchemaProcessorTransf
                         : SCHEMA_FACTORY.newSchema(source);
 
                 ValidityValue<Schema> cacheEntry = (schemaFile != null)
-                        ? new ValidityValue<Schema>(this.schema,
-                        schemaFile.lastModified())
+                        ? new ValidityValue<Schema>(this.schema, schemaFile.lastModified())
                         : new ValidityValue<Schema>(this.schema);
                 SCHEMA_LRU_CACHE.put(source.toExternalForm(), cacheEntry);
             } catch (SAXException e) {

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XMLGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XMLGenerator.java?rev=1347566&r1=1347565&r2=1347566&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XMLGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XMLGenerator.java Thu Jun  7 10:52:16 2012
@@ -30,7 +30,6 @@ import java.net.URLConnection;
 import java.util.Arrays;
 import java.util.Map;
 import org.apache.cocoon.pipeline.PipelineException;
-
 import org.apache.cocoon.pipeline.ProcessingException;
 import org.apache.cocoon.pipeline.SetupException;
 import org.apache.cocoon.pipeline.caching.CacheKey;
@@ -50,17 +49,14 @@ import org.w3c.dom.Node;
 import org.xml.sax.SAXException;
 
 /**
- * General purpose SAX generator that produces SAX events from
- * different sources.
+ * General purpose SAX generator that produces SAX events from different sources.
  */
-public class XMLGenerator extends AbstractSAXGenerator
-        implements CachingPipelineComponent {
+public class XMLGenerator extends AbstractSAXGenerator implements CachingPipelineComponent {
 
     /**
      * Logger.
      */
-    private static final Logger LOG =
-            LoggerFactory.getLogger(XMLGenerator.class);
+    private static final Logger LOG = LoggerFactory.getLogger(XMLGenerator.class);
 
     private transient Starter generator;
 
@@ -70,14 +66,12 @@ public class XMLGenerator extends Abstra
 
     public XMLGenerator(final byte[] bytes) {
         super();
-        this.generator = new ByteArrayGenerator(
-                bytes == null ? null : bytes.clone());
+        this.generator = new ByteArrayGenerator(bytes == null ? null : bytes.clone());
     }
 
     public XMLGenerator(final byte[] bytes, final String encoding) {
         super();
-        this.generator = new ByteArrayGenerator(
-                bytes == null ? null : bytes.clone(), encoding);
+        this.generator = new ByteArrayGenerator(bytes == null ? null : bytes.clone(), encoding);
     }
 
     public XMLGenerator(final File file) {
@@ -128,16 +122,13 @@ public class XMLGenerator extends Abstra
      * @see org.apache.cocoon.sax.AbstractSAXProducer#setConfiguration(java.util.Map)
      */
     @Override
-    public void setConfiguration(
-            final Map<String, ? extends Object> configuration) {
-        ((URLGenerator) this.generator).setSource(
-                (URL) configuration.get("source"));
+    public void setConfiguration(final Map<String, ? extends Object> configuration) {
+        ((URLGenerator) this.generator).setSource((URL) configuration.get("source"));
     }
 
     @Override
     public String toString() {
-        return StringRepresentation.buildString(this,
-                "internalGenerator=" + this.generator);
+        return StringRepresentation.buildString(this, "internalGenerator=" + this.generator);
     }
 
     private class ByteArrayGenerator extends AbstractSAXGenerator {
@@ -163,33 +154,27 @@ public class XMLGenerator extends Abstra
         @Override
         public void execute() {
             try {
-                LOG.debug("Using a byte array as "
-                        + "source to produce SAX events.");
+                LOG.debug("Using a byte array as source to produce SAX events.");
 
                 if (this.encoding == null) {
-                    XMLUtils.toSax(new ByteArrayInputStream(this.bytes),
-                            XMLGenerator.this.getSAXConsumer());
+                    XMLUtils.toSax(new ByteArrayInputStream(this.bytes), XMLGenerator.this.getSAXConsumer());
                 } else {
-                    XMLUtils.toSax(new String(this.bytes, this.encoding),
-                            XMLGenerator.this.getSAXConsumer());
+                    XMLUtils.toSax(new String(this.bytes, this.encoding), XMLGenerator.this.getSAXConsumer());
                 }
             } catch (PipelineException e) {
                 LOG.error("Pipeline expcetion thrown", e);
                 throw e;
             } catch (UnsupportedEncodingException e) {
-                throw new ProcessingException("The encoding " + this.encoding
-                        + " is not supported.", e);
+                throw new ProcessingException("The encoding " + this.encoding + " is not supported.", e);
             } catch (Exception e) {
-                throw new ProcessingException("Can't parse byte array "
-                        + Arrays.toString(this.bytes), e);
+                throw new ProcessingException("Can't parse byte array " + Arrays.toString(this.bytes), e);
             }
         }
 
         @Override
         public String toString() {
             return StringRepresentation.buildString(this,
-                    "bytes=" + Arrays.toString(this.bytes),
-                    "encoding=" + this.encoding);
+                    "bytes=" + Arrays.toString(this.bytes), "encoding=" + this.encoding);
         }
     }
 
@@ -205,7 +190,7 @@ public class XMLGenerator extends Abstra
 
             this.file = file;
         }
-        
+
         /**
          * {@inheritDoc}
          *
@@ -231,18 +216,14 @@ public class XMLGenerator extends Abstra
         @Override
         public void execute() {
             try {
-                LOG.debug("Using file {}"
-                        + " as source to produce SAX events.",
-                        this.file.getAbsolutePath());
+                LOG.debug("Using file {} as source to produce SAX events.", this.file.getAbsolutePath());
 
-                XMLUtils.toSax(new FileInputStream(this.file),
-                        XMLGenerator.this.getSAXConsumer());
+                XMLUtils.toSax(new FileInputStream(this.file), XMLGenerator.this.getSAXConsumer());
             } catch (PipelineException e) {
                 LOG.error("Pipeline expcetion thrown", e);
                 throw e;
             } catch (Exception e) {
-                throw new ProcessingException("Can't read or parse file "
-                        + this.file.getAbsolutePath(), e);
+                throw new ProcessingException("Can't read or parse file " + this.file.getAbsolutePath(), e);
             }
         }
 
@@ -268,25 +249,20 @@ public class XMLGenerator extends Abstra
         @Override
         public void execute() {
             try {
-                LOG.debug("Using input stream {}"
-                        + " as source to produce SAX events.",
-                        this.inputStream);
+                LOG.debug("Using input stream {} as source to produce SAX events.", this.inputStream);
 
-                XMLUtils.toSax(this.inputStream,
-                        XMLGenerator.this.getSAXConsumer());
+                XMLUtils.toSax(this.inputStream, XMLGenerator.this.getSAXConsumer());
             } catch (PipelineException e) {
                 LOG.error("Pipeline expcetion thrown", e);
                 throw e;
             } catch (Exception e) {
-                throw new ProcessingException("Can't read or parse file "
-                        + this.inputStream, e);
+                throw new ProcessingException("Can't read or parse file " + this.inputStream, e);
             }
         }
 
         @Override
         public String toString() {
-            return StringRepresentation.buildString(this, "inputStream="
-                    + this.inputStream);
+            return StringRepresentation.buildString(this, "inputStream=" + this.inputStream);
         }
     }
 
@@ -307,13 +283,11 @@ public class XMLGenerator extends Abstra
         public void execute() {
             LOG.debug("Using a DOM node to produce SAX events.");
 
-            final DOMStreamer streamer = new DOMStreamer(
-                    XMLGenerator.this.getSAXConsumer());
+            final DOMStreamer streamer = new DOMStreamer(XMLGenerator.this.getSAXConsumer());
             try {
                 streamer.stream(this.node);
             } catch (SAXException e) {
-                throw new SetupException("Can't stream DOM node + "
-                        + this.node, e);
+                throw new SetupException("Can't stream DOM node " + this.node, e);
             }
         }
 
@@ -350,8 +324,7 @@ public class XMLGenerator extends Abstra
 
         @Override
         public String toString() {
-            return StringRepresentation.buildString(this,
-                    "saxBuffer=" + this.saxBuffer);
+            return StringRepresentation.buildString(this, "saxBuffer=" + this.saxBuffer);
         }
     }
 
@@ -379,8 +352,7 @@ public class XMLGenerator extends Abstra
             try {
                 LOG.debug("Using a string to produce SAX events.");
 
-                XMLUtils.toSax(this.xmlString,
-                        XMLGenerator.this.getSAXConsumer());
+                XMLUtils.toSax(this.xmlString, XMLGenerator.this.getSAXConsumer());
             } catch (PipelineException e) {
                 LOG.error("Pipeline exception thrown", e);
                 throw e;
@@ -391,8 +363,7 @@ public class XMLGenerator extends Abstra
 
         @Override
         public String toString() {
-            return StringRepresentation.buildString(this,
-                    "xmlString=" + this.xmlString);
+            return StringRepresentation.buildString(this, "xmlString=" + this.xmlString);
         }
     }
 
@@ -409,14 +380,12 @@ public class XMLGenerator extends Abstra
         /**
          * {@inheritDoc}
          *
-         * @see org.apache.cocoon.pipeline.component.CachingPipelineComponent
-         * #constructCacheKey()
+         * @see org.apache.cocoon.pipeline.component.CachingPipelineComponent #constructCacheKey()
          */
         @Override
         public CacheKey constructCacheKey() {
             if (this.source == null) {
-                throw new SetupException(this.getClass().getSimpleName()
-                        + " has no source.");
+                throw new SetupException(this.getClass().getSimpleName() + " has no source.");
             }
 
             CacheKey cacheKey = null;
@@ -426,8 +395,7 @@ public class XMLGenerator extends Abstra
                 cacheKey = new TimestampCacheKey(this.source,
                         connection.getLastModified());
             } catch (IOException e) {
-                LOG.error("Can't construct cache key. "
-                        + "Error while connecting to " + this.source, e);
+                LOG.error("Can't construct cache key. " + "Error while connecting to " + this.source, e);
             } finally {
                 if (connection != null) {
                     URLConnectionUtils.closeQuietly(connection);
@@ -445,16 +413,13 @@ public class XMLGenerator extends Abstra
         @Override
         public void execute() {
             if (this.source == null) {
-                throw new ProcessingException(this.getClass().getSimpleName()
-                        + " has no source.");
+                throw new ProcessingException(this.getClass().getSimpleName() + " has no source.");
             }
 
-            LOG.debug("Using the URL {}"
-                    + " to produce SAX events.", this.source);
+            LOG.debug("Using the URL {} to produce SAX events.", this.source);
 
             try {
-                XMLUtils.toSax(this.source.openConnection(),
-                        XMLGenerator.this.getSAXConsumer());
+                XMLUtils.toSax(this.source.openConnection(), XMLGenerator.this.getSAXConsumer());
             } catch (IOException e) {
                 throw new ProcessingException("Can't open connection to "
                         + this.source, e);

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XSLTTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XSLTTransformer.java?rev=1347566&r1=1347565&r2=1347566&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XSLTTransformer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/component/XSLTTransformer.java Thu Jun  7 10:52:16 2012
@@ -51,26 +51,22 @@ public class XSLTTransformer extends Abs
     /**
      * The memory based LRU cache for already loaded XSLTs.
      */
-    private static final InMemoryLRUResourceCache<Templates> XSLT_CACHE =
-            new InMemoryLRUResourceCache<Templates>();
+    private static final InMemoryLRUResourceCache<Templates> XSLT_CACHE = new InMemoryLRUResourceCache<Templates>();
 
     /**
      * A generic transformer factory to parse XSLTs.
      */
-    private static final SAXTransformerFactory TRAX_FACTORY =
-            createNewSAXTransformerFactory();
+    private static final SAXTransformerFactory TRAX_FACTORY = createNewSAXTransformerFactory();
 
     /**
      * The XSLT parameters name pattern.
      */
-    private static final Pattern XSLT_PARAMETER_NAME_PATTERN =
-            Pattern.compile("[a-zA-Z_][\\w\\-\\.]*");
+    private static final Pattern XSLT_PARAMETER_NAME_PATTERN = Pattern.compile("[a-zA-Z_][\\w\\-\\.]*");
 
     /**
      * This class log.
      */
-    private static final Logger LOG =
-            LoggerFactory.getLogger(XSLTTransformer.class);
+    private static final Logger LOG = LoggerFactory.getLogger(XSLTTransformer.class);
 
     /**
      * The XSLT parameters reference.
@@ -104,38 +100,32 @@ public class XSLTTransformer extends Abs
     }
 
     /**
-     * Creates a new transformer reading the XSLT from the URL source and
-     * setting the TransformerFactory attributes.
+     * Creates a new transformer reading the XSLT from the URL source and setting the TransformerFactory attributes.
      *
-     * This constructor is useful when users want to perform XSLT transformation
-     * using <a href="http://xml.apache.org/xalan-j/xsltc_usage.html">xsltc</a>.
+     * This constructor is useful when users want to perform XSLT transformation using <a
+     * href="http://xml.apache.org/xalan-j/xsltc_usage.html">xsltc</a>.
      *
      * @param source the XSLT URL source
      * @param attributes the Transformer Factory attributes
      */
-    public XSLTTransformer(final URL source,
-            final Map<String, Object> attributes) {
-
+    public XSLTTransformer(final URL source, final Map<String, Object> attributes) {
         super();
         this.loadXSLT(source, attributes);
     }
 
     /**
-     * Method useful to create a new transformer reading the XSLT from the URL
-     * source and setting the Transformer Factory attributes.
+     * Method useful to create a new transformer reading the XSLT from the URL source and setting the Transformer
+     * Factory attributes.
      *
-     * This method is useful when users want to perform XSLT transformation
-     * using <a href="http://xml.apache.org/xalan-j/xsltc_usage.html">xsltc</a>.
+     * This method is useful when users want to perform XSLT transformation using <a
+     * href="http://xml.apache.org/xalan-j/xsltc_usage.html">xsltc</a>.
      *
      * @param source the XSLT URL source
      * @param attributes the Transformer Factory attributes
      */
-    private void loadXSLT(final URL source,
-            final Map<String, Object> attributes) {
-
+    private void loadXSLT(final URL source, final Map<String, Object> attributes) {
         if (source == null) {
-            throw new IllegalArgumentException("The parameter 'source' "
-                    + "mustn't be null.");
+            throw new IllegalArgumentException("The parameter 'source' mustn't be null.");
         }
 
         this.source = source;
@@ -145,19 +135,15 @@ public class XSLTTransformer extends Abs
             xsltFile = "file".equals(this.source.getProtocol())
                     ? new File(this.source.toURI()) : null;
         } catch (URISyntaxException e) {
-            throw new IllegalArgumentException(
-                    "Invalid source specified: " + source, e);
+            throw new IllegalArgumentException("Invalid source specified: " + source, e);
         }
 
         this.templates = null;
         // check the XSLT is in the cache first
         if (XSLT_CACHE.containsKey(this.source.toExternalForm())) {
             // get the XSLT directly from the cache
-            ValidityValue<Templates> cacheEntry =
-                    XSLT_CACHE.get(this.source.toExternalForm());
-            if (xsltFile == null || cacheEntry.getLastModified()
-                    >= xsltFile.lastModified()) {
-
+            ValidityValue<Templates> cacheEntry = XSLT_CACHE.get(this.source.toExternalForm());
+            if (xsltFile == null || cacheEntry.getLastModified() >= xsltFile.lastModified()) {
                 this.templates = cacheEntry.getValue();
             }
         }
@@ -171,8 +157,7 @@ public class XSLTTransformer extends Abs
             if (attributes != null && !attributes.isEmpty()) {
                 transformerFactory = createNewSAXTransformerFactory();
                 for (Entry<String, Object> attribute : attributes.entrySet()) {
-                    transformerFactory.setAttribute(
-                            attribute.getKey(), attribute.getValue());
+                    transformerFactory.setAttribute(attribute.getKey(), attribute.getValue());
                 }
             } else {
                 transformerFactory = TRAX_FACTORY;
@@ -182,13 +167,11 @@ public class XSLTTransformer extends Abs
                 this.templates = transformerFactory.newTemplates(urlSource);
                 // store the XSLT into the cache for future reuse
                 ValidityValue<Templates> cacheEntry = (xsltFile != null)
-                        ? new ValidityValue<Templates>(this.templates,
-                        xsltFile.lastModified())
+                        ? new ValidityValue<Templates>(this.templates, xsltFile.lastModified())
                         : new ValidityValue<Templates>(this.templates);
                 XSLT_CACHE.put(this.source.toExternalForm(), cacheEntry);
             } catch (TransformerConfigurationException e) {
-                throw new SetupException("Impossible to read XSLT from '"
-                        + this.source.toExternalForm()
+                throw new SetupException("Impossible to read XSLT from '" + this.source.toExternalForm()
                         + "', see nested exception", e);
             }
         }
@@ -211,21 +194,18 @@ public class XSLTTransformer extends Abs
      * {@inheritDoc}
      */
     @Override
-    public void setConfiguration(
-            final Map<String, ? extends Object> configuration) {
-
+    public void setConfiguration(final Map<String, ? extends Object> configuration) {
         try {
             this.source = (URL) configuration.get("source");
         } catch (ClassCastException cce) {
-            throw new SetupException("The configuration value of 'source' "
-                    + "can't be cast to java.net.URL.", cce);
+            throw new SetupException("The configuration value of 'source' can't be cast to java.net.URL.", cce);
         }
 
         if (this.source != null) {
             Object attributesObj = configuration.get("attributes");
             if (attributesObj != null && attributesObj instanceof Map) {
                 @SuppressWarnings("unchecked")
-                Map<String,Object> attributesMap = (Map<String,Object>) attributesObj;
+                Map<String, Object> attributesMap = (Map<String, Object>) attributesObj;
                 this.loadXSLT(this.source, attributesMap);
             } else {
                 this.loadXSLT(this.source, null);
@@ -248,8 +228,7 @@ public class XSLTTransformer extends Abs
     protected void setSAXConsumer(final SAXConsumer consumer) {
         TransformerHandler transformerHandler;
         try {
-            transformerHandler = TRAX_FACTORY.newTransformerHandler(
-                    this.templates);
+            transformerHandler = TRAX_FACTORY.newTransformerHandler(this.templates);
         } catch (Exception ex) {
             throw new SetupException(
                     "Could not initialize transformer handler.", ex);
@@ -282,7 +261,7 @@ public class XSLTTransformer extends Abs
         saxConsumerAdapter.setContentHandler(transformerHandler);
         super.setSAXConsumer(saxConsumerAdapter);
     }
-        
+
     /**
      * {@inheritDoc}
      *
@@ -296,7 +275,7 @@ public class XSLTTransformer extends Abs
 
         return new TimestampCacheKey(this.source, URLManipulationUtils.getLastModified(this.source));
     }
-    
+
     /**
      * Utility method to create a new transformer factory.
      *

Modified: cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/InMemoryLRUResourceCache.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/InMemoryLRUResourceCache.java?rev=1347566&r1=1347565&r2=1347566&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/InMemoryLRUResourceCache.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sax/src/main/java/org/apache/cocoon/sax/util/InMemoryLRUResourceCache.java Thu Jun  7 10:52:16 2012
@@ -37,15 +37,13 @@ public final class InMemoryLRUResourceCa
     /**
      * The fixed cache capacity.
      */
-    private static final int CACHE_CAPACITY =
-            (int) Math.ceil(CACHE_SIZE / LOAD_FACTOR) + 1;
+    private static final int CACHE_CAPACITY = (int) Math.ceil(CACHE_SIZE / LOAD_FACTOR) + 1;
 
     /**
      * The map that implements the LRU cache.
      */
     private final Map<String, ValidityValue<V>> data =
-            new LinkedHashMap<String, ValidityValue<V>>(
-            CACHE_CAPACITY, LOAD_FACTOR) {
+            new LinkedHashMap<String, ValidityValue<V>>(CACHE_CAPACITY, LOAD_FACTOR) {
 
                 private static final long serialVersionUID = 149779258494859880L;
 
@@ -53,9 +51,7 @@ public final class InMemoryLRUResourceCa
                  * {@inheritDoc}
                  */
                 @Override
-                protected boolean removeEldestEntry(
-                        final Map.Entry<String, ValidityValue<V>> eldest) {
-
+                protected boolean removeEldestEntry(final Map.Entry<String, ValidityValue<V>> eldest) {
                     return size() > CACHE_SIZE;
                 }
             };
@@ -64,8 +60,7 @@ public final class InMemoryLRUResourceCa
      * Returns true if this cache contains a mapping for the specified key.
      *
      * @param key key whose presence in this map is to be tested.
-     * @return true if this map contains a mapping for the specified key, false
-     *         otherwise.
+     * @return true if this map contains a mapping for the specified key, false otherwise.
      */
     public boolean containsKey(final String key) {
         checkKey(key);
@@ -73,14 +68,12 @@ public final class InMemoryLRUResourceCa
     }
 
     /**
-     * Returns the value to which the specified key is cached, or null if this
-     * cache contains no mapping for the key.
+     * Returns the value to which the specified key is cached, or null if this cache contains no mapping for the key.
      *
      * Key parameter must not be null.
      *
      * @param key the key has to be checked it is present, it must not be null.
-     * @return the value to which the specified key is cached, null if this
-     *         cache contains no mapping for the key.
+     * @return the value to which the specified key is cached, null if this cache contains no mapping for the key.
      */
     public ValidityValue<V> get(final String key) {
         checkKey(key);

Modified: cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/component/FileReaderComponent.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/component/FileReaderComponent.java?rev=1347566&r1=1347565&r2=1347566&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/component/FileReaderComponent.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sitemap/src/main/java/org/apache/cocoon/sitemap/component/FileReaderComponent.java Thu Jun  7 10:52:16 2012
@@ -22,7 +22,6 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.net.URL;
 import java.net.URLConnection;
-
 import org.apache.cocoon.pipeline.ProcessingException;
 import org.apache.cocoon.pipeline.caching.CacheKey;
 import org.apache.cocoon.pipeline.caching.TimestampCacheKey;
@@ -36,9 +35,8 @@ public class FileReaderComponent extends
     /**
      * Logger.
      */
-    private static final Logger LOG =
-            LoggerFactory.getLogger(FileReaderComponent.class);
-    
+    private static final Logger LOG = LoggerFactory.getLogger(FileReaderComponent.class);
+
     public FileReaderComponent() {
         super();
     }
@@ -49,9 +47,10 @@ public class FileReaderComponent extends
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.pipeline.component.CachingPipelineComponent#constructCacheKey()
      */
+    @Override
     public CacheKey constructCacheKey() {
         try {
             URLConnection connection = this.source.openConnection();
@@ -67,18 +66,18 @@ public class FileReaderComponent extends
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.pipeline.component.Starter#execute()
      */
+    @Override
     public void execute() {
-        InputStream inputStream = null;
         if (this.source == null) {
             throw new IllegalArgumentException("FileReaderComponent has no source configured to read from.");
         }
         URLConnection connection = null;
         try {
             connection = this.source.openConnection();
-            inputStream = connection.getInputStream();
+            InputStream inputStream = connection.getInputStream();
 
             byte[] data = new byte[1024];
             while (true) {
@@ -102,9 +101,10 @@ public class FileReaderComponent extends
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.cocoon.pipeline.component.Finisher#getContentType()
      */
+    @Override
     public String getContentType() {
         if (this.mimeType != null) {
             return this.mimeType;
@@ -123,7 +123,7 @@ public class FileReaderComponent extends
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see java.lang.Object#toString()
      */
     @Override

Modified: cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java?rev=1347566&r1=1347565&r2=1347566&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java (original)
+++ cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateGenerator.java Thu Jun  7 10:52:16 2012
@@ -39,14 +39,12 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.xml.sax.InputSource;
 
-public class StringTemplateGenerator extends AbstractSAXProducer
-        implements Starter, CachingPipelineComponent {
+public class StringTemplateGenerator extends AbstractSAXProducer implements Starter, CachingPipelineComponent {
 
     /**
      * Logger.
      */
-    private static final Logger LOG =
-            LoggerFactory.getLogger(StringTemplateGenerator.class);
+    private static final Logger LOG = LoggerFactory.getLogger(StringTemplateGenerator.class);
 
     protected Map<String, Object> parameters = new HashMap<String, Object>();
 
@@ -91,6 +89,7 @@ public class StringTemplateGenerator ext
      *
      * @see org.apache.cocoon.pipeline.component.CachingPipelineComponent#constructCacheKey()
      */
+    @Override
     public CacheKey constructCacheKey() {
         if (this.url == null) {
             return null;
@@ -99,10 +98,8 @@ public class StringTemplateGenerator ext
         final CompoundCacheKey cacheKey = new CompoundCacheKey();
 
         try {
-            cacheKey.addCacheKey(new TimestampCacheKey(this.url,
-                    this.url.openConnection().getLastModified()));
-            cacheKey.addCacheKey(new ParameterCacheKey("contextParameters",
-                    this.parameters));
+            cacheKey.addCacheKey(new TimestampCacheKey(this.url, this.url.openConnection().getLastModified()));
+            cacheKey.addCacheKey(new ParameterCacheKey("contextParameters", this.parameters));
         } catch (IOException e) {
             throw new SetupException(e);
         }
@@ -149,8 +146,7 @@ public class StringTemplateGenerator ext
     protected String renderTemplate()
             throws IOException {
 
-        return STRenderer.getInstance().render(
-                getTemplate(), parameters);
+        return STRenderer.getInstance().render(getTemplate(), parameters);
 
     }
 
@@ -159,20 +155,16 @@ public class StringTemplateGenerator ext
      *
      * @see org.apache.cocoon.pipeline.component.Starter#execute()
      */
+    @Override
     public void execute() {
-        if (this.url == null && this.file == null && this.stream == null
-                && this.string == null) {
-
-            throw new IllegalArgumentException(
-                    "StringTemplateGenerator has no source.");
+        if (this.url == null && this.file == null && this.stream == null && this.string == null) {
+            throw new IllegalArgumentException("StringTemplateGenerator has no source.");
         }
 
         try {
-            XMLUtils.createXMLReader(this.getSAXConsumer()).parse(
-                    new InputSource(new StringReader(renderTemplate())));
+            XMLUtils.createXMLReader(this.getSAXConsumer()).parse(new InputSource(new StringReader(renderTemplate())));
         } catch (Exception e) {
-            throw new ProcessingException("Can't parse url connection "
-                    + this.url, e);
+            throw new ProcessingException("Can't parse url connection " + this.url, e);
         }
     }
 
@@ -189,8 +181,7 @@ public class StringTemplateGenerator ext
      * @see org.apache.cocoon.pipeline.component.AbstractSAXProducer#setConfiguration(java.util.Map)
      */
     @Override
-    public void setConfiguration(
-            final Map<String, ? extends Object> parameters) {
+    public void setConfiguration(final Map<String, ? extends Object> parameters) {
 
         this.url = (URL) parameters.get("source");
         setup((Map<String, Object>) parameters);

Modified: cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateReader.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateReader.java?rev=1347566&r1=1347565&r2=1347566&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateReader.java (original)
+++ cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateReader.java Thu Jun  7 10:52:16 2012
@@ -65,18 +65,16 @@ public class StringTemplateReader extend
      *
      * @see org.apache.cocoon.pipeline.component.CachingPipelineComponent#constructCacheKey()
      */
+    @Override
     public CacheKey constructCacheKey() {
         if (this.source == null) {
-            throw new IllegalArgumentException(this.getClass().getSimpleName()
-                    + " has no source.");
+            throw new IllegalArgumentException(this.getClass().getSimpleName() + " has no source.");
         }
 
         final CompoundCacheKey cacheKey = new CompoundCacheKey();
         try {
-            cacheKey.addCacheKey(new TimestampCacheKey(this.source, this.source.
-                    openConnection().getLastModified()));
-            cacheKey.addCacheKey(new ParameterCacheKey("contextParameters",
-                    this.parameters));
+            cacheKey.addCacheKey(new TimestampCacheKey(this.source, this.source.openConnection().getLastModified()));
+            cacheKey.addCacheKey(new ParameterCacheKey("contextParameters", this.parameters));
         } catch (IOException e) {
             throw new SetupException("Could not create cache key.", e);
         }
@@ -89,31 +87,25 @@ public class StringTemplateReader extend
      *
      * @see org.apache.cocoon.pipeline.component.Starter#execute()
      */
+    @Override
     public void execute() {
         if (this.source == null) {
-            throw new IllegalArgumentException(this.getClass().getSimpleName()
-                    + " has no source.");
+            throw new IllegalArgumentException(this.getClass().getSimpleName() + " has no source.");
         }
 
         try {
             final InputStream inputStream = this.source.openStream();
 
             try {
-                final ST stringTemplate = new ST(
-                        IOUtils.toString(inputStream, "UTF-8"), '$', '$');
-
-                final Map<String, Object> controllerContext =
-                        ControllerContextHelper.getContext(this.parameters);
-                for (Entry<String, Object> eachEntry :
-                        controllerContext.entrySet()) {
+                final ST stringTemplate = new ST(IOUtils.toString(inputStream, "UTF-8"), '$', '$');
 
+                final Map<String, Object> controllerContext = ControllerContextHelper.getContext(this.parameters);
+                for (Entry<String, Object> eachEntry : controllerContext.entrySet()) {
                     stringTemplate.add(eachEntry.getKey(),
-                            StringEscapeUtils.escapeXml(
-                            eachEntry.getValue().toString()));
+                            StringEscapeUtils.escapeXml(eachEntry.getValue().toString()));
                 }
 
-                final OutputStreamWriter writer = new OutputStreamWriter(
-                        this.outputStream);
+                final OutputStreamWriter writer = new OutputStreamWriter(this.outputStream);
                 writer.write(stringTemplate.render());
                 writer.flush();
             } finally {
@@ -129,6 +121,7 @@ public class StringTemplateReader extend
      *
      * @see org.apache.cocoon.pipeline.component.Finisher#getContentType()
      */
+    @Override
     public String getContentType() {
         return this.mimeType;
     }
@@ -139,9 +132,7 @@ public class StringTemplateReader extend
      * @see org.apache.cocoon.pipeline.component.PipelineComponent#setConfiguration(java.util.Map)
      */
     @Override
-    public void setConfiguration(
-            final Map<String, ? extends Object> configuration) {
-
+    public void setConfiguration(final Map<String, ? extends Object> configuration) {
         this.setSource((URL) configuration.get("source"));
         this.setMimeType((String) configuration.get("mime-type"));
     }
@@ -149,8 +140,7 @@ public class StringTemplateReader extend
     /**
      * Set the mime-type directly which is useful when this component is used directly.
      *
-     * @param mimeType
-     *            The mime-type that belongs to the content that is produced by this component.
+     * @param mimeType The mime-type that belongs to the content that is produced by this component.
      */
     public void setMimeType(final String mimeType) {
         this.mimeType = mimeType;
@@ -169,8 +159,7 @@ public class StringTemplateReader extend
     /**
      * Set the source {@link URL} directly when this component is used directly.
      *
-     * @param source
-     *            A {@link URL} that will be used by this component.
+     * @param source A {@link URL} that will be used by this component.
      */
     public final void setSource(final URL source) {
         this.source = source;

Modified: cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateTransformer.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateTransformer.java?rev=1347566&r1=1347565&r2=1347566&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateTransformer.java (original)
+++ cocoon/cocoon3/trunk/cocoon-stringtemplate/src/main/java/org/apache/cocoon/stringtemplate/StringTemplateTransformer.java Thu Jun  7 10:52:16 2012
@@ -36,9 +36,7 @@ public class StringTemplateTransformer e
     }
 
     @Override
-    public void setConfiguration(
-            final Map<String, ? extends Object> configuration) {
-
+    public void setConfiguration(final Map<String, ? extends Object> configuration) {
         this.setup((Map<String, Object>) configuration);
     }
 
@@ -59,8 +57,7 @@ public class StringTemplateTransformer e
         XMLUtils.toOutputStream(baos, buffer);
 
         try {
-            final String rendered = STRenderer.getInstance().render(
-                    new String(baos.toByteArray()), parameters);
+            final String rendered = STRenderer.getInstance().render(new String(baos.toByteArray()), parameters);
             XMLUtils.toSax(rendered, this.getSAXConsumer());
         } catch (IOException e) {
             throw new SAXException(e);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.