org.modeshape.jcr.spi.index.provider

## Class IndexProvider

- java.lang.Object
- - org.modeshape.jcr.spi.index.provider.IndexProvider

-     public abstract class IndexProvider
      extends Object

  A component that provides access to and manages one or more indexes.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IndexProvider()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract Index` | `getIndex(String indexName)` Get the queryable index with the given name.
    `abstract IndexPlanner` | `getIndexPlanner()` Get the planner that, during the query planning/optimization phase, evaluates for a single source the AND-ed query constraints and defines indexes that may be used.
    `abstract IndexWriter` | `getIndexWriter()` Get the writer that ModeShape can use to update the indexes when repository content changes.
    `protected Logger` | `getLogger()`
    `String` | `getName()` Get the name for this provider.
    `String` | `getRepositoryName()` Get the name of the repository.
    `void` | `initialize()` Initialize the provider.
    `abstract boolean` | `isReindexingRequired()` Determine whether the indexes owned by this provider must be rebuilt.
    `abstract void` | `notify(IndexDefinitionChanges changes)` Signal that some of the definitions of indexes owned by this provider were changed.
    `void` | `shutdown()` Signal this provider that it is no longer needed and can release any resources that are being held.

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

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

- - ### Constructor Detail

    - #### IndexProvider

          public IndexProvider()

  - ### Method Detail

    - #### getLogger

          protected final Logger getLogger()

    - #### getName

          public final String getName()

      Get the name for this provider.
      Returns:
        the name; never null

    - #### getRepositoryName

          public final String getRepositoryName()

      Get the name of the repository.
      Returns:
        the repository name; never null

    - #### initialize

          public void initialize()
                          throws RepositoryException

      Initialize the provider. This is called automatically by ModeShape once for each provider instance, and should not be called by the provider itself.

      By default this method does nothing, so it should be overridden by implementations to do a one-time initialization of any internal components after all of the fields have been set during instantiation.

      Throws:
        `RepositoryException` - if there is a problem initializing the provider fail

    - #### isReindexingRequired

          public abstract boolean isReindexingRequired()

      Determine whether the indexes owned by this provider must be rebuilt. This method is normally called by ModeShape upon repository startup, although it may be called at other times.
      Returns:
        true if the repository should be re-indexed and this provider's `writer` be called

    - #### shutdown

          public void shutdown()
                        throws RepositoryException

      Signal this provider that it is no longer needed and can release any resources that are being held.
      Throws:
        `RepositoryException` - if there is a problem shutting down the provider

    - #### getIndexWriter

          public abstract IndexWriter getIndexWriter()

      Get the writer that ModeShape can use to update the indexes when repository content changes.
      Returns:
        the index writer; may be null if the indexes are updated outside of ModeShape

    - #### getIndex

          public abstract Index getIndex(String indexName)

      Get the queryable index with the given name.
      Parameters:
        `indexName` - the name of the index in this provider; never null
      Returns:
        the queryable index, or null if there is no such index

    - #### getIndexPlanner

          public abstract IndexPlanner getIndexPlanner()

      Get the planner that, during the query planning/optimization phase, evaluates for a single source the AND-ed query constraints and defines indexes that may be used.

      This method is typically called only once after the provider has been `initialized`.

      Returns:
        the index planner; may not be null

    - #### notify

          public abstract void notify(IndexDefinitionChanges changes)

      Signal that some of the definitions of indexes owned by this provider were changed. This method is also called upon startup of this repository instance so that the provider understands the index definitions that are available. The provider should adapt to these changes as best as possible.
      Parameters:
        `changes` - the changes in the definitions; never null

Copyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.