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

# Class MetadataIndexManager<T>

java.lang.Object
org.opensaml.saml.metadata.resolver.index.impl.MetadataIndexManager<T>

Type Parameters:
  `T` - the type of data being indexed

Direct Known Subclasses:
  `LockableMetadataIndexManager`

public class MetadataIndexManager<T> extends Object
High-level component which handles index and lookup of instances of particular type of data item, for example `EntityDescriptor`, based on a set of `MetadataIndex` instances currently held.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static class`
`MetadataIndexManager.EntityIDExtractionFunction`
Extraction function which returns the entityID of the input `EntityDescriptor`.
`static class`
`MetadataIndexManager.IdentityExtractionFunction`
Extraction function which simply returns the input `EntityDescriptor`.

## Field Summary

Fields
Modifier and Type
Field
Description
`private final Function<EntityDescriptor,T>`
`entityDescriptorFunction`
Function to extract the data item to be indexed from an EntityDescriptor.
`private final Map<MetadataIndex,MetadataIndexStore<T>>`
`indexes`
Storage for secondary indexes.
`private org.slf4j.Logger`
`log`
Logger.

## Constructor Summary

Constructors
Constructor
Description
`MetadataIndexManager(Set<MetadataIndex> initIndexes, Function<EntityDescriptor,T> extractionFunction)`
Constructor.

## Method Summary

Modifier and Type
Method
Description
`void`
`deindexEntityDescriptor(EntityDescriptor descriptor)`
Remove from the index the specified `EntityDescriptor` based on the indexes currently held.
`Set<MetadataIndex>`
`getIndexes()`
Get the set of all `MetadataIndex` instances currently initialized.
`protected MetadataIndexStore<T>`
`getStore(MetadataIndex index)`
Get the `MetadataIndexStore` for the specified `MetadataIndex`.
`void`
`indexEntityDescriptor(EntityDescriptor descriptor)`
Index the specified `EntityDescriptor` based on the indexes currently held.
`Optional<Set<T>>`
`lookupIndexedItems(CriteriaSet criteria)`
Resolve the set of indexed data items based on the indexes currently held.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### log

@Nonnull private org.slf4j.Logger log
Logger.

### indexes

@Nonnull private final Map<MetadataIndex,MetadataIndexStore<T>> indexes
Storage for secondary indexes.

### entityDescriptorFunction

@Nonnull private final Function<EntityDescriptor,T> entityDescriptorFunction
Function to extract the data item to be indexed from an EntityDescriptor.

## Constructor Details

### MetadataIndexManager

public MetadataIndexManager(@Nullable Set<MetadataIndex> initIndexes, @Nonnull Function<EntityDescriptor,T> extractionFunction)
Constructor.

Parameters:
  `initIndexes` - indexes for which to initialize storage
  `extractionFunction` - function to extract the indexed data item from an EntityDescriptor

## Method Details

### getIndexes

@Nonnull @Unmodifiable @NotLive public Set<MetadataIndex> getIndexes()
Get the set of all `MetadataIndex` instances currently initialized.

Returns:
  the set of all current indexes

### getStore

@Nullable protected MetadataIndexStore<T> getStore(@Nonnull MetadataIndex index)
Get the `MetadataIndexStore` for the specified `MetadataIndex`.

Parameters:
  `index` - the index for which the store is desired
Returns:
  the index store for the index, may be null if index was not initialized for this manager instance

### lookupIndexedItems

@Nonnull public Optional<Set<T>> lookupIndexedItems(@Nullable CriteriaSet criteria)
Resolve the set of indexed data items based on the indexes currently held.

Parameters:
  `criteria` - the criteria set to process
Returns:
  an `Optional` instance containing the indexed data items 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

public void indexEntityDescriptor(@Nonnull EntityDescriptor descriptor)
Index the specified `EntityDescriptor` based on the indexes currently held.

Parameters:
  `descriptor` - the entity descriptor to index

### deindexEntityDescriptor

public void deindexEntityDescriptor(@Nonnull EntityDescriptor descriptor)
Remove from the index the specified `EntityDescriptor` based on the indexes currently held.

Parameters:
  `descriptor` - the entity descriptor to index