org.apache.commons.pipeline.testFramework
Class TestStage

java.lang.Object
  extended by org.apache.commons.pipeline.testFramework.TestStage
All Implemented Interfaces:
Stage
Direct Known Subclasses:
FaultingTestStage

public class TestStage
extends Object
implements Stage


Field Summary
 boolean initialized
           
 boolean postprocessed
           
 boolean preprocessed
           
 List<Object> processedObjects
           
 boolean released
           
 
Constructor Summary
TestStage(int index)
          Construct a TestStage with a numeric index used to easily identify this stage.
 
Method Summary
 int getIndex()
           
 void init(StageContext context)
          Initialization takes place when the stage is added to a pipeline.
 void postprocess()
          Implementations of this method should do any additional processing or finalization necessary after all data objects have been processed by the stage.
 void preprocess()
          Implementations of this method should perform any necessary setup that needs to be done before any data is processed.
 void process(Object obj)
          Implementations of this method should atomically process a single data object and transfer any feed objects resulting from this processing to the downstream Feeder.
 void release()
          Implementations of this method should clean up any lingering resources that might otherwise be left allocated if an exception is thrown during processing (or pre/postprocessing).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

processedObjects

public List<Object> processedObjects

initialized

public boolean initialized

preprocessed

public boolean preprocessed

postprocessed

public boolean postprocessed

released

public boolean released
Constructor Detail

TestStage

public TestStage(int index)
Construct a TestStage with a numeric index used to easily identify this stage. The getIndex and toString methods use this index.

Parameters:
index - acts as an identification number
Method Detail

getIndex

public int getIndex()

init

public void init(StageContext context)
Description copied from interface: Stage

Initialization takes place when the stage is added to a pipeline. Implementations of this method should perform any necessary setup that is required for the driver to be able to correctly run the stage.

NOTE: Since this method is run when the stage is added to the pipeline, certain information (such as the downstream feeder for the stage) may not yet be available until the pipeline is fully constructoed.

Specified by:
init in interface Stage
Parameters:
context - the StageContext within which the stage sill be run

preprocess

public void preprocess()
                throws StageException
Description copied from interface: Stage
Implementations of this method should perform any necessary setup that needs to be done before any data is processed. Preprocessing is performed after initialization.

Specified by:
preprocess in interface Stage
Throws:
StageException - any checked Exception thrown by the implementation should be wrapped in a StageException

process

public void process(Object obj)
             throws StageException
Description copied from interface: Stage
Implementations of this method should atomically process a single data object and transfer any feed objects resulting from this processing to the downstream Feeder. This Feeder can be obtained from the stage context made available during initialization. NOTE: Implementations of this method must be thread-safe!

Specified by:
process in interface Stage
Parameters:
obj - an object to be processed
Throws:
StageException - any checked Exception thrown by the implementation should be wrapped in a StageException

postprocess

public void postprocess()
                 throws StageException
Description copied from interface: Stage
Implementations of this method should do any additional processing or finalization necessary after all data objects have been processed by the stage.

Specified by:
postprocess in interface Stage
Throws:
StageException - any checked Exception thrown by the implementation should be wrapped in a StageException

release

public void release()
Description copied from interface: Stage
Implementations of this method should clean up any lingering resources that might otherwise be left allocated if an exception is thrown during processing (or pre/postprocessing).

Specified by:
release in interface Stage

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.