Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cocoon.pipeline
Interface Pipeline<T extends PipelineComponent>

All Known Implementing Classes:
  AbstractPipeline, AsyncCachePipeline, CachingPipeline, NonCachingPipeline

    public interface Pipeline<T extends PipelineComponent>

A pipeline expects one or more `PipelineComponent`s that passed by using `addComponent(PipelineComponent)`. Then these components get linked with each other in the order they were added. The `setup(OutputStream, Map)` method, calls the setup method on all pipeline components and assembles the pipeline. Finally the `execute()` method produces the result and writes it to the `OutputStream` which has been passed to the `setup(OutputStream, Map)` method.

A pipeline works based on two fundamental concepts:

- The first component of a pipeline is of type `Starter`. The last component is of type `Finisher`.
- In order to link components with each other, the first has to be a `Producer`, the latter `Consumer`.

When the pipeline links the components, it merely checks whether the above mentioned interfaces are present. So the pipeline does not know about the specific capabilities or the compatibility of the components. It is the responsibility of the `Producer` to decide whether a specific `Consumer` can be linked to it or not (that is, whether it can produce output in the desired format of the `Consumer` or not). It is also conceivable that a `Producer` is capable of accepting different types of `Consumer`s and adjust the output format according to the actual `Consumer`.

Method Summary
`void` | `addComponent(T pipelineComponent)` Add a `PipelineComponent` to the pipeline.
`void` | `execute()` After the pipeline has been setup (`setup(OutputStream, Map)`, this method can be invoked in order to produce the result.
`String` | `getContentType()` Get the mime-type of the content produced by the pipeline.
`long` | `getLastModified()` Get the time of the last modification.
`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 (`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 `setup(OutputStream)` but also allows passing parameters to the pipeline components.

Method Detail

### addComponent

    void addComponent(T pipelineComponent)

  Add a `PipelineComponent` to the pipeline. The order of when the components are passed is significant.

  Parameters:
    `pipelineComponent` - The `PipelineComponent`.

### execute

    void execute()
                 throws Exception

  After the pipeline has been setup (`setup(OutputStream, Map)`, this method can be invoked in order to produce the result.

  Throws:
    `Exception` - Any problem that might occur while processing the pipeline.

### getContentType

    String getContentType()

  Get the mime-type of the content produced by the pipeline.

  Returns:
    The mime-type of the content.

### getLastModified

    long getLastModified()

  Get the time of the last modification.

  Returns:
    The last modification date

### setup

    void setup(OutputStream outputStream)

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

  Parameters:
    `outputStream` - An `OutputStream` where the pipeline execution result is written.

### setup

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

  The same as `setup(OutputStream)` but also allows passing parameters to the pipeline components.

  Parameters:
    `outputStream` - An `OutputStream` where the pipeline execution result is written.
    `parameters` - A `Map` of parameters that are available to all `PipelineComponent`s.

### setConfiguration

    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.

  Parameters:
    `configuration` - The `Map` of configuration parameters.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright � 2008-2010 The Apache Software Foundation. All Rights Reserved.