Class AbstractBatchMetadataResolver

  • All Implemented Interfaces:
    Iterable<org.opensaml.saml.saml2.metadata.EntityDescriptor>, 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<org.opensaml.saml.saml2.metadata.EntityDescriptor,​net.shibboleth.utilities.java.support.resolver.CriteriaSet>, org.opensaml.saml.metadata.IterableMetadataSource, org.opensaml.saml.metadata.resolver.BatchMetadataResolver, org.opensaml.saml.metadata.resolver.MetadataResolver
    Direct Known Subclasses:
    AbstractReloadingMetadataResolver, DOMMetadataResolver

    public abstract class AbstractBatchMetadataResolver
    extends AbstractMetadataResolver
    implements org.opensaml.saml.metadata.resolver.BatchMetadataResolver, org.opensaml.saml.metadata.IterableMetadataSource
    Abstract subclass for metadata resolvers that process and resolve metadata at a given point in time from a single metadata source document.
    • Field Detail

      • log

        private final org.slf4j.Logger log
        Class logger.
      • cacheSourceMetadata

        private boolean cacheSourceMetadata
        Flag indicating whether to cache the original source metadata document.
      • indexes

        private Set<org.opensaml.saml.metadata.resolver.index.MetadataIndex> indexes
        The set of indexes configured.
      • resolveViaPredicatesOnly

        private boolean resolveViaPredicatesOnly
        Flag indicating whether resolution may be performed solely by applying predicates to the entire metadata collection. Defaults to false.
    • Constructor Detail

      • AbstractBatchMetadataResolver

        public AbstractBatchMetadataResolver()
        Constructor.
    • Method Detail

      • iterator

        public Iterator<org.opensaml.saml.saml2.metadata.EntityDescriptor> iterator()
        Specified by:
        iterator in interface Iterable<org.opensaml.saml.saml2.metadata.EntityDescriptor>
      • isCacheSourceMetadata

        protected boolean isCacheSourceMetadata()
        Get whether to cache the original source metadata document.
        Returns:
        true if source should be cached, false otherwise
      • setCacheSourceMetadata

        protected void setCacheSourceMetadata​(boolean flag)
        Set whether to cache the original source metadata document.
        Parameters:
        flag - true if source should be cached, false otherwise
      • getIndexes

        @Nonnull
        @NonnullElements
        @Unmodifiable
        @NotLive
        public Set<org.opensaml.saml.metadata.resolver.index.MetadataIndex> getIndexes()
        Get the configured indexes.
        Returns:
        the set of configured indexes
      • setIndexes

        public void setIndexes​(@Nullable
                               Set<org.opensaml.saml.metadata.resolver.index.MetadataIndex> newIndexes)
        Set the configured indexes.
        Parameters:
        newIndexes - the new indexes to set
      • isResolveViaPredicatesOnly

        public boolean isResolveViaPredicatesOnly()
        Get the flag indicating whether resolution may be performed solely by applying predicates to the entire metadata collection.
        Returns:
        true if resolution may be attempted solely via predicates, false if not
      • setResolveViaPredicatesOnly

        public void setResolveViaPredicatesOnly​(boolean flag)
        Set the flag indicating whether resolution may be performed solely by applying predicates to the entire metadata collection.
        Parameters:
        flag - true if resolution may be attempted solely via predicates, false if not
      • getRootValidUntil

        @Nullable
        public Instant getRootValidUntil()
        Specified by:
        getRootValidUntil in interface org.opensaml.saml.metadata.resolver.BatchMetadataResolver
      • isRootValid

        @Nullable
        public Boolean isRootValid()
        Specified by:
        isRootValid in interface org.opensaml.saml.metadata.resolver.BatchMetadataResolver
      • resolve

        @Nonnull
        public Iterable<org.opensaml.saml.saml2.metadata.EntityDescriptor> resolve​(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<org.opensaml.saml.saml2.metadata.EntityDescriptor,​net.shibboleth.utilities.java.support.resolver.CriteriaSet>
        Throws:
        net.shibboleth.utilities.java.support.resolver.ResolverException
      • lookupByIndexes

        @Nonnull
        @NonnullElements
        protected Optional<Set<org.opensaml.saml.saml2.metadata.EntityDescriptor>> lookupByIndexes​(@Nonnull
                                                                                                   net.shibboleth.utilities.java.support.resolver.CriteriaSet criteria)
        Resolve the set up descriptors based on the indexes currently held.
        Parameters:
        criteria - the criteria set to process
        Returns:
        an Optional instance containing the descriptors resolved via indexes, and based on the input criteria set. If the Optional instance indicates 'absent', there were either no indexes configured, or no criteria were applicable/understood by any indexes. If 'present' is indicated, then there were applicable/understood criteria, and the wrapped set contains the indexed data, which may be empty.
      • indexEntityDescriptor

        protected void indexEntityDescriptor​(@Nonnull
                                             org.opensaml.saml.saml2.metadata.EntityDescriptor entityDescriptor,
                                             @Nonnull
                                             AbstractMetadataResolver.EntityBackingStore backingStore)
        Index the specified entity descriptor, updating the specified entity backing store instance as necessary.
        Overrides:
        indexEntityDescriptor in class AbstractMetadataResolver
        Parameters:
        entityDescriptor - the target entity descriptor to process
        backingStore - the backing store instance to update
      • initMetadataResolver

        protected void initMetadataResolver()
                                     throws net.shibboleth.utilities.java.support.component.ComponentInitializationException
        Subclasses should override this method to perform any initialization logic necessary. Default implementation is a no-op.
        Overrides:
        initMetadataResolver in class AbstractMetadataResolver
        Throws:
        net.shibboleth.utilities.java.support.component.ComponentInitializationException - thrown if there is a problem initializing the provider
      • getCachedOriginalMetadata

        @Nullable
        protected org.opensaml.core.xml.XMLObject getCachedOriginalMetadata()
        Convenience method for getting the current effective cached original metadata.

        Note: may or may not be the same as that obtained from getCachedFilteredMetadata(), depending on what metadata filtering produced from the original metadata document.

        Returns:
        the current effective cached metadata document
      • getCachedFilteredMetadata

        @Nullable
        protected org.opensaml.core.xml.XMLObject getCachedFilteredMetadata()
        Convenience method for getting the current effective cached filtered metadata.

        Note: may or may not be the same as that obtained from getCachedOriginalMetadata(), depending on what metadata filtering produced from the original metadata document.

        Returns:
        the current effective cached metadata document
      • preProcessNewMetadata

        @Nonnull
        protected AbstractBatchMetadataResolver.BatchEntityBackingStore preProcessNewMetadata​(@Nonnull
                                                                                              org.opensaml.core.xml.XMLObject root)
                                                                                       throws org.opensaml.saml.metadata.resolver.filter.FilterException
        Process the specified new metadata document, including metadata filtering and return its data in a new entity backing store instance.
        Parameters:
        root - the root of the new metadata document being processed
        Returns:
        the new backing store instance
        Throws:
        org.opensaml.saml.metadata.resolver.filter.FilterException - if there is a problem filtering the metadata