public interface IndexManager
Workspace.getIndexManager()
, like NodeTypeManager
it represents a session's mechanism to
define, alter, or remove index definitions for the whole repository (not just the session's workspace
).
To create an IndexDefinition:
createIndexDefinitionTemplate()
method to obtain a new blank templateIndexDefinitionTemplate
to make the template accurately describe the new or updated
index definitioncreate a column definition
template
and call the setters to define the property name
to
which the column applies and the type for the column
.IndexDefinitionTemplate.setColumnDefinitions(Iterable)
to assign the column definitions to the index
definitionIndexDefinitionTemplate
, which is also an IndexDefinition
, can then be passed to the
registerIndex(IndexDefinition, boolean)
or registerIndexes(IndexDefinition[], boolean)
methods to add/update
the index definition.Workspace.getIndexManager()
Modifier and Type | Interface and Description |
---|---|
static class |
IndexManager.IndexStatus
Enum with a list of possible statuses for managed indexes.
|
Modifier and Type | Method and Description |
---|---|
IndexColumnDefinitionTemplate |
createIndexColumnDefinitionTemplate()
Create a new template that can be used to programmatically define a column on an index.
|
IndexDefinitionTemplate |
createIndexDefinitionTemplate()
Create a new template that can be used to programmatically define an index.
|
Map<String,IndexDefinition> |
getIndexDefinitions()
Get a map of the registered index definitions keyed by their names.
|
List<String> |
getIndexNames(String providerName,
String workspaceName,
IndexManager.IndexStatus status)
Returns a list with the names of all the indexes that have a certain status, for a provider and workspace.
|
IndexManager.IndexStatus |
getIndexStatus(String providerName,
String indexName,
String workspaceName)
Returns the status of the index with the given name for the given provider and workspace.
|
Set<String> |
getProviderNames()
Get the names of the available index providers.
|
void |
registerIndex(IndexDefinition indexDefinition,
boolean allowUpdate)
Register a new definition for an index.
|
void |
registerIndexes(IndexDefinition[] indexDefinitions,
boolean allowUpdate)
Register new definitions for several indexes.
|
void |
unregisterIndexes(String... indexNames)
Removes an existing index definition.
|
Set<String> getProviderNames()
Map<String,IndexDefinition> getIndexDefinitions()
registerIndex(IndexDefinition, boolean)
or registerIndexes(IndexDefinition[], boolean)
; to remove an
index, use unregisterIndexes(java.lang.String...)
.void registerIndex(IndexDefinition indexDefinition, boolean allowUpdate) throws InvalidIndexDefinitionException, IndexExistsException, RepositoryException
indexDefinition
- the definition; may not be nullallowUpdate
- true if the definition can update or overwrite an existing definition with the same name, or false if
calling this method should result in an exception when the repository already contains a definition with the same
name already existsInvalidIndexDefinitionException
- if the new definition is invalidIndexExistsException
- if allowUpdate
is false
and the IndexDefinition
specifies a node type name that is already registered.RepositoryException
- if there is a problem registering the new definition, or if an existing indexvoid registerIndexes(IndexDefinition[] indexDefinitions, boolean allowUpdate) throws InvalidIndexDefinitionException, IndexExistsException, RepositoryException
indexDefinitions
- the definitions; may not be nullallowUpdate
- true if each of the definition can update or overwrite an existing definition with the same name, or
false if calling this method should result in an exception when the repository already contains any definition with
names that match the supplied definitionsInvalidIndexDefinitionException
- if the new definition is invalidIndexExistsException
- if allowUpdate
is false
and the IndexDefinition
specifies a node type name that is already registered.RepositoryException
- if there is a problem registering the new definition, or if an existing indexvoid unregisterIndexes(String... indexNames) throws NoSuchIndexException, RepositoryException
indexNames
- the names of the index definition to be removed; may not be nullNoSuchIndexException
- there is no index with the supplied nameRepositoryException
- if there is a problem registering the new definition, or if an existing indexIndexDefinitionTemplate createIndexDefinitionTemplate()
IndexColumnDefinitionTemplate createIndexColumnDefinitionTemplate()
IndexManager.IndexStatus getIndexStatus(String providerName, String indexName, String workspaceName)
providerName
- a String
the name of an index provider; may not be nullindexName
- a String
the name of an index which should exist for the provider; may not be nullworkspaceName
- a String
the name of a workspace for which the index was created; may not be nullIndexManager.IndexStatus
instance, never null
but possibly
IndexManager.IndexStatus.NON_EXISTENT
if a provider with this name does not exist
or an index with this name does not exist for the provider or the index doesn't exist for the given workspace.List<String> getIndexNames(String providerName, String workspaceName, IndexManager.IndexStatus status)
providerName
- a String
the name of an index provider; may not be nullworkspaceName
- a String
the name of a workspace for which the index was created; may not be nullstatus
- a IndexManager.IndexStatus
instance; may not be nullnull
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.