2009/04/15 - Apache HiveMind has been retired.

For more information, please explore the Attic.

Jakarta > HiveMind
Font size:      

hivemind.lib.PipelineFactory Service

The PipelineFactory service is used to construct a pipeline consisting of a series of filters. The filters implement an interface related to the service interface.

Each method of the service interface has a corresponding method in the filter interface with an identical signature, except that an additional parameter, whose type matches the service interface has been added.

For example, a service interface for transforming a string:

package mypackage; 

public interface StringTransformService
  public String transform(String inputValue); 

The corresponding filter interface:

package mypackage;

public interface StringTransformFilter
  public String transform(String inputValue, StringTransformService service);

The service parameter may appear at any point in the parameter list, though the convention of listing it last is recommended.

The filters in a pipeline are chained together as follows:

Pipeline Calling Sequence

The bridge objects implement the service interface (and are created dynamically at runtime). The terminator at the end also implements the service interface. This is an object reference (it can be an object or a service) if no terminator is specified, a default implementation is created and used. Only a single terminator is allowed.

A pipeline is always created in terms of a service and a configuration. The service defines the service interface and identifies a configuration. The configuration conforms to the hivemind.lib.Pipeline schema and is used to specify filters and the terminator. Filters may be ordered much like <interceptor>s, using before and after attributes. This allows different modules to contribute filters into the service's pipeline.


The factory expects a single parameter element:

<create-pipeline filter-interface="..." configuration-id="..." terminator="..."/>

The filter-interface attribute is the complete class name of the filter interface.

The configuration-id is the id of the companion configuration (used to define filters).

The optional terminator attribute is used to specify an object reference. A terminator may also be contributed into the pipeline configuration.


Each pipeline service must have a configuration, into which filters are contributed:

<configuration-point id="..." schema-id="hivemind.lib.Pipeline"/>


Contributions into the configuration are used to specify the filters and the terminator.


<filter name="..." before="..." after="..." object="..."/> 

Contributes a filter. The optional before and after attributes are lists of the ids of other filters in the pipeline, used to set the ordering of the filters. They may be comma-seperated lists of filter ids (or filter names), or simple * to indicate absolute positioning.

The object attribute is the filter object itself, an object reference to an object implementing the filter interface.


<terminator object="..."/>

Specifies the terminator for the pipeline, as an object reference to an object implementing the service interface. Only a single terminator may be specified, and the terminator service provided in the factory parameters takes precendence over a terminator in the configuration.