Class CompositeMetadataResolver
- java.lang.Object
-
- net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
-
- net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
-
- org.opensaml.saml.metadata.resolver.impl.CompositeMetadataResolver
-
- All Implemented Interfaces:
Component,DestructableComponent,IdentifiedComponent,InitializableComponent,Resolver<EntityDescriptor,CriteriaSet>,ClearableMetadataResolver,MetadataResolver,RefreshableMetadataResolver
public class CompositeMetadataResolver extends AbstractIdentifiedInitializableComponent implements MetadataResolver, RefreshableMetadataResolver, ClearableMetadataResolver
AMetadataResolverimplementation that answers requests by composing the answers of childMetadataResolvers.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classCompositeMetadataResolver.CompositeMetadataResolverIterable
-
Field Summary
Fields Modifier and Type Field Description private org.slf4j.LoggerlogClass logger.private List<MetadataResolver>resolversResolvers composed by this resolver.
-
Constructor Summary
Constructors Constructor Description CompositeMetadataResolver()Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Attempt to clear all data from the internal cache of the resolver.voidclear(String entityID)Attempt to clear data from the internal cache of the resolver for the specified entityID.protected voiddoDestroy()protected voiddoInitialize()ThrowablegetLastFailureCause()Gets the reason the last refresh failed.InstantgetLastRefresh()Gets the time the last refresh cycle occurred.InstantgetLastSuccessfulRefresh()Gets the time the last successful refresh cycle occurred.InstantgetLastUpdate()Get the time that the currently available metadata was last updated.MetadataFiltergetMetadataFilter()Gets the metadata filter applied to the metadata.List<MetadataResolver>getResolvers()Gets an immutable the list of currently registered resolvers.booleanisRequireValidMetadata()Gets whether the metadata returned by queries must be valid.voidrefresh()Refresh the data exposed by the resolver.Iterable<EntityDescriptor>resolve(CriteriaSet criteria)EntityDescriptorresolveSingle(CriteriaSet criteria)voidsetMetadataFilter(MetadataFilter newFilter)Sets the metadata filter applied to the metadata.voidsetRequireValidMetadata(boolean requireValidMetadata)Sets whether the metadata returned by queries must be valid.voidsetResolvers(List<MetadataResolver> newResolvers)Sets the current set of metadata resolvers.BooleanwasLastRefreshSuccess()Gets whether the last refresh cycle was successful.-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
getId, setId
-
Methods inherited from class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent
destroy, 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.IdentifiedComponent
getId
-
-
-
-
Field Detail
-
log
@Nonnull private final org.slf4j.Logger log
Class logger.
-
resolvers
@Nonnull @NonnullElements private List<MetadataResolver> resolvers
Resolvers composed by this resolver.
-
-
Method Detail
-
getResolvers
@Nonnull @NonnullElements @Unmodifiable @NotLive public List<MetadataResolver> getResolvers()
Gets an immutable the list of currently registered resolvers.- Returns:
- list of currently registered resolvers
-
setResolvers
public void setResolvers(@Nonnull @NonnullElements List<MetadataResolver> newResolvers) throws ResolverException
Sets the current set of metadata resolvers.- Parameters:
newResolvers- the metadata resolvers to use- Throws:
ResolverException- thrown if there is a problem adding the metadata provider
-
isRequireValidMetadata
public boolean isRequireValidMetadata()
Gets whether the metadata returned by queries must be valid.At a minimum, metadata is valid only if the date expressed in the
validUntilattribute of the element and all its ancestral elements has not passed. Specific implementations may add additional constraints.- Specified by:
isRequireValidMetadatain interfaceMetadataResolver- Returns:
- whether the metadata returned by queries must be valid
-
setRequireValidMetadata
public void setRequireValidMetadata(boolean requireValidMetadata)
Sets whether the metadata returned by queries must be valid.- Specified by:
setRequireValidMetadatain interfaceMetadataResolver- Parameters:
requireValidMetadata- whether the metadata returned by queries must be valid
-
getMetadataFilter
@Nullable public MetadataFilter getMetadataFilter()
Gets the metadata filter applied to the metadata.- Specified by:
getMetadataFilterin interfaceMetadataResolver- Returns:
- the metadata filter applied to the metadata
-
setMetadataFilter
public void setMetadataFilter(@Nullable MetadataFilter newFilter)Sets the metadata filter applied to the metadata.- Specified by:
setMetadataFilterin interfaceMetadataResolver- Parameters:
newFilter- the metadata filter applied to the metadata
-
resolve
public Iterable<EntityDescriptor> resolve(@Nullable CriteriaSet criteria) throws ResolverException
- Specified by:
resolvein interfaceResolver<EntityDescriptor,CriteriaSet>- Throws:
ResolverException
-
resolveSingle
public EntityDescriptor resolveSingle(@Nullable CriteriaSet criteria) throws ResolverException
- Specified by:
resolveSinglein interfaceResolver<EntityDescriptor,CriteriaSet>- Throws:
ResolverException
-
doInitialize
protected void doInitialize() throws ComponentInitializationException- Overrides:
doInitializein classAbstractIdentifiedInitializableComponent- Throws:
ComponentInitializationException
-
doDestroy
protected void doDestroy()
- Overrides:
doDestroyin classAbstractInitializableComponent
-
clear
public void clear() throws ResolverExceptionAttempt to clear all data from the internal cache of the resolver.- Specified by:
clearin interfaceClearableMetadataResolver- Throws:
ResolverException- if the clear operation was unsuccessful
-
clear
public void clear(String entityID) throws ResolverException
Attempt to clear data from the internal cache of the resolver for the specified entityID.- Specified by:
clearin interfaceClearableMetadataResolver- Parameters:
entityID- the target entityID- Throws:
ResolverException- if the clear operation was unsuccessful
-
refresh
public void refresh() throws ResolverExceptionRefresh the data exposed by the resolver.An implementation of this method should typically be either
synchronizedor make use other locking mechanisms to protect against concurrent access.- Specified by:
refreshin interfaceRefreshableMetadataResolver- Throws:
ResolverException- if the refresh operation was unsuccessful
-
getLastUpdate
@Nullable public Instant getLastUpdate()
Get the time that the currently available metadata was last updated. Note, this may be different than the time retrieved byRefreshableMetadataResolver.getLastRefresh()is the metadata was known not to have changed during the last refresh cycle.- Specified by:
getLastUpdatein interfaceRefreshableMetadataResolver- Returns:
- time when the currently metadata was last updated, null if metadata has never successfully been read in
-
getLastRefresh
@Nullable public Instant getLastRefresh()
Gets the time the last refresh cycle occurred.- Specified by:
getLastRefreshin interfaceRefreshableMetadataResolver- Returns:
- time the last refresh cycle occurred
-
getLastSuccessfulRefresh
public Instant getLastSuccessfulRefresh()
Gets the time the last successful refresh cycle occurred.- Specified by:
getLastSuccessfulRefreshin interfaceRefreshableMetadataResolver- Returns:
- time the last successful refresh cycle occurred
-
wasLastRefreshSuccess
public Boolean wasLastRefreshSuccess()
Gets whether the last refresh cycle was successful.- Specified by:
wasLastRefreshSuccessin interfaceRefreshableMetadataResolver- Returns:
- true if last refresh cycle was successful, false if not
-
getLastFailureCause
public Throwable getLastFailureCause()
Gets the reason the last refresh failed.- Specified by:
getLastFailureCausein interfaceRefreshableMetadataResolver- Returns:
- reason the last refresh failed or null if the last refresh was successful
-
-