Package net.shibboleth.metadata.pipeline
Class PipelineDemultiplexerStage<T>
java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
net.shibboleth.metadata.pipeline.AbstractStage<T>
net.shibboleth.metadata.pipeline.PipelineDemultiplexerStage<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
A stage which, given an item collection and a list of
PipelineAndStrategy objects each
representing a Pipelines and associated selection strategy Predicate, sends the
collection of item copies selected by the predicate to the associated pipeline.
This stage is similar to
SplitMergeStage but a given item, or more precisely a copy of it, may end up going to more than one pipeline
(or no pipeline).
This stage requires the following properties be set prior to initialization:
pipelinesAndStrategies
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionFactory used to create the Item collection that is then given to the pipelines.private ExecutorExecutorused to execute the selected and/or non-selected item pipelines.private List<PipelineAndStrategy<T>>The pipelines through which items are sent and the selection strategy used for that pipeline.private booleanWhether this stage waits for all the invoked pipelines to complete before proceeding. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidPerforms the stage processing on the given Item collection.protected voidGets the factory used to create the Item collection that is then given to the pipelines.final ExecutorGets the executor used to run the selected and non-selected item pipelines.final List<PipelineAndStrategy<T>>Gets the pipelines and item selection strategies used to demultiplex item collections within this stage.final booleanGets whether this child waits for all the invoked pipelines to complete before proceeding.voidsetCollectionFactory(Supplier<List<Item<T>>> factory) Sets the factory used to create the Item collection that is then given to the pipelines.voidsetExecutor(Executor exec) Sets the executor used to run the selected and non-selected item pipelines.voidsetPipelinesAndStrategies(List<PipelineAndStrategy<T>> passes) Sets the pipelines and item selection strategies used to demultiplex item collections within this stage.voidsetWaitingForPipelines(boolean isWaiting) Sets whether this child waits for all the invoked pipelines to complete before proceeding.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. -
waitingForPipelines
private boolean waitingForPipelinesWhether this stage waits for all the invoked pipelines to complete before proceeding. Default:true. -
collectionFactory
Factory used to create the Item collection that is then given to the pipelines. -
pipelinesAndStrategies
The pipelines through which items are sent and the selection strategy used for that pipeline.
-
-
Constructor Details
-
PipelineDemultiplexerStage
public PipelineDemultiplexerStage()
-
-
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
-
isWaitingForPipelines
public final boolean isWaitingForPipelines()Gets whether this child waits for all the invoked pipelines to complete before proceeding.- Returns:
- whether this child waits for all the invoked pipelines to complete before proceeding
-
setWaitingForPipelines
public void setWaitingForPipelines(boolean isWaiting) Sets whether this child waits for all the invoked pipelines to complete before proceeding.- Parameters:
isWaiting- whether this child waits for all the invoked pipelines to complete before proceeding
-
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
-
getPipelinesAndStrategies
@Nonnull @NonnullElements @Unmodifiable public final List<PipelineAndStrategy<T>> getPipelinesAndStrategies()Gets the pipelines and item selection strategies used to demultiplex item collections within this stage.- Returns:
- pipeline and item selection strategies used to demultiplex item collections within this stage
- Since:
- 0.10.0
-
setPipelinesAndStrategies
public void setPipelinesAndStrategies(@Nonnull @NonnullElements @Unmodifiable List<PipelineAndStrategy<T>> passes) Sets the pipelines and item selection strategies used to demultiplex item collections within this stage.- Parameters:
passes- pipeline and item selection strategies used to demultiplex item collections within this stage- Since:
- 0.10.0
-
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
-