net.shibboleth.metadata.dom.saml
Class PullUpValidUntilStage

java.lang.Object
  extended by net.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent
      extended by net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponent
          extended by net.shibboleth.metadata.pipeline.BaseStage<ItemType>
              extended by net.shibboleth.metadata.pipeline.BaseIteratingStage<DomElementItem>
                  extended by net.shibboleth.metadata.dom.saml.PullUpValidUntilStage
All Implemented Interfaces:
Stage<DomElementItem>, net.shibboleth.utilities.java.support.component.Component, net.shibboleth.utilities.java.support.component.DestructableComponent, net.shibboleth.utilities.java.support.component.IdentifiableComponent, net.shibboleth.utilities.java.support.component.InitializableComponent

@ThreadSafe
public class PullUpValidUntilStage
extends BaseIteratingStage<DomElementItem>

For each Item collection element that is a SAML EntitiesDescriptor this stage will scan all descendant EntitiesDescriptors and EntityDescriptors, determine the earliest valid until date, set that on the root EntitiesDescriptor and remove the valid until dates from all descendants.


Field Summary
private  long maxValidityDuration
          The maximum amount of time, in milliseconds, a descriptor may be valid.
private  long minValidityDuration
          The minimum amount of time, in milliseconds, a descriptor may be valid .
 
Constructor Summary
PullUpValidUntilStage()
           
 
Method Summary
protected  boolean doExecute(DomElementItem item)
          Processes a given Item.
 long getMaximumValidityDuration()
          Gets the maximum amount of time, in milliseconds, a descriptor may be valid.
 long getMinimumValidityDuration()
          Gets the minimum amount of time, in milliseconds, a descriptor may be valid.
protected  Long getNearestValidUntil(Element descriptor)
          Gets the shorts cache duration for a given entity and entities descriptor an all its descendant descriptors.
 void setMaximumValidityDuration(long duration)
          Sets the maximum amount of time, in milliseconds, a descriptor may be valid.
 void setMinimumValidityDuration(long duration)
          Sets the minimum amount of time, in milliseconds, a descriptor may be valid.
protected  void setValidUntil(Element descriptor, Long validUntil)
          Sets the valid until instant on the given descriptor.
 
Methods inherited from class net.shibboleth.metadata.pipeline.BaseIteratingStage
doExecute
 
Methods inherited from class net.shibboleth.metadata.pipeline.BaseStage
execute, setId
 
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractDestructableIdentifiableInitializableComponent
doInitialize, getId
 
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractDestructableInitializableComponent
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.utilities.java.support.component.DestructableComponent
destroy, isDestroyed
 
Methods inherited from interface net.shibboleth.utilities.java.support.component.IdentifiableComponent
getId
 
Methods inherited from interface net.shibboleth.utilities.java.support.component.InitializableComponent
initialize, isInitialized
 

Field Detail

minValidityDuration

private long minValidityDuration
The minimum amount of time, in milliseconds, a descriptor may be valid . Default value: 0


maxValidityDuration

private long maxValidityDuration
The maximum amount of time, in milliseconds, a descriptor may be valid. Default value: 9223372036854775807L

Constructor Detail

PullUpValidUntilStage

public PullUpValidUntilStage()
Method Detail

getMinimumValidityDuration

public long getMinimumValidityDuration()
Gets the minimum amount of time, in milliseconds, a descriptor may be valid.

Returns:
minimum amount of time, in milliseconds, a descriptor may be valid, always 0 or greater

setMinimumValidityDuration

public void setMinimumValidityDuration(long duration)
Sets the minimum amount of time, in milliseconds, a descriptor may be valid.

Parameters:
duration - minimum amount of time, in milliseconds, a descriptor may be valid

getMaximumValidityDuration

public long getMaximumValidityDuration()
Gets the maximum amount of time, in milliseconds, a descriptor may be valid.

Returns:
maximum maximum amount of time, in milliseconds, a descriptor may be valid, always greater than 0

setMaximumValidityDuration

public void setMaximumValidityDuration(long duration)
Sets the maximum amount of time, in milliseconds, a descriptor may be valid.

Parameters:
duration - maximum amount of time, in milliseconds, a descriptor may be valid, must be greater than 0

doExecute

protected boolean doExecute(@Nonnull
                            DomElementItem item)
                     throws StageProcessingException
Processes a given Item.

Specified by:
doExecute in class BaseIteratingStage<DomElementItem>
Parameters:
item - Item on which to operate
Returns:
true if the Item should be retained in the collection, false if not
Throws:
StageProcessingException - thrown if there is a problem with the stage processing

getNearestValidUntil

protected Long getNearestValidUntil(@Nonnull
                                    Element descriptor)
Gets the shorts cache duration for a given entity and entities descriptor an 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

setValidUntil

protected void setValidUntil(@Nonnull
                             Element descriptor,
                             @Nullable
                             Long validUntil)
Sets the valid until instant on the given descriptor. If the given validUntil is null no instant is set. If the given validUntil is less than now + minValidityDuration then the instant of now + the minimum duration is set. If the given validUntil is greater than now + maxValidityDuration then the instant of now + the maximum duration is set. Otherwise the given instant is set.

Parameters:
descriptor - entity or entities descriptor to receive the validUntil, never null
validUntil - validUntil time to be set on the given descriptor


Copyright © 1999-2012. All Rights Reserved.