Class PipelineMergeStage<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.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

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

    Fields
    Modifier and Type
    Field
    Description
    private Supplier<List<Item<T>>>
    The factory used to create the item returned by this source.
    private Executor
    Executor used to execute the selected and/or non-selected item pipelines.
    private List<Pipeline<T>>
    Pipelines whose results become the output of this source.
    Strategy used to merge all the joined pipeline results in to the final Item collection.
  • 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 produced by this source.
    Gets the strategy used to merge all the joined pipeline results in to the final Item collection.
    final Executor
    Gets the executor used to run the selected and non-selected item pipelines.
    final List<Pipeline<T>>
    Gets the unmodifiable set of pipelines used by this stage.
    void
    Sets the factory used to create the Item collection produced by this source.
    void
    Sets the strategy used to merge all the joined pipeline results in to the final Item collection.
    void
    Sets the executor used to run the selected and non-selected item pipelines.
    void
    setMergedPipelines(List<? extends Pipeline<T>> pipelines)
    Sets the pipelines joined by this stage.

    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.
    • collectionFactory

      @Nonnull private Supplier<List<Item<T>>> collectionFactory
      The factory used to create the item returned by this source. Default implementation is SimpleItemCollectionFactory.
    • mergeStrategy

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

      @Nonnull @NonnullElements @Unmodifiable private List<Pipeline<T>> mergedPipelines
      Pipelines whose results become the output of this source.
  • Constructor Details

    • PipelineMergeStage

      public PipelineMergeStage()
  • 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
    • getMergedPipelines

      @Nonnull @NonnullElements @Unmodifiable public final List<Pipeline<T>> 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

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

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