org.apache.cocoon.pipeline
Class AbstractPipeline<T extends PipelineComponent>

java.lang.Object
  extended by org.apache.cocoon.pipeline.AbstractPipeline<T>
All Implemented Interfaces:
Pipeline<T>
Direct Known Subclasses:
CachingPipeline, NonCachingPipeline

public abstract class AbstractPipeline<T extends PipelineComponent>
extends Object
implements Pipeline<T>

Basic pipeline implementation that collects the PipelineComponents and connects them with each other.


Constructor Summary
AbstractPipeline()
           
 
Method Summary
 void addComponent(T pipelineComponent)
          Add a PipelineComponent to the pipeline.
 void execute()
          After the pipeline has been setup (Pipeline.setup(OutputStream, Map), this method can be invoked in order to produce the result.
protected  LinkedList<T> getComponents()
           
 String getContentType()
          Get the mime-type of the content produced by the pipeline.
protected  Finisher getFinisher()
           
 long getLastModified()
          Get the time of the last modification.
protected  void invokeStarter()
           
 void setConfiguration(Map<String,? extends Object> parameters)
          Pass pipeline specific configuration parameters to the pipeline component in a generic way.
 void setup(OutputStream outputStream)
          After the pipeline has been prepared (Pipeline.addComponent(PipelineComponent), this method can be invoked in order to setup and initialize the pipeline and its components.
 void setup(OutputStream outputStream, Map<String,Object> parameters)
          The same as Pipeline.setup(OutputStream) but also allows passing parameters to the pipeline components.
protected  void setupComponents(OutputStream outputStream, Map<String,Object> parameters)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AbstractPipeline

public AbstractPipeline()
Method Detail

addComponent

public void addComponent(T pipelineComponent)
Add a PipelineComponent to the pipeline. The order of when the components are passed is significant.

Specified by:
addComponent in interface Pipeline<T extends PipelineComponent>
Parameters:
pipelineComponent - The PipelineComponent.
See Also:
Pipeline.addComponent(org.apache.cocoon.pipeline.component.PipelineComponent)

execute

public void execute()
             throws Exception
After the pipeline has been setup (Pipeline.setup(OutputStream, Map), this method can be invoked in order to produce the result.

Specified by:
execute in interface Pipeline<T extends PipelineComponent>
Throws:
Exception - Any problem that might occur while processing the pipeline.
See Also:
Pipeline.execute()

getContentType

public String getContentType()
Get the mime-type of the content produced by the pipeline.

Specified by:
getContentType in interface Pipeline<T extends PipelineComponent>
Returns:
The mime-type of the content.
See Also:
Pipeline.getContentType()

getLastModified

public long getLastModified()
Description copied from interface: Pipeline
Get the time of the last modification.

Specified by:
getLastModified in interface Pipeline<T extends PipelineComponent>
Returns:
The last modification date

setConfiguration

public void setConfiguration(Map<String,? extends Object> parameters)
Pass pipeline specific configuration parameters to the pipeline component in a generic way. This is useful in environments that automatically assemble pipelines with their components and can't use the pipeline's constructors or setters.

Specified by:
setConfiguration in interface Pipeline<T extends PipelineComponent>
See Also:
Pipeline.setConfiguration(java.util.Map)

setup

public void setup(OutputStream outputStream)
After the pipeline has been prepared (Pipeline.addComponent(PipelineComponent), this method can be invoked in order to setup and initialize the pipeline and its components.

Specified by:
setup in interface Pipeline<T extends PipelineComponent>
Parameters:
outputStream - An OutputStream where the pipeline execution result is written.
See Also:
Pipeline.setup(java.io.OutputStream, java.util.Map)

setup

public void setup(OutputStream outputStream,
                  Map<String,Object> parameters)
The same as Pipeline.setup(OutputStream) but also allows passing parameters to the pipeline components.

Specified by:
setup in interface Pipeline<T extends PipelineComponent>
Parameters:
outputStream - An OutputStream where the pipeline execution result is written.
parameters - A Map of parameters that are available to all PipelineComponents.
See Also:
Pipeline.setup(java.io.OutputStream, java.util.Map)

toString

public String toString()
Overrides:
toString in class Object

getComponents

protected LinkedList<T> getComponents()

getFinisher

protected Finisher getFinisher()

invokeStarter

protected void invokeStarter()

setupComponents

protected void setupComponents(OutputStream outputStream,
                               Map<String,Object> parameters)


Copyright © 2008-2012 The Apache Software Foundation. All Rights Reserved.