public abstract class AbstractDynamicMetadataResolver extends AbstractMetadataResolver implements DynamicMetadataResolver
| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractDynamicMetadataResolver.BackingStoreCleanupSweeper
Background maintenance task which cleans expired and idle metadata from the backing store, and removes
orphaned entity management data.
|
protected class |
AbstractDynamicMetadataResolver.DynamicEntityBackingStore
Specialized entity backing store implementation for dynamic metadata resolvers.
|
protected class |
AbstractDynamicMetadataResolver.EntityManagementData
Class holding per-entity management data.
|
AbstractMetadataResolver.EntityBackingStore| Modifier and Type | Field and Description |
|---|---|
private AbstractDynamicMetadataResolver.BackingStoreCleanupSweeper |
cleanupTask
The backing store cleanup sweeper background task.
|
private java.lang.Long |
cleanupTaskInterval
The interval in milliseconds at which the cleanup task should run.
|
private boolean |
createdOwnTaskTimer
Whether we created our own task timer during object construction.
|
private org.slf4j.Logger |
log
Class logger.
|
private java.lang.Long |
maxCacheDuration
Maximum cache duration.
|
private java.lang.Long |
maxIdleEntityData
The maximum idle time in milliseconds for which the resolver will keep data for a given entityID,
before it is removed.
|
private java.lang.Long |
minCacheDuration
Minimum cache duration.
|
private java.lang.Float |
refreshDelayFactor
Factor used to compute when the next refresh interval will occur.
|
private boolean |
removeIdleEntityData
Flag indicating whether idle entity data should be removed.
|
private java.util.Timer |
taskTimer
Timer used to schedule background metadata update tasks.
|
| Constructor and Description |
|---|
AbstractDynamicMetadataResolver(java.util.Timer backgroundTaskTimer)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
protected org.joda.time.DateTime |
computeExpirationTime(EntityDescriptor entityDescriptor,
org.joda.time.DateTime now)
Compute the effective expiration time for the specified metadata.
|
protected org.joda.time.DateTime |
computeRefreshTriggerTime(org.joda.time.DateTime expirationTime,
org.joda.time.DateTime nowDateTime)
Compute the refresh trigger time.
|
protected AbstractDynamicMetadataResolver.DynamicEntityBackingStore |
createNewBackingStore()
Create a new backing store instance for EntityDescriptor data.
|
protected void |
doDestroy() |
protected abstract XMLObject |
fetchFromOriginSource(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Fetch the metadata from the origin source.
|
protected AbstractDynamicMetadataResolver.DynamicEntityBackingStore |
getBackingStore()
Get the EntityDescriptor backing store currently in use by the metadata resolver.
|
java.lang.Long |
getCleanupTaskInterval()
Get the interval in milliseconds at which the cleanup task should run.
|
java.lang.Long |
getMaxCacheDuration()
Get the maximum cache duration for metadata.
|
java.lang.Long |
getMaxIdleEntityData()
Get the maximum idle time in milliseconds for which the resolver will keep data for a given entityID,
before it is removed.
|
java.lang.Long |
getMinCacheDuration()
Get the minimum cache duration for metadata.
|
java.lang.Float |
getRefreshDelayFactor()
Gets the delay factor used to compute the next refresh time.
|
protected void |
initMetadataResolver()
Subclasses should override this method to perform any initialization logic necessary.
|
boolean |
isRemoveIdleEntityData()
Get the flag indicating whether idle entity data should be removed.
|
protected java.util.List<EntityDescriptor> |
lookupEntityID(java.lang.String entityID)
Get list of descriptors matching an entityID.
|
protected void |
preProcessEntityDescriptor(EntityDescriptor entityDescriptor,
AbstractMetadataResolver.EntityBackingStore backingStore)
Pre-process the specified entity descriptor, updating the specified entity backing store instance as necessary.
|
protected void |
processNewMetadata(XMLObject root,
java.lang.String expectedEntityID)
Process the specified new metadata document, including metadata filtering, and store the
processed metadata in the backing store.
|
java.lang.Iterable<EntityDescriptor> |
resolve(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria) |
protected java.lang.Iterable<EntityDescriptor> |
resolveFromOriginSource(net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
Fetch metadata from an origin source based on the input criteria, store it in the backing store
and then return it.
|
void |
setCleanupTaskInterval(java.lang.Long interval)
Set the interval in milliseconds at which the cleanup task should run.
|
void |
setMaxCacheDuration(java.lang.Long duration)
Set the maximum cache duration for metadata.
|
void |
setMaxIdleEntityData(java.lang.Long max)
Set the maximum idle time in milliseconds for which the resolver will keep data for a given entityID,
before it is removed.
|
void |
setMinCacheDuration(java.lang.Long duration)
Set the minimum cache duration for metadata.
|
void |
setRefreshDelayFactor(java.lang.Float factor)
Sets the delay factor used to compute the next refresh time.
|
void |
setRemoveIdleEntityData(boolean flag)
Set the flag indicating whether idle entity data should be removed.
|
protected boolean |
shouldAttemptRefresh(AbstractDynamicMetadataResolver.EntityManagementData mgmtData)
Determine whether should attempt to refresh the metadata, based on stored refresh trigger time.
|
doInitialize, filterMetadata, getMetadataFilter, getParserPool, getUnmarshallerFactory, indexEntityDescriptor, isFailFastInitialization, isRequireValidMetadata, isValid, lookupIndexedEntityID, preProcessEntitiesDescriptor, releaseMetadataDOM, removeByEntityID, resolveSingle, setBackingStore, setFailFastInitialization, setMetadataFilter, setParserPool, setRequireValidMetadata, unmarshallMetadatasetIdgetIddestroy, initialize, isDestroyed, isInitializedclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMetadataFilter, isRequireValidMetadata, setMetadataFilter, setRequireValidMetadataprivate final org.slf4j.Logger log
private java.util.Timer taskTimer
private boolean createdOwnTaskTimer
@Duration @Positive private java.lang.Long minCacheDuration
@Duration @Positive private java.lang.Long maxCacheDuration
@Positive private java.lang.Float refreshDelayFactor
@Duration @Positive private java.lang.Long maxIdleEntityData
private boolean removeIdleEntityData
@Duration @Positive private java.lang.Long cleanupTaskInterval
private AbstractDynamicMetadataResolver.BackingStoreCleanupSweeper cleanupTask
public AbstractDynamicMetadataResolver(@Nullable
java.util.Timer backgroundTaskTimer)
backgroundTaskTimer - the Timer instance used to run resolver background managment tasks@Nonnull public java.lang.Long getMinCacheDuration()
Defaults to: 10 minutes.
public void setMinCacheDuration(@Nonnull
java.lang.Long duration)
Defaults to: 10 minutes.
duration - the minimum cache duration, in milliseconds@Nonnull public java.lang.Long getMaxCacheDuration()
Defaults to: 8 hours.
public void setMaxCacheDuration(@Nonnull
java.lang.Long duration)
Defaults to: 8 hours.
duration - the maximum cache duration, in millisecondspublic java.lang.Float getRefreshDelayFactor()
Defaults to: 0.75.
public void setRefreshDelayFactor(java.lang.Float factor)
Defaults to: 0.75.
factor - delay factor used to compute the next refresh timepublic boolean isRemoveIdleEntityData()
public void setRemoveIdleEntityData(boolean flag)
flag - true if idle entity data should be removed, false otherwise@Nonnull public java.lang.Long getMaxIdleEntityData()
Defaults to: 8 hours.
public void setMaxIdleEntityData(@Nonnull
java.lang.Long max)
Defaults to: 8 hours.
max - the maximum entity data idle time, in milliseconds@Nonnull public java.lang.Long getCleanupTaskInterval()
Defaults to: 30 minutes.
public void setCleanupTaskInterval(@Nonnull
java.lang.Long interval)
Defaults to: 30 minutes.
interval - the interval to set, in milliseconds@Nonnull public java.lang.Iterable<EntityDescriptor> resolve(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria) throws net.shibboleth.utilities.java.support.resolver.ResolverException
resolve in interface net.shibboleth.utilities.java.support.resolver.Resolver<EntityDescriptor,net.shibboleth.utilities.java.support.resolver.CriteriaSet>net.shibboleth.utilities.java.support.resolver.ResolverException@Nonnull @NonnullElements protected java.lang.Iterable<EntityDescriptor> resolveFromOriginSource(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria) throws net.shibboleth.utilities.java.support.resolver.ResolverException
criteria - the input criteria setnet.shibboleth.utilities.java.support.resolver.ResolverException - if there is a fatal error attempting to resolve the metadata@Nullable protected abstract XMLObject fetchFromOriginSource(@Nonnull net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria) throws java.io.IOException
criteria - the input criteria setjava.io.IOException - if there is a fatal error fetching metadata from the origin source@Nonnull @NonnullElements protected java.util.List<EntityDescriptor> lookupEntityID(@Nonnull java.lang.String entityID) throws net.shibboleth.utilities.java.support.resolver.ResolverException
lookupEntityID in class AbstractMetadataResolverentityID - entityID to lookupnet.shibboleth.utilities.java.support.resolver.ResolverException - if an error occurs@Nonnull
protected void processNewMetadata(@Nonnull
XMLObject root,
@Nonnull
java.lang.String expectedEntityID)
throws FilterException
In order to be processed successfully, the metadata (after filtering) must be an instance of
EntityDescriptor and its entityID value must match the value supplied
as the required expectedEntityID argument.
root - the root of the new metadata document being processedexpectedEntityID - the expected entityID of the resolved metadataFilterException - if there is a problem filtering the metadataprotected void preProcessEntityDescriptor(@Nonnull
EntityDescriptor entityDescriptor,
@Nonnull
AbstractMetadataResolver.EntityBackingStore backingStore)
preProcessEntityDescriptor in class AbstractMetadataResolverentityDescriptor - the target entity descriptor to processbackingStore - the backing store instance to update@Nonnull
protected org.joda.time.DateTime computeExpirationTime(@Nonnull
EntityDescriptor entityDescriptor,
@Nonnull
org.joda.time.DateTime now)
entityDescriptor - the EntityDescriptor instance to evaluatenow - the current date time instant@Nonnull
protected org.joda.time.DateTime computeRefreshTriggerTime(@Nullable
org.joda.time.DateTime expirationTime,
@Nonnull
org.joda.time.DateTime nowDateTime)
expirationTime - the time at which the metadata effectively expiresnowDateTime - the current date time instantprotected boolean shouldAttemptRefresh(@Nonnull
AbstractDynamicMetadataResolver.EntityManagementData mgmtData)
mgmtData - the entity'd management data@Nonnull protected AbstractDynamicMetadataResolver.DynamicEntityBackingStore createNewBackingStore()
AbstractMetadataResolver.setBackingStore(EntityBackingStore) to make it the effective
instance in use.createNewBackingStore in class AbstractMetadataResolver@NonnullAfterInit protected AbstractDynamicMetadataResolver.DynamicEntityBackingStore getBackingStore()
getBackingStore in class AbstractMetadataResolverprotected void initMetadataResolver()
throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
initMetadataResolver in class AbstractMetadataResolvernet.shibboleth.utilities.java.support.component.ComponentInitializationException - thrown if there is a problem initializing the providerprotected void doDestroy()
doDestroy in class AbstractMetadataResolver