Class PipelineMergeStage<T>
- Type Parameters:
T- the type of items processed by the stage
- All Implemented Interfaces:
Stage<T>,net.shibboleth.shared.component.Component,net.shibboleth.shared.component.DestructableComponent,net.shibboleth.shared.component.IdentifiableComponent,net.shibboleth.shared.component.IdentifiedComponent,net.shibboleth.shared.component.InitializableComponent
Stage allows the merging of multiple pipeline outputs into a single List that can then be
used as the input source for another pipeline.
This source works producing a List by means of the registered Supplier . 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.
If an executor is provided, it will be used to execute the pipelines,
potentially concurrently. By default, the pipelines will be executed sequentially
on the calling thread.
The caller is responsible for the lifecycle of any provided Executor,
including the lifecycle of any threads or thread pools associated with it.
-
Field Summary
FieldsModifier and TypeFieldDescriptionThe factory used to create the item returned by this source.private ExecutorExecutorused to execute the selected and/or non-selected item pipelines.Pipelines whose results become the output of this source.private CollectionMergeStrategyStrategy used to merge all the joined pipeline results in to the final Item collection. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPerforms the stage processing on the given Item collection.protected voidGets the factory used to create theItemcollection produced by this source.final CollectionMergeStrategyGets the strategy used to merge all the joined pipeline results in to the final Item collection.final ExecutorGets the executor used to run the selected and non-selected item pipelines.Gets the unmodifiable set of pipelines used by this stage.voidsetCollectionFactory(Supplier<List<Item<T>>> factory) Sets the factory used to create theItemcollection produced by this source.voidSets the strategy used to merge all the joined pipeline results in to the final Item collection.voidsetExecutor(Executor exec) Sets the executor used to run the selected and non-selected item pipelines.voidsetMergedPipelines(List<? extends Pipeline<T>> pipelines) Sets the pipelines joined by this stage.Methods inherited from class net.shibboleth.metadata.pipeline.AbstractStage
execute, getCollectionPredicate, setCollectionPredicateMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
setIdMethods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentExceptionMethods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent
checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitializedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.shibboleth.shared.component.DestructableComponent
destroy, isDestroyedMethods inherited from interface net.shibboleth.shared.component.IdentifiedComponent
getIdMethods inherited from interface net.shibboleth.shared.component.InitializableComponent
initialize, isInitialized
-
Field Details
-
executor
Executorused to execute the selected and/or non-selected item pipelines. -
collectionFactory
The factory used to create the item returned by this source. Default implementation isSimpleItemCollectionFactory. -
mergeStrategy
Strategy used to merge all the joined pipeline results in to the final Item collection. -
mergedPipelines
Pipelines whose results become the output of this source.
-
-
Constructor Details
-
PipelineMergeStage
public PipelineMergeStage()
-
-
Method Details
-
getExecutor
Gets the executor used to run the selected and non-selected item pipelines.- Returns:
- executor used to run the selected and non-selected item pipelines
- Since:
- 0.10.0
-
setExecutor
Sets the executor used to run the selected and non-selected item pipelines.- Parameters:
exec- executor used to run the selected and non-selected item pipelines- Since:
- 0.10.0
-
getMergedPipelines
Gets the unmodifiable set of pipelines used by this stage.- Returns:
- unmodifiable set of pipelines used by this stage
-
setMergedPipelines
public void setMergedPipelines(@Nonnull @NonnullElements @Unmodifiable List<? extends Pipeline<T>> pipelines) Sets the pipelines joined by this stage.- Parameters:
pipelines- pipelines joined by this stage
-
getCollectionFactory
Gets the factory used to create theItemcollection produced by this source.- Returns:
- factory used to create the
Itemcollection produced by this source
-
setCollectionFactory
Sets the factory used to create theItemcollection produced by this source.- Parameters:
factory- factory used to create theItemcollection produced by this source
-
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
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(@Nonnull @NonnullElements List<Item<T>> items) throws StageProcessingException Description copied from class:AbstractStagePerforms the stage processing on the given Item collection.The stage is guaranteed to be have been initialized and not destroyed when this is invoked.
- Specified by:
doExecutein classAbstractStage<T>- Parameters:
items- collection to be processed- Throws:
StageProcessingException- thrown if there is an unrecoverable problem when processing the stage
-
doInitialize
protected void doInitialize() throws net.shibboleth.shared.component.ComponentInitializationException- Overrides:
doInitializein classnet.shibboleth.shared.component.AbstractIdentifiedInitializableComponent- Throws:
net.shibboleth.shared.component.ComponentInitializationException
-