org.apache.commons.pipeline
Interface Stage

All Known Implementing Classes:
AddToCollectionStage, BaseStage, DynamicLookupStaticMethodStage, ExtendedBaseStage, FaultingTestStage, FileFinderStage, FtpFileDownloadStage, HttpFileDownloadStage, InputStreamLineBreakStage, InvokeMethodStage, InvokeStaticMethodStage, KeyWaitBufferStage, LogStage, PipelineShutdownStage, RaiseEventStage, RaiseKeyAvailableEventStage, TestStage, URLToInputStreamStage

public interface Stage

A Stage represents a set of tasks that can be performed on objects in a queue, and methods used to communicate with other stages in a Pipeline.


Method Summary
 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).
 

Method Detail

init

void init(StageContext context)

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.

Parameters:
context - the StageContext within which the stage sill be run

preprocess

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

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

process

void process(Object obj)
             throws StageException
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!

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

postprocess

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

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

release

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).



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