cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reinh...@apache.org
Subject svn commit: r731621 - in /cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax: AbstractReader.java FileReaderComponent.java
Date Mon, 05 Jan 2009 17:06:49 GMT
Author: reinhard
Date: Mon Jan  5 09:06:49 2009
New Revision: 731621

URL: http://svn.apache.org/viewvc?rev=731621&view=rev
Log:
. provide an abstract reader implementation

Added:
    cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/AbstractReader.java
  (with props)
Modified:
    cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/FileReaderComponent.java

Added: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/AbstractReader.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/AbstractReader.java?rev=731621&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/AbstractReader.java
(added)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/AbstractReader.java
Mon Jan  5 09:06:49 2009
@@ -0,0 +1,78 @@
+/*
+ * 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.pipeline.component.sax;
+
+import java.io.OutputStream;
+import java.net.URL;
+import java.util.Map;
+
+import org.apache.cocoon.pipeline.component.AbstractPipelineComponent;
+import org.apache.cocoon.pipeline.component.Finisher;
+import org.apache.cocoon.pipeline.component.Starter;
+
+public abstract class AbstractReader extends AbstractPipelineComponent implements Starter,
Finisher {
+
+    protected String mimeType;
+    protected OutputStream outputStream;
+    protected URL source;
+
+    public AbstractReader() {
+        super();
+    }
+
+    public AbstractReader(URL src) {
+        this.source = src;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.pipeline.component.PipelineComponent#setConfiguration(java.util.Map)
+     */
+    @Override
+    public void setConfiguration(Map<String, ? extends Object> configuration) {
+        this.setSource((URL) configuration.get("source"));
+        this.setMimeType((String) configuration.get("mime-type"));
+    }
+
+    /**
+     * 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.
+     */
+    public void setMimeType(String mimeType) {
+        this.mimeType = mimeType;
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
+     * @see org.apache.cocoon.pipeline.component.Finisher#setOutputStream(java.io.OutputStream)
+     */
+    public void setOutputStream(OutputStream outputStream) {
+        this.outputStream = outputStream;
+    }
+
+    /**
+     * Set the source {@link URL} directly when this component is used directly.
+     * 
+     * @param source A {@link URL} that will be used by this component.
+     */
+    public void setSource(URL source) {
+        this.source = source;
+    }
+}
\ No newline at end of file

Propchange: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/AbstractReader.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/AbstractReader.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/AbstractReader.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/FileReaderComponent.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/FileReaderComponent.java?rev=731621&r1=731620&r2=731621&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/FileReaderComponent.java
(original)
+++ cocoon/cocoon3/trunk/cocoon-pipeline/src/main/java/org/apache/cocoon/pipeline/component/sax/FileReaderComponent.java
Mon Jan  5 09:06:49 2009
@@ -20,38 +20,27 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStream;
 import java.net.URL;
 import java.net.URLConnection;
-import java.util.Map;
 
 import org.apache.cocoon.pipeline.ProcessingException;
 import org.apache.cocoon.pipeline.caching.CacheKey;
 import org.apache.cocoon.pipeline.caching.TimestampCacheKey;
-import org.apache.cocoon.pipeline.component.AbstractPipelineComponent;
 import org.apache.cocoon.pipeline.component.CachingPipelineComponent;
-import org.apache.cocoon.pipeline.component.Finisher;
-import org.apache.cocoon.pipeline.component.Starter;
 import org.apache.cocoon.pipeline.util.URLConnectionUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-public class FileReaderComponent extends AbstractPipelineComponent implements Starter, Finisher,
-        CachingPipelineComponent {
+public class FileReaderComponent extends AbstractReader implements CachingPipelineComponent
{
 
     private final Log logger = LogFactory.getLog(this.getClass());
 
-    private String mimeType;
-    private OutputStream outputStream;
-    private URL source;
-
     public FileReaderComponent() {
         super();
     }
 
     public FileReaderComponent(URL source) {
-        super();
-        this.source = source;
+        super(source);
     }
 
     /**
@@ -129,44 +118,6 @@
     /**
      * {@inheritDoc}
      * 
-     * @see org.apache.cocoon.pipeline.component.PipelineComponent#setConfiguration(java.util.Map)
-     */
-    @Override
-    public void setConfiguration(Map<String, ? extends Object> configuration) {
-        this.setSource((URL) configuration.get("source"));
-        this.setMimeType((String) configuration.get("mime-type"));
-    }
-
-    /**
-     * 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.
-     */
-    public void setMimeType(String mimeType) {
-        this.mimeType = mimeType;
-    }
-
-    /**
-     * Set the source {@link URL} directly when this component is used directly.
-     * 
-     * @param source A {@link URL} that will be used by this component.
-     */
-    public void setSource(URL source) {
-        this.source = source;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
-     * @see org.apache.cocoon.pipeline.component.Finisher#setOutputStream(java.io.OutputStream)
-     */
-    public void setOutputStream(OutputStream outputStream) {
-        this.outputStream = outputStream;
-    }
-
-    /**
-     * {@inheritDoc}
-     * 
      * @see java.lang.Object#toString()
      */
     @Override



Mime
View raw message