net.shibboleth.metadata.pipeline
Class PipelineMergeStage

java.lang.Object
  extended by net.shibboleth.metadata.pipeline.AbstractComponent
      extended by net.shibboleth.metadata.pipeline.BaseStage<Item<?>>
          extended by net.shibboleth.metadata.pipeline.PipelineMergeStage
All Implemented Interfaces:
Component, Stage<Item<?>>

@ThreadSafe
public class PipelineMergeStage
extends BaseStage<Item<?>>

This Stage allows the merging of multiple pipeline outputs into a single Collection that can then be used as the input source for another pipeline. This source works producing a Collection by means of the registered ItemCollectionFactory . Then each of its registered Pipeline is invoked in turn (no ordering is guaranteed and pipelines may execute concurrently). After each pipeline has completed the results are merged in to the Item collection given to this stage by means of the an CollectionMergeStrategy.


Field Summary
private  ItemCollectionFactory collectionFactory
          The factory used to create the item returned by this source.
private  ExecutorService executorService
          Service used to execute the pipelines whose results will be merged.
private  Logger log
          Class logger.
private  List<Pipeline<Item<?>>> mergedPipelines
          Pipelines whose results become the output of this source.
private  CollectionMergeStrategy mergeStrategy
          Strategy used to merge all the joined pipeline results in to the final Item collection.
 
Constructor Summary
PipelineMergeStage()
           
 
Method Summary
protected  void doExecute(Collection<Item<?>> itemCollection)
          Performs the stage processing on the given Item collection.
protected  void doInitialize()
          Do the initialization of the component.
 ItemCollectionFactory getCollectionFactory()
          Gets the factory used to create the Item collection produced by this source.
 CollectionMergeStrategy getCollectionMergeStrategy()
          Gets the strategy used to merge all the joined pipeline results in to the final Item collection.
 ExecutorService getExecutorService()
          Gets the executor service used to run the selected and non-selected item pipelines.
 List<Pipeline<Item<?>>> getMergedPipelines()
          Gets the unmodifiable set of pipelines used by this stage.
 void setCollectionFactory(ItemCollectionFactory factory)
          Sets the factory used to create the Item collection produced by this source.
 void setCollectionMergeStrategy(CollectionMergeStrategy strategy)
          Sets the strategy used to merge all the joined pipeline results in to the final Item collection.
 void setExecutorService(ExecutorService service)
          Sets the executor service used to run the selected and non-selected item pipelines.
 void setMergedPipelines(List<Pipeline<Item<?>>> pipelines)
          Sets the pipelines joined by this stage.
 
Methods inherited from class net.shibboleth.metadata.pipeline.BaseStage
execute
 
Methods inherited from class net.shibboleth.metadata.pipeline.AbstractComponent
equals, getId, getInitializationInstant, hashCode, initialize, isInitialized, setId
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface net.shibboleth.metadata.pipeline.Component
getId, getInitializationInstant, initialize, isInitialized
 

Field Detail

log

private final Logger log
Class logger.


executorService

private ExecutorService executorService
Service used to execute the pipelines whose results will be merged.


collectionFactory

private ItemCollectionFactory collectionFactory
The factory used to create the item returned by this source. Default implementation is SimpleItemCollectionFactory.


mergeStrategy

private CollectionMergeStrategy mergeStrategy
Strategy used to merge all the joined pipeline results in to the final Item collection.


mergedPipelines

private List<Pipeline<Item<?>>> mergedPipelines
Pipelines whose results become the output of this source.

Constructor Detail

PipelineMergeStage

public PipelineMergeStage()
Method Detail

getExecutorService

public ExecutorService getExecutorService()
Gets the executor service used to run the selected and non-selected item pipelines.

Returns:
executor service used to run the selected and non-selected item pipelines

setExecutorService

public void setExecutorService(ExecutorService service)
Sets the executor service used to run the selected and non-selected item pipelines.

Parameters:
service - executor service used to run the selected and non-selected item pipelines

getMergedPipelines

public List<Pipeline<Item<?>>> getMergedPipelines()
Gets the unmodifiable set of pipelines used by this stage.

Returns:
unmodifiable set of pipelines used by this stage

setMergedPipelines

public void setMergedPipelines(List<Pipeline<Item<?>>> pipelines)
Sets the pipelines joined by this stage.

Parameters:
pipelines - pipelines joined by this stage

getCollectionFactory

public ItemCollectionFactory getCollectionFactory()
Gets the factory used to create the Item collection produced by this source.

Returns:
factory used to create the Item collection produced by this source

setCollectionFactory

public void setCollectionFactory(ItemCollectionFactory factory)
Sets the factory used to create the Item collection produced by this source.

Parameters:
factory - factory used to create the Item collection produced by this source

getCollectionMergeStrategy

public CollectionMergeStrategy getCollectionMergeStrategy()
Gets the strategy used to merge all the joined pipeline results in to the final Item collection.

Returns:
strategy used to merge all the joined pipeline results in to the final Item collection, never null

setCollectionMergeStrategy

public void setCollectionMergeStrategy(CollectionMergeStrategy strategy)
Sets the strategy used to merge all the joined pipeline results in to the final Item collection.

Parameters:
strategy - strategy used to merge all the joined pipeline results in to the final Item collection, never null

doExecute

protected void doExecute(Collection<Item<?>> itemCollection)
                  throws StageProcessingException
Performs the stage processing on the given Item collection.

Specified by:
doExecute in class BaseStage<Item<?>>
Parameters:
itemCollection - collection to be processed
Throws:
StageProcessingException - thrown if there is an unrecoverable problem when processing the stage

doInitialize

protected void doInitialize()
                     throws ComponentInitializationException
Do the initialization of the component. Default implementation of this method is a no-op. Extending classes should override this method to perform any initialization logic necessary.

Overrides:
doInitialize in class AbstractComponent
Throws:
ComponentInitializationException - throw if there is a problem initializing the component


Copyright © 2009-2011. All Rights Reserved.