org.apache.turbine.pipeline

## Class TurbinePipeline

- java.lang.Object
- - org.apache.turbine.pipeline.TurbinePipeline

- All Implemented Interfaces:
    Pipeline, ValveContext

      public class TurbinePipeline
      extends Object
      implements Pipeline, ValveContext

  Flexible implementation of a `Pipeline`. Originally based on code from Catalina and ideas from Apache httpd.
  Author:
    Daniel Rall, Jason van Zyl, Peter Courcoux

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CLASSIC_PIPELINE` The "Turbine Classic" pipeline.
    `protected String` | `name` Name of this pipeline.
    `protected ThreadLocal<Integer>` | `state` The per-thread execution state for processing through this pipeline.
    `protected Valve[]` | `valves` The set of Valves associated with this Pipeline.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `TurbinePipeline()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addValve(Valve valve)` Add a new Valve to the end of the pipeline.
    `String` | `getName()` Get the name of this pipeline.
    `Valve[]` | `getValves()` Return the set of all Valves in the pipeline.
    `void` | `initialize()` Initializes this instance.
    `void` | `invoke(PipelineData pipelineData)` Cause the specified request and response to be processed by the sequence of Valves associated with this pipeline, until one of these Valves decides to end the processing.
    `void` | `invokeNext(PipelineData pipelineData)` Cause the `invoke()` method of the next Valve that is part of the Pipeline currently being processed (if any) to be executed, passing on the specified request and response objects plus this `ValveContext` instance.
    `void` | `removeValve(Valve valve)` Remove the specified Valve from the pipeline, if it is found; otherwise, do nothing.
    `void` | `setName(String name)` Set the name of this pipeline.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### CLASSIC_PIPELINE

          public static final String CLASSIC_PIPELINE

      The "Turbine Classic" pipeline.
      See Also:
        Constant Field Values

    - #### name

          protected String name

      Name of this pipeline.

    - #### valves

          protected Valve[] valves

      The set of Valves associated with this Pipeline.

    - #### state

          protected ThreadLocal<Integer> state

      The per-thread execution state for processing through this pipeline. The actual value is a java.lang.Integer object containing the subscript into the `values` array, or a subscript equal to `values.length` if the basic Valve is currently being processed.

  - ### Constructor Detail

    - #### TurbinePipeline

          public TurbinePipeline()

  - ### Method Detail

    - #### initialize

          public void initialize()
                          throws Exception

      Description copied from interface: `Pipeline`
      Initializes this instance. Called once by the Turbine servlet.
      Specified by:
        `initialize` in interface `Pipeline`
      Throws:
        `Exception` - if the initialization fails
      See Also:
        `Pipeline.initialize()`

    - #### setName

          public void setName(String name)

      Set the name of this pipeline.
      Parameters:
        `name` - Name of this pipeline.

    - #### getName

          public String getName()

      Get the name of this pipeline.
      Returns:
        String Name of this pipeline.

    - #### addValve

          public void addValve(Valve valve)

      Description copied from interface: `Pipeline`

      Add a new Valve to the end of the pipeline.

      Specified by:
        `addValve` in interface `Pipeline`
      Parameters:
        `valve` - Valve to be added.
      See Also:
        `Pipeline.addValve(Valve)`

    - #### getValves

          public Valve[] getValves()

      Description copied from interface: `Pipeline`
      Return the set of all Valves in the pipeline. If there are no such Valves, a zero-length array is returned.
      Specified by:
        `getValves` in interface `Pipeline`
      Returns:
        An array of valves.
      See Also:
        `Pipeline.getValves()`

    - #### removeValve

          public void removeValve(Valve valve)

      Description copied from interface: `Pipeline`
      Remove the specified Valve from the pipeline, if it is found; otherwise, do nothing.
      Specified by:
        `removeValve` in interface `Pipeline`
      Parameters:
        `valve` - Valve to be removed.
      See Also:
        `Pipeline.removeValve(Valve)`

    - #### invoke

          public void invoke(PipelineData pipelineData)
                      throws TurbineException,
                             IOException

      Description copied from interface: `Pipeline`

      Cause the specified request and response to be processed by the sequence of Valves associated with this pipeline, until one of these Valves decides to end the processing.

      The implementation must ensure that multiple simultaneous requests (on different threads) can be processed through the same Pipeline without interfering with each other's control flow.

      Specified by:
        `invoke` in interface `Pipeline`
      Parameters:
        `pipelineData` - The run-time information, including the servlet request and response we are processing.
      Throws:
        `TurbineException` - if the invocation fails
        `IOException` - an input/output error occurred.
      See Also:
        `Pipeline.invoke(PipelineData)`

    - #### invokeNext

          public void invokeNext(PipelineData pipelineData)
                          throws TurbineException,
                                 IOException

      Description copied from interface: `ValveContext`

      Cause the `invoke()` method of the next Valve that is part of the Pipeline currently being processed (if any) to be executed, passing on the specified request and response objects plus this `ValveContext` instance. Exceptions thrown by a subsequently executed Valve will be passed on to our caller.

      If there are no more Valves to be executed, execution of this method will result in a no op.

      Specified by:
        `invokeNext` in interface `ValveContext`
      Parameters:
        `pipelineData` - The run-time information, including the servlet request and response we are processing.
      Throws:
        `TurbineException` - Thrown by a subsequent Valve.
        `IOException` - Thrown by a subsequent Valve.
      See Also:
        `ValveContext.invokeNext(PipelineData)`

Copyright © 2000-2015 The Apache Software Foundation. All Rights Reserved.