org.apache.tapestry5.ioc.services
Interface PipelineBuilder

All Known Implementing Classes:
PipelineBuilderImpl

public interface PipelineBuilder

Creates a pipeline from a service inteface and an ordered list of filters. Each filter is defined in terms of a filter interface: the filter interface is a variant of the service interface, where each method has an additional parameter that is an instance of the service interface. Typically, this service parameter (often named "delegate") is either the first or the last parameter of each method.

The implementation of a filter method is expected to pass all of its parameters to the service instance passed into it.

The interesting thing is that there may be multiple filters in the pipeline. A fabricated "bridge" object (that implements the service interface) is created to let each filter invoke methods on the next filter down the pipeline. This simplifies the model for creating pipelines, as each filter is coded as if it was directly "in front of" the terminator. In fact, it may be indirectly invoking methods on the next filter in the pipeline via a bridge instance.

The builder is fairly smart about matching up service interface methods to filter interface methods, but keeping it simple is also a good idea.


Method Summary
<S,F> S
build(org.slf4j.Logger logger, java.lang.Class<S> serviceInterface, java.lang.Class<F> filterInterface, java.util.List<F> filters)
          Creates a pipeline from just the filters.
<S,F> S
build(org.slf4j.Logger logger, java.lang.Class<S> serviceInterface, java.lang.Class<F> filterInterface, java.util.List<F> filters, S terminator)
          Creates a pipeline from the filters and a terminator.
 

Method Detail

build

<S,F> S build(org.slf4j.Logger logger,
              java.lang.Class<S> serviceInterface,
              java.lang.Class<F> filterInterface,
              java.util.List<F> filters,
              S terminator)
Creates a pipeline from the filters and a terminator.

Type Parameters:
S - service type
F - filter type
Parameters:
logger - logs any warnings generated when constructing the pipeline
serviceInterface -
filterInterface -
filters - sorted list of filters
terminator - end of the pipeline
Returns:
an object that encapsulates the filters and the terminator

build

<S,F> S build(org.slf4j.Logger logger,
              java.lang.Class<S> serviceInterface,
              java.lang.Class<F> filterInterface,
              java.util.List<F> filters)
Creates a pipeline from just the filters. A default implementation is created as the terminator.

Type Parameters:
S -
F -
Parameters:
logger -
serviceInterface -
filterInterface -
filters -
Returns:


Copyright © 2006-2011 Apache Software Foundation. All Rights Reserved.