Package org.opensaml.saml.metadata.resolver.impl

# Class AbstractBatchMetadataResolver

java.lang.Object
net.shibboleth.shared.component.AbstractInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent
net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent
org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver
org.opensaml.saml.metadata.resolver.impl.AbstractBatchMetadataResolver

All Implemented Interfaces:
  `Iterable<EntityDescriptor>`, `Component`, `DestructableComponent`, `IdentifiableComponent`, `IdentifiedComponent`, `InitializableComponent`, `Resolver<EntityDescriptor,CriteriaSet>`, `IterableMetadataSource`, `BatchMetadataResolver`, `MetadataResolver`

Direct Known Subclasses:
  `AbstractReloadingMetadataResolver`, `DOMMetadataResolver`

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

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`protected class`
`AbstractBatchMetadataResolver.BatchEntityBackingStore`
Specialized entity backing store implementation for batch metadata resolvers.

## Nested classes/interfaces inherited from class org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver

`AbstractMetadataResolver.EntityBackingStore`

## Field Summary

Fields
Modifier and Type
Field
Description
`private boolean`
`cacheSourceMetadata`
Flag indicating whether to cache the original source metadata document.
`private Set<MetadataIndex>`
`indexes`
The set of indexes configured.
`private final org.slf4j.Logger`
`log`
Class logger.
`private boolean`
`resolveViaPredicatesOnly`
Flag indicating whether resolution may be performed solely by applying predicates to the entire metadata collection.

## Constructor Summary

Constructors
Constructor
Description
`AbstractBatchMetadataResolver()`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`protected AbstractBatchMetadataResolver.BatchEntityBackingStore`
`createNewBackingStore()`
Create a new backing store instance for EntityDescriptor data.
`protected Iterable<EntityDescriptor>`
`doResolve(CriteriaSet criteria)`
Subclasses should override this method.
`protected AbstractBatchMetadataResolver.BatchEntityBackingStore`
`ensureBackingStore()`
Get the EntityDescriptor backing store currently in use by the metadata resolver, raising a `ConstraintViolationException` if null.
`protected XMLObject`
`getCachedFilteredMetadata()`
Convenience method for getting the current effective cached filtered metadata.
`protected XMLObject`
`getCachedOriginalMetadata()`
Convenience method for getting the current effective cached original metadata.
`Set<MetadataIndex>`
`getIndexes()`
Get the configured indexes.
`Instant`
`getRootValidUntil()`
Get the validUntil of of the metadata batch root element, if present.
`protected void`
`indexEntityDescriptor(EntityDescriptor entityDescriptor, AbstractMetadataResolver.EntityBackingStore backingStore)`
Index the specified entity descriptor, updating the specified entity backing store instance as necessary.
`protected void`
`initMetadataResolver()`
Subclasses should override this method to perform any initialization logic necessary.
`protected boolean`
`isCacheSourceMetadata()`
Get whether to cache the original source metadata document.
`boolean`
`isResolveViaPredicatesOnly()`
Get the flag indicating whether resolution may be performed solely by applying predicates to the entire metadata collection.
`Boolean`
`isRootValid()`
Get the validity state of the metadata batch root element, as determined in an implementation-specific manner.
`Iterator<EntityDescriptor>`
`iterator()`
`protected Optional<Set<EntityDescriptor>>`
`lookupByIndexes(CriteriaSet criteria)`
Resolve the set up descriptors based on the indexes currently held.
`protected AbstractBatchMetadataResolver.BatchEntityBackingStore`
`preProcessNewMetadata(XMLObject root)`
Process the specified new metadata document, including metadata filtering and return its data in a new entity backing store instance.
`protected void`
`setCacheSourceMetadata(boolean flag)`
Set whether to cache the original source metadata document.
`void`
`setIndexes(Set<MetadataIndex> newIndexes)`
Set the configured indexes.
`void`
`setResolveViaPredicatesOnly(boolean flag)`
Set the flag indicating whether resolution may be performed solely by applying predicates to the entire metadata collection.

### Methods inherited from class org.opensaml.saml.metadata.resolver.impl.AbstractMetadataResolver

`doDestroy, doInitialize, filterMetadata, getActivationCondition, getBackingStore, getCriterionPredicateRegistry, getLogPrefix, getMetadataFilter, getMetricsBaseName, getParserPool, getType, getUnmarshallerFactory, isFailFastInitialization, isRequireValidMetadata, isSatisfyAnyPredicates, isUseDefaultPredicateRegistry, isValid, lookupEntityID, lookupIndexedEntityID, newFilterContext, predicateFilterCandidates, preProcessEntitiesDescriptor, preProcessEntityDescriptor, releaseMetadataDOM, removeByEntityID, resolve, resolveSingle, setActivationCondition, setBackingStore, setCriterionPredicateRegistry, setFailFastInitialization, setMetadataFilter, setMetricsBaseName, setParserPool, setRequireValidMetadata, setSatisfyAnyPredicates, setType, setUseDefaultPredicateRegistry, unmarshallMetadata`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiableInitializableComponent

`setId`

### Methods inherited from class net.shibboleth.shared.component.AbstractIdentifiedInitializableComponent

`ensureId, getId, ifDestroyedThrowDestroyedComponentException, ifInitializedThrowUnmodifiabledComponentException, ifNotInitializedThrowUninitializedComponentException`

### Methods inherited from class net.shibboleth.shared.component.AbstractInitializableComponent

`checkComponentActive, checkSetterPreconditions, 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.shared.component.IdentifiedComponent

`getId`

### Methods inherited from interface java.lang.Iterable

`forEach, spliterator`

### Methods inherited from interface org.opensaml.saml.metadata.resolver.MetadataResolver

`getMetadataFilter, getType, isRequireValidMetadata, setMetadataFilter, setRequireValidMetadata`

### Methods inherited from interface net.shibboleth.shared.resolver.Resolver

`resolve, resolveSingle`

## Field Details

### log

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

### cacheSourceMetadata

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

### indexes

@Nonnull private Set<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 Details

### AbstractBatchMetadataResolver

public AbstractBatchMetadataResolver()
Constructor.

## Method Details

### iterator

public Iterator<EntityDescriptor> iterator()

Specified by:
  `iterator` in interface `Iterable<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 @Unmodifiable @NotLive public Set<MetadataIndex> getIndexes()
Get the configured indexes.

Returns:
  the set of configured indexes

### setIndexes

public void setIndexes(@Nullable Set<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()
Get the validUntil of of the metadata batch root element, if present.

Specified by:
  `getRootValidUntil` in interface `BatchMetadataResolver`
Returns:
  the validUntil date/time of the root element, or null if not available

### isRootValid

@Nullable public Boolean isRootValid()
Get the validity state of the metadata batch root element, as determined in an implementation-specific manner.

Specified by:
  `isRootValid` in interface `BatchMetadataResolver`
Returns:
  true if root element is valid, false if not valid, null if indeterminate

### doResolve

@Nonnull protected Iterable<EntityDescriptor> doResolve(@Nullable CriteriaSet criteria) throws ResolverException
Subclasses should override this method.

Specified by:
  `doResolve` in class `AbstractMetadataResolver`
Parameters:
  `criteria` - input criteria
Returns:
  resolution outcome
Throws:
  `ResolverException` - if an error occurs

### lookupByIndexes

@Nonnull protected Optional<Set<EntityDescriptor>> lookupByIndexes(@Nullable 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 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

### createNewBackingStore

@Nonnull protected AbstractBatchMetadataResolver.BatchEntityBackingStore createNewBackingStore()
Create a new backing store instance for EntityDescriptor data. Subclasses may override to return a more specialized subclass type. Note this method does not make the returned backing store the effective one in use. The caller is responsible for calling `AbstractMetadataResolver.setBackingStore(EntityBackingStore)` to make it the effective instance in use.

Overrides:
  `createNewBackingStore` in class `AbstractMetadataResolver`
Returns:
  the new backing store instance

### ensureBackingStore

@Nonnull protected AbstractBatchMetadataResolver.BatchEntityBackingStore ensureBackingStore()
Get the EntityDescriptor backing store currently in use by the metadata resolver, raising a `ConstraintViolationException` if null.

Overrides:
  `ensureBackingStore` in class `AbstractMetadataResolver`
Returns:
  the current effective entity backing store

### initMetadataResolver

protected void initMetadataResolver() throws ComponentInitializationException
Subclasses should override this method to perform any initialization logic necessary. Default implementation is a no-op.

Overrides:
  `initMetadataResolver` in class `AbstractMetadataResolver`
Throws:
  `ComponentInitializationException` - thrown if there is a problem initializing the provider

### getCachedOriginalMetadata

@Nullable protected 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 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 XMLObject root) throws 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:
  `FilterException` - if there is a problem filtering the metadata