You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by do...@apache.org on 2001/04/22 09:39:26 UTC

cvs commit: jakarta-avalon/src/java/org/apache/excalibur/pipeline DefaultPipeline.java Pipeline.java ProcessorPipeline.java ProcessorStage.java Stage.java

donaldp     01/04/22 00:39:26

  Added:       src/java/org/apache/excalibur/pipeline DefaultPipeline.java
                        Pipeline.java ProcessorPipeline.java
                        ProcessorStage.java Stage.java
  Log:
  Moved pipeline code to excalibur.
  
  Revision  Changes    Path
  1.1                  jakarta-avalon/src/java/org/apache/excalibur/pipeline/DefaultPipeline.java
  
  Index: DefaultPipeline.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included  with this distribution in
   * the LICENSE file.
   */
  package org.apache.excalibur.pipeline;
  
  import java.util.ArrayList;
  import java.util.NoSuchElementException;
  
  /**
   * This is basic array based pipeline.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class DefaultPipeline 
      implements Pipeline
  {
      protected final ArrayList        m_stages     = new ArrayList();
  
      /**
       * Retrieve size of pipeline (number of stages).
       *
       * @return the size of pipeline
       */
      public int getSize()
      {
          return m_stages.size();
      }
  
      /**
       * Retrieve a particular stage of pipeline
       *
       * @param index the index of stage
       * @return the stage
       * @exception NoSuchElementException if index >= getSize() or index < 0
       */
      public Stage getStage( final int index )
          throws NoSuchElementException
      {
          return (Stage)m_stages.get( index );
      }
  
      public void addStage( final Stage stage )
      {
          m_stages.add( stage );
      }
  }
  
  
  
  1.1                  jakarta-avalon/src/java/org/apache/excalibur/pipeline/Pipeline.java
  
  Index: Pipeline.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.excalibur.pipeline;
  
  import java.util.NoSuchElementException;
  
  /**
   * This represents a pipeline made up of stages.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public interface Pipeline 
      extends Stage
  {
      /**
       * Retrieve size of pipeline (number of stages).
       *
       * @return the size of pipeline
       */
      int getSize();
  
      /**
       * Retrieve a particular stage of pipeline
       *
       * @param index the index of stage
       * @return the stage
       * @exception NoSuchElementException if index >= getSize() or index < 0
       */
      Stage getStage( int index )
          throws NoSuchElementException;
  }
  
  
  
  1.1                  jakarta-avalon/src/java/org/apache/excalibur/pipeline/ProcessorPipeline.java
  
  Index: ProcessorPipeline.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.excalibur.pipeline;
  
  import java.util.Iterator;
  
  /**
   * This represents a pipeline made up of stages.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   */
  public class ProcessorPipeline
      extends DefaultPipeline
      implements ProcessorStage
  {
      public void process( final Object object )
      {
          final Iterator stages = m_stages.iterator();
  
          while( stages.hasNext() )
          {
              ((ProcessorStage)stages.next()).process( object );
          }
      }
  
      public Stage getStage( final int index )
      {
          return (Stage)m_stages.get( index );
      }
  
      public int getSize()
      {
          return m_stages.size();
      }
  }
  
  
  
  1.1                  jakarta-avalon/src/java/org/apache/excalibur/pipeline/ProcessorStage.java
  
  Index: ProcessorStage.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.excalibur.pipeline;
  
  /**
   * This represents a stage in a pipeline.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   * @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
   */
  public interface ProcessorStage
      extends Stage
  {
      void process( Object object );
  
  }
  
  
  
  1.1                  jakarta-avalon/src/java/org/apache/excalibur/pipeline/Stage.java
  
  Index: Stage.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.excalibur.pipeline;
  
  import org.apache.avalon.component.Component;
  
  /**
   * This represents a stage in a pipeline.
   *
   * @author <a href="mailto:donaldp@apache.org">Peter Donald</a>
   * @author <a href="mailto:fede@apache.org">Federico Barbieri</a>
   */
  public interface Stage
      extends Component
  {
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org