Class DefaultPipeline

java.lang.Object
com.easydesk.pipeline.DefaultPipeline
All Implemented Interfaces:
Pipeline, ValveContext

public class DefaultPipeline extends Object implements Pipeline, ValveContext
Flexible implementation of a Pipeline.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected String
    Name of this pipeline.

    Fields inherited from interface com.easydesk.pipeline.Pipeline

    EMPTY_PIPELINE
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addValve(Valve valve)
    Add a new Valve to the end of the pipeline.
    Get the name of this pipeline.
    Return the set of all Valves in the pipeline.
    void
    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
    Remove the specified Valve from the pipeline, if it is found; otherwise, do nothing.
    void
    Set the name of this pipeline.
    protected void
    setValves(Valve[] valves)
    Set new valves during deserialization

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • name

      protected String name
      Name of this pipeline.
  • Constructor Details

    • DefaultPipeline

      public DefaultPipeline()
  • Method Details

    • 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
      See Also:
    • setName

      public void setName(String name)
      Set the name of this pipeline.
      Specified by:
      setName in interface Pipeline
      Parameters:
      name - Name of this pipeline.
    • getName

      public String getName()
      Get the name of this pipeline.
      Specified by:
      getName in interface 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:
    • 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:
    • setValves

      protected void setValves(Valve[] valves)
      Set new valves during deserialization
      Parameters:
      valves - the valves to set
    • 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:
    • invoke

      public void invoke(PipelineData pipelineData) throws IOException, PipelineException
      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 - run-time information pipelineData,
      Throws:
      IOException - an input/output error occurred.
      PipelineException
      See Also:
    • invokeNext

      public void invokeNext(PipelineData pipelineData) throws IOException, PipelineException
      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 pouch.
      Throws:
      IOException - Thrown by a subsequent Valve.
      PipelineException
      See Also: