ModeShape/modeshape — pull request #1085 by rhauch (2014-04-03 12:50:34+00:00)
Title: MODE-2188 Added management of index providers and index definitions

ModeShape now can manage index providers and index definitions via a programmatic API that allows registering new/updated providers and adding/updating/removing index definitions. Index definitions are stored as nodes in the system area using a structure such as:

```
/jcr:system/mode:indexes/{providerName}/{indexDefinition}/{indexColumnDefinition}
```
Changes on one process in the cluster will be persisted to the cace store, and events on all processes in the cluster will signal a refreshing of a snapshot of the index definitions used by the query system. Additionally, when changes are made to an index definition, the provider that owns that definition will be notified of the new/changed or removed index definition.

Index provider information is not stored in the system area, but rather is used to instantiate the providers in the same way as sequencers and connectors. Thus, the repository configuration for each process in the cluster needs to define the index providers; no information is shared across processes. Notice that all process-specific information about indexes must be defined on the provider. For example, a notional provider that stores indexes on the file system would likely require as a configuration setting the directory in which those files are stored, and this could vary in each process' configuration. BTW, this maintains ModeShape's convention of using the same repository configuration file on each process in the cluster, albeit with variables for any configuration parameters that must vary for the different processes.

Every index definition explicitly states the name of the provider that owns it. If there is no such provider, ModeShape will mark the index definition as 'disabled' and it will not be used on that process.

At this time it is not yet possible to define index providers or index definitions in the repository configuration JSON file or the Wildfly subsystem. This will be done with a future commit.

However, it is possible with this commit to programmatically register a provider and define multiple indexes. Testing will also be done in a future commit as a practical and usable provider is available.

The package and most of the interfaces in the index SPI introduced in 4.0.0.Alpha1 (e.g., formerly 'org.modeshape.jcr.spi.query') were renamed to be shorter and more appropriate for their current & planned scope. For example, the "QueryIndexProvider" interface is now simply "IndexProvider".