org.apache.commons.pipeline
Interface StageContext

All Known Implementing Classes:
Pipeline, TestStageContext

public interface StageContext

This interface represents the context in which a stage is run. Ordinarily, the context will be provided by the pipeline in which the stage is embedded; however, this interface is also useful for creating isolated test environments in which a stage can be run.


Method Summary
 Feeder getBranchFeeder(String branch)
          Return the source feeder for the specified pipeline branch.
 Feeder getDownstreamFeeder(Stage stage)
          This method is used by a stage driver to pass data from one stage to the next.
 Object getEnv(String key)
          A StageContext implementation provides a global environment for the stages being run.
 Collection<StageEventListener> getRegisteredListeners()
          Returns the collection of StageEventListeners registered with the context.
 void raise(EventObject ev)
          Notifies each registered listener of an event and propagates the event to any attached branches
 void registerListener(StageEventListener listener)
          Adds a StageEventListener to the context that will be notified by calls to raise(EventObject).
 

Method Detail

registerListener

void registerListener(StageEventListener listener)
Adds a StageEventListener to the context that will be notified by calls to raise(EventObject).

Parameters:
listener - The listener to be registered with the context.

getRegisteredListeners

Collection<StageEventListener> getRegisteredListeners()
Returns the collection of StageEventListeners registered with the context.

Returns:
the collection of StageEventListeners registered with the context.

raise

void raise(EventObject ev)
Notifies each registered listener of an event and propagates the event to any attached branches

Parameters:
ev - The event to be passed to registered listeners

getBranchFeeder

Feeder getBranchFeeder(String branch)
Return the source feeder for the specified pipeline branch.

Parameters:
branch - the string identifer of the branch for which a feeder will be retrieved
Returns:
the Feeder for the first stage of the specified branch

getDownstreamFeeder

Feeder getDownstreamFeeder(Stage stage)
This method is used by a stage driver to pass data from one stage to the next.

Parameters:
stage - The stage from which "downstream" will be determined. Ordinarily a Stage implementation will call this method with a reference to itself.
Returns:
the feeder for the downstream stage, or Feeder.VOID if no downstream stage exists.

getEnv

Object getEnv(String key)
A StageContext implementation provides a global environment for the stages being run. This method allows objects in the global environment to be accessed by the stages running in this context.

Returns:
the object corresponding to the specified string key, or null if no such key exists.


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