Class SplitMergeStage<T>
- Type Parameters:
T- type of items upon which this stage operates
- 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
The selected and non-selected item pipelines are executed via the set executor.
The results of the two pipelines are merged to produce the result.
This stage requires the following properties be set prior to initialization:
selectionStrategyselectedItemPipelineornonselectedItemPipeline
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.
If no collectionFactory is given, then SimpleItemCollectionFactory is used.
If one or the other pipeline is null then no objects will be passed to it (obviously).
-
Field Summary
FieldsModifier and TypeFieldDescriptionFactory used to create the Item collection that is then given to the pipelines.private ExecutorExecutorused to execute the pipelines.private static final org.slf4j.LoggerClass logger.private CollectionMergeStrategyStrategy used to merge all the joined pipeline results in to the final Item collection.Pipeline that receives the non-selected items.Pipeline that receives the selected items.Strategy used to split the given item collection. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPerforms the stage processing on the given Item collection.protected voidExecutes a pipeline.Gets the factory used to create the Item collection that is then given to the pipelines.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 pipeline that receives the non-selected items.Gets the pipeline that receives the selected items.Gets the strategy used to split the given item collection.voidsetCollectionFactory(Supplier<List<Item<T>>> factory) Sets the factory used to create the Item collection that is then given to the pipelines.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.voidsetNonselectedItemPipeline(Pipeline<T> pipeline) Sets the pipeline that receives the non-selected items.voidsetSelectedItemPipeline(Pipeline<T> pipeline) Sets the pipeline that receives the selected items.voidsetSelectionStrategy(Predicate<Item<T>> strategy) Sets the strategy used to split the given item collection.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
-
LOG
@Nonnull private static final org.slf4j.Logger LOGClass logger. -
executor
Executorused to execute the pipelines. -
collectionFactory
Factory used to create the Item collection that is then given to the pipelines. -
selectionStrategy
Strategy used to split the given item collection. -
selectedItemPipeline
Pipeline that receives the selected items. -
nonselectedItemPipeline
Pipeline that receives the non-selected items. -
mergeStrategy
Strategy used to merge all the joined pipeline results in to the final Item collection.
-
-
Constructor Details
-
SplitMergeStage
public SplitMergeStage()
-
-
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
-
getCollectionFactory
Gets the factory used to create the Item collection that is then given to the pipelines.- Returns:
- factory used to create the Item collection that is then given to the pipelines
-
setCollectionFactory
Sets the factory used to create the Item collection that is then given to the pipelines.- Parameters:
factory- factory used to create the Item collection that is then given to the pipelines
-
getSelectionStrategy
Gets the strategy used to split the given item collection.- Returns:
- strategy used to split the given item collection
-
setSelectionStrategy
Sets the strategy used to split the given item collection.- Parameters:
strategy- strategy used to split the given item collection, never null
-
getSelectedItemPipeline
Gets the pipeline that receives the selected items.- Returns:
- pipeline that receives the selected items
-
setSelectedItemPipeline
Sets the pipeline that receives the selected items.- Parameters:
pipeline- pipeline that receives the selected items
-
getNonselectedItemPipeline
Gets the pipeline that receives the non-selected items.- Returns:
- pipeline that receives the non-selected items
-
setNonselectedItemPipeline
Sets the pipeline that receives the non-selected items.- Parameters:
pipeline- pipeline that receives the non-selected items
-
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
-
executePipeline
@Nonnull private Future<List<Item<T>>> executePipeline(@Nullable Pipeline<T> pipeline, @Nonnull List<Item<T>> items) Executes a pipeline.- Parameters:
pipeline- the pipeline, may benullitems- the collections of items- Returns:
- the token representing the background execution of the pipeline
-
doInitialize
protected void doInitialize() throws net.shibboleth.shared.component.ComponentInitializationException- Overrides:
doInitializein classnet.shibboleth.shared.component.AbstractIdentifiedInitializableComponent- Throws:
net.shibboleth.shared.component.ComponentInitializationException
-