Class PullUpCacheDurationStage

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
All Implemented Interfaces:
Stage<Element>, 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 PullUpCacheDurationStage extends AbstractIteratingStage<Element>
For each Item collection element that is a SAML EntitiesDescriptor this stage will scan all descendant EntitiesDescriptors and EntityDescriptors, determine the shortest cache duration, set that on the root EntitiesDescriptor and remove the cache duration from all descendants.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Duration
    The maximum cache duration.
    private Duration
    The minimum cache duration.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Processes a given Item.
    final Duration
    Gets the maximum cache duration.
    final Duration
    Gets the minimum cache duration.
    protected Duration
    Gets the shortest cache duration for a given entity or entities descriptor and all its descendant descriptors.
    protected void
    setCacheDuration(Element descriptor, Duration cacheDuration)
    Sets the cache duration on the given descriptor.
    void
    Sets the maximum cache duration.
    void
    Sets the minimum cache duration.

    Methods inherited from class net.shibboleth.metadata.pipeline.AbstractIteratingStage

    doExecute

    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

    doInitialize, 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

    • minCacheDuration

      @Nonnull private Duration minCacheDuration
      The minimum cache duration. Default value: 0
    • maxCacheDuration

      @Nonnull private Duration maxCacheDuration
      The maximum cache duration. Default value: 9223372036854775807L
  • Constructor Details

    • PullUpCacheDurationStage

      public PullUpCacheDurationStage()
  • Method Details

    • getMinimumCacheDuration

      @Nonnull public final Duration getMinimumCacheDuration()
      Gets the minimum cache duration.
      Returns:
      minimum cache duration, always 0 or greater
    • setMinimumCacheDuration

      public void setMinimumCacheDuration(@Nonnull Duration duration)
      Sets the minimum cache duration.
      Parameters:
      duration - the minimum cache duration
    • getMaximumCacheDuration

      @Nonnull public final Duration getMaximumCacheDuration()
      Gets the maximum cache duration.
      Returns:
      maximum cache duration, always greater than 0
    • setMaximumCacheDuration

      public void setMaximumCacheDuration(Duration duration)
      Sets the maximum cache duration.
      Parameters:
      duration - maximum cache duration, must be greater than 0
    • doExecute

      protected void doExecute(@Nonnull Item<Element> item) throws StageProcessingException
      Description copied from class: AbstractIteratingStage
      Processes a given Item.
      Specified by:
      doExecute in class AbstractIteratingStage<Element>
      Parameters:
      item - Item on which to operate
      Throws:
      StageProcessingException - thrown if there is a problem with the stage processing
    • getShortestCacheDuration

      @Nullable protected Duration getShortestCacheDuration(@Nonnull Element descriptor)
      Gets the shortest cache duration for a given entity or entities descriptor and all its descendant descriptors.
      Parameters:
      descriptor - descriptor from which to get the shortest cache duration
      Returns:
      the shortest cache duration from the descriptor and its descendants or null if the descriptor does not contain a cache duration
    • setCacheDuration

      protected void setCacheDuration(@Nonnull Element descriptor, @Nullable Duration cacheDuration)
      Sets the cache duration on the given descriptor. If the given cache duration is less than, or equal to, 0 no duration is set. If the given cache duration is less than minCacheDuration then the minimum cache duration is set. If the given cache duration is greater than maxCacheDuration then the maximum cache duration is set. Otherwise the given cache duration is set.
      Parameters:
      descriptor - entity or entities descriptor to receive the cache duration, never null
      cacheDuration - cache duration to be set, may be null