Class Pipeline

java.lang.Object
org.dbunit.dataset.common.handlers.Pipeline
All Implemented Interfaces:
Handler

public class Pipeline extends Object implements Handler
Chain-of-responsibility pipeline of PipelineComponents that parses CSV field text one character at a time.
Since:
2.2 (Sep 12, 2004)
Version:
$Revision$ $Date$
Author:
fede, Last changed by: $Author$
  • Constructor Details

    • Pipeline

      public Pipeline()
      Default constructor.
  • Method Details

    • getCurrentProduct

      public StringBuilder getCurrentProduct()
      Returns the piece currently being accumulated.
      Returns:
      the piece currently being accumulated.
    • setCurrentProduct

      public void setCurrentProduct(StringBuilder currentProduct)
      Sets the piece currently being accumulated.
      Parameters:
      currentProduct - the piece currently being accumulated.
    • thePieceIsDone

      public void thePieceIsDone()
      Completes the current piece, adding it to getProducts() and starting a new one.
    • getProducts

      public List getProducts()
      Returns the completed pieces produced so far.
      Returns:
      the completed pieces produced so far.
    • setProducts

      protected void setProducts(List products)
      Sets the completed pieces produced so far.
      Parameters:
      products - the completed pieces produced so far.
    • putFront

      public void putFront(PipelineComponent component)
      Inserts the given component at the front of the pipeline.
      Parameters:
      component - the component to insert.
    • removeFront

      public PipelineComponent removeFront() throws PipelineException
      Removes and returns the component at the front of the pipeline.
      Returns:
      the component that was at the front of the pipeline.
      Throws:
      PipelineException - if the front component is the last handler and cannot be removed.
    • remove

      public void remove(PipelineComponent component) throws PipelineException
      Removes the given component from the pipeline.
      Parameters:
      component - the component to remove.
      Throws:
      PipelineException - if the component is the last handler, or is not present in the pipeline.
    • canHandle

      public boolean canHandle(char c) throws IllegalInputCharacterException
      Description copied from interface: Handler
      Determines whether this handler can handle the given character.
      Specified by:
      canHandle in interface Handler
      Parameters:
      c - the character to check.
      Returns:
      true if this handler can handle the character.
      Throws:
      IllegalInputCharacterException - if the character is not valid in the current context.
    • handle

      public void handle(char c) throws IllegalInputCharacterException, PipelineException
      Description copied from interface: Handler
      Handles the given character.
      Specified by:
      handle in interface Handler
      Parameters:
      c - the character to handle.
      Throws:
      IllegalInputCharacterException - if the character is not valid in the current context.
      PipelineException - if the character cannot be processed by the pipeline.
    • allowForNoMoreInput

      public boolean allowForNoMoreInput()
      Description copied from interface: Handler
      Determines whether this handler allows input to end at this point.
      Specified by:
      allowForNoMoreInput in interface Handler
      Returns:
      true if ending input now is allowed.
    • resetProducts

      public void resetProducts()
      Clears the completed pieces produced so far.
    • noMoreInput

      public void noMoreInput()
      Description copied from interface: Handler
      Notifies this handler that no more input will be provided.
      Specified by:
      noMoreInput in interface Handler
    • getPipelineConfig

      public PipelineConfig getPipelineConfig()
      Returns the configuration used by this pipeline's components.
      Returns:
      the configuration used by this pipeline's components.
    • setPipelineConfig

      public void setPipelineConfig(PipelineConfig pipelineConfig)
      Sets the configuration used by this pipeline's components.
      Parameters:
      pipelineConfig - the configuration used by this pipeline's components.