Class 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.
    • Field Detail

      • log

        private org.slf4j.Logger log
        Logger.
      • entityDescriptorFunction

        private Function<EntityDescriptor,​T> entityDescriptorFunction
        Function to extract the data item to be indexed from an EntityDescriptor.
    • Method Detail

      • 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
        @NonnullElements
        public Optional<Set<T>> lookupIndexedItems​(@Nonnull
                                                   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