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

@ThreadSafe public class PipelineDemultiplexerStage<T> extends AbstractStage<T>
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

    Fields
    Modifier and Type
    Field
    Description
    private Supplier<List<Item<T>>>
    Factory used to create the Item collection that is then given to the pipelines.
    private Executor
    Executor used to execute the selected and/or non-selected item pipelines.
    The pipelines through which items are sent and the selection strategy used for that pipeline.
    private boolean
    Whether this stage waits for all the invoked pipelines to complete before proceeding.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    doExecute(List<Item<T>> items)
    Performs the stage processing on the given Item collection.
    protected void
     
    final Supplier<List<Item<T>>>
    Gets the factory used to create the Item collection that is then given to the pipelines.
    final Executor
    Gets the executor used to run the selected and non-selected item pipelines.
    Gets the pipelines and item selection strategies used to demultiplex item collections within this stage.
    final boolean
    Gets whether this child waits for all the invoked pipelines to complete before proceeding.
    void
    Sets the factory used to create the Item collection that is then given to the pipelines.
    void
    Sets the executor used to run the selected and non-selected item pipelines.
    void
    Sets the pipelines and item selection strategies used to demultiplex item collections within this stage.
    void
    setWaitingForPipelines(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, setCollectionPredicate

    Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

    setId

    Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

    ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException

    Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

    checkComponentActive, checkSetterPreconditions, destroy, doDestroy, initialize, isDestroyed, isInitialized

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.shibboleth.shared.component.DestructableComponent

    destroy, isDestroyed

    Methods inherited from interface net.shibboleth.shared.component.IdentifiedComponent

    getId

    Methods inherited from interface net.shibboleth.shared.component.InitializableComponent

    initialize, isInitialized
  • Field Details

    • executor

      @Nonnull private Executor executor
      Executor used to execute the selected and/or non-selected item pipelines.
    • waitingForPipelines

      private boolean waitingForPipelines
      Whether this stage waits for all the invoked pipelines to complete before proceeding. Default: true.
    • collectionFactory

      @Nonnull private Supplier<List<Item<T>>> collectionFactory
      Factory used to create the Item collection that is then given to the pipelines.
    • pipelinesAndStrategies

      @Nonnull @NonnullElements @Unmodifiable private List<PipelineAndStrategy<T>> pipelinesAndStrategies
      The pipelines through which items are sent and the selection strategy used for that pipeline.
  • Constructor Details

    • PipelineDemultiplexerStage

      public PipelineDemultiplexerStage()
  • Method Details

    • getExecutor

      @Nonnull public final Executor 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

      public void setExecutor(@Nonnull Executor exec)
      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

      @Nonnull public final Supplier<List<Item<T>>> 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

      public void setCollectionFactory(@Nonnull Supplier<List<Item<T>>> factory)
      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: AbstractStage
      Performs 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:
      doExecute in class AbstractStage<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:
      doInitialize in class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
      Throws:
      net.shibboleth.shared.component.ComponentInitializationException