ModeShape/modeshape — pull request #693 by rhauch (2013-02-13 22:56:25+00:00)
Title: MODE-1805 Query system can be disabled in AS7 kit

Added ability to completely disable the query system (including the generation/maintenance of indexes) in a repository in the AS7 subsystem. (The JSON repository configurations had this ability for some time, but it could not be controlled in AS7.)

This adds a new "enable-queries" XML attribute on the "repository" element in the subsystem configuration. This attributes defaults to "true" and therefore is backward compatible. However, setting it to "false" will completely disable the indexing system, although any index storage and indexing configuration within a repository configuration will remain as-is; it will simply not be used. This means that the repository's indexes and query system can be disabled (perhaps on a temporary basis) and then re-enabled without having to completely reconfigure the index storage and indexing parameters.

It was discovered that executing queries on a repository that had its query system disabled resulted in a NPE, because the running state did not have a RepositoryQueryManager instance. Rather than deal with all of the potential NPEs, a new specialization of the RepositoryQueryManager, called RepositoryDisabledQueryManager, was added and is instantiated within the running state when queries are disabled. This specialization essentially no-ops all of the operations. The result is that queries will return no results rather than throw an exception.

Additional warning messages are logged when the indexes are indeed disabled, since this will rarely be done in production.

Several new tests were added, including unit tests (in 'modeshape-jcr') and integration tests for the AS7 subsystem.

These changes should be merged into the '3.1.x' branch and cherry-picked into the 'master' branch.