Class ChainingMetadataResolver

  • All Implemented Interfaces:
    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.IdentifiedComponent, net.shibboleth.utilities.java.support.component.InitializableComponent, net.shibboleth.utilities.java.support.resolver.Resolver<EntityDescriptor,​net.shibboleth.utilities.java.support.resolver.CriteriaSet>, ClearableMetadataResolver, MetadataResolver, RefreshableMetadataResolver

    public class ChainingMetadataResolver
    extends net.shibboleth.utilities.java.support.component.AbstractIdentifiableInitializableComponent
    implements MetadataResolver, RefreshableMetadataResolver, ClearableMetadataResolver
    A metadata provider that uses registered resolvers, in turn, to answer queries. The Iterable of entity descriptors returned is the first non-null and non-empty Iterable found while iterating over the registered resolvers in resolver list order.
    • Field Detail

      • log

        @Nonnull
        private final org.slf4j.Logger log
        Class logger.
      • resolvers

        @Nonnull
        @NonnullElements
        private List<MetadataResolver> resolvers
        Registered resolvers.
    • Constructor Detail

      • ChainingMetadataResolver

        public ChainingMetadataResolver()
        Constructor.
    • Method Detail

      • getResolvers

        @Nonnull
        @NonnullElements
        @Unmodifiable
        @NotLive
        public List<MetadataResolver> getResolvers()
        Get an immutable the list of currently registered resolvers.
        Returns:
        list of currently registered resolvers
      • setResolvers

        public void setResolvers​(@Nonnull @NonnullElements
                                 List<? extends MetadataResolver> newResolvers)
                          throws net.shibboleth.utilities.java.support.resolver.ResolverException
        Set the registered metadata resolvers.
        Parameters:
        newResolvers - the metadata resolvers to use
        Throws:
        net.shibboleth.utilities.java.support.resolver.ResolverException - thrown if there is a problem adding the metadata resolvers
      • 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 validUntil attribute of the element and all its ancestral elements has not passed. Specific implementations may add additional constraints.

        Specified by:
        isRequireValidMetadata in interface MetadataResolver
        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:
        setRequireValidMetadata in interface MetadataResolver
        Parameters:
        requireValidMetadata - whether the metadata returned by queries must be valid
      • setMetadataFilter

        public void setMetadataFilter​(MetadataFilter newFilter)
        Sets the metadata filter applied to the metadata.
        Specified by:
        setMetadataFilter in interface MetadataResolver
        Parameters:
        newFilter - the metadata filter applied to the metadata
      • resolveSingle

        @Nullable
        public EntityDescriptor resolveSingle​(@Nullable
                                              net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
                                       throws net.shibboleth.utilities.java.support.resolver.ResolverException
        Specified by:
        resolveSingle in interface net.shibboleth.utilities.java.support.resolver.Resolver<EntityDescriptor,​net.shibboleth.utilities.java.support.resolver.CriteriaSet>
        Throws:
        net.shibboleth.utilities.java.support.resolver.ResolverException
      • resolve

        @Nonnull
        public Iterable<EntityDescriptor> resolve​(@Nullable
                                                  net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
                                           throws net.shibboleth.utilities.java.support.resolver.ResolverException
        Specified by:
        resolve in interface net.shibboleth.utilities.java.support.resolver.Resolver<EntityDescriptor,​net.shibboleth.utilities.java.support.resolver.CriteriaSet>
        Throws:
        net.shibboleth.utilities.java.support.resolver.ResolverException
      • clear

        public void clear()
                   throws net.shibboleth.utilities.java.support.resolver.ResolverException
        Attempt to clear all data from the internal cache of the resolver.
        Specified by:
        clear in interface ClearableMetadataResolver
        Throws:
        net.shibboleth.utilities.java.support.resolver.ResolverException - if the clear operation was unsuccessful
      • clear

        public void clear​(String entityID)
                   throws net.shibboleth.utilities.java.support.resolver.ResolverException
        Attempt to clear data from the internal cache of the resolver for the specified entityID.
        Specified by:
        clear in interface ClearableMetadataResolver
        Parameters:
        entityID - the target entityID
        Throws:
        net.shibboleth.utilities.java.support.resolver.ResolverException - if the clear operation was unsuccessful
      • refresh

        public void refresh()
                     throws net.shibboleth.utilities.java.support.resolver.ResolverException
        Refresh the data exposed by the resolver.

        An implementation of this method should typically be either synchronized or make use other locking mechanisms to protect against concurrent access.

        Specified by:
        refresh in interface RefreshableMetadataResolver
        Throws:
        net.shibboleth.utilities.java.support.resolver.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 by RefreshableMetadataResolver.getLastRefresh() is the metadata was known not to have changed during the last refresh cycle.
        Specified by:
        getLastUpdate in interface RefreshableMetadataResolver
        Returns:
        time when the currently metadata was last updated, null if metadata has never successfully been read in
      • doInitialize

        protected void doInitialize()
                             throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
        Overrides:
        doInitialize in class net.shibboleth.utilities.java.support.component.AbstractIdentifiedInitializableComponent
        Throws:
        net.shibboleth.utilities.java.support.component.ComponentInitializationException
      • doDestroy

        protected void doDestroy()
        Overrides:
        doDestroy in class net.shibboleth.utilities.java.support.component.AbstractInitializableComponent