public class EsIndexProvider extends IndexProvider
IndexProvider.ManagedIndexOperation
DEFAULT_BATCH_SIZE
Constructor and Description |
---|
EsIndexProvider() |
Modifier and Type | Method and Description |
---|---|
protected void |
doInitialize()
Method that should do the provider-specific initialization work.
|
protected IndexUsage |
evaluateUsage(QueryContext context,
IndexCostCalculator calculator,
IndexDefinition defn)
Returns an object which is used during the planning phase to evaluate if a certain index should be used or not.
|
protected int |
getCostEstimate()
Returns a positive number representing the cost estimate of using indexes from this provider.
|
String |
getHost()
Gets ES instance address.
|
protected ManagedIndexBuilder |
getIndexBuilder(IndexDefinition defn,
String workspaceName,
NodeTypes.Supplier nodeTypesSupplier,
ChangeSetAdapter.NodeTypePredicate matcher)
Offers subclasses the possibility of providing a
ManagedIndexBuilder instance which significantly simplifies the
task of creating or updating ManagedIndex instances for providers. |
int |
getPort()
Gets ES instance port number.
|
protected void |
postShutdown()
Method called during #shutdown() after each of the managed indexes have been shutdown.
|
void |
setHost(String host)
Assigns ES instance address.
|
void |
setPort(int port)
Gets ES instance port number.
|
void |
validateProposedIndex(ExecutionContext context,
IndexDefinition defn,
NodeTypes.Supplier nodeTypeSupplier,
Problems problems)
Validate the proposed index definition, and use the supplied problems to report any issues that will prevent this provider
from creating and using an index with the given definition.
|
batchSize, context, createIndex, environment, getIndex, getIndexes, getIndexNames, getIndexPlanner, getIndexWriter, getLatestIndexUpdateTime, getManagedIndex, getName, getRepositoryName, initialize, isType, logger, matches, matches, names, namespaces, notify, notify, notify, onEachIndex, onEachIndexInWorkspace, planUseOfIndex, preShutdown, removeIndex, shutdown, updateIndex, validateDefaultColumnDefinitionType, validateDefaultColumnTypes, valueFactories
protected void doInitialize() throws RepositoryException
IndexProvider
By the time this method is called, ModeShape will hav already set the IndexProvider.context
, IndexProvider.logger
, IndexProvider.name
, and
IndexProvider.repositoryName
plus any fields that match configuration properties for the provider.
This is an excellent place for providers to validate the provider-specific fields set by ModeShape via reflection during instantiation.
doInitialize
in class IndexProvider
RepositoryException
- if there is a problem initializing the providerpublic String getHost()
public void setHost(String host)
host
- ip address or domain name.public int getPort()
public void setPort(int port)
protected void postShutdown()
IndexProvider
postShutdown
in class IndexProvider
protected int getCostEstimate()
IndexProvider
getCostEstimate
in class IndexProvider
IndexCostCalculator.Costs
public void validateProposedIndex(ExecutionContext context, IndexDefinition defn, NodeTypes.Supplier nodeTypeSupplier, Problems problems)
IndexProvider
This should only be implemented if the provider has any particular validation requirements (for example it doesn't support
multiple columns or certain index types). The repository will perform for all index definitions some basic validations
via IndexProvider.validateDefaultColumnTypes(ExecutionContext, IndexDefinition, Problems)
validateProposedIndex
in class IndexProvider
context
- the execution context in which to perform the validation; never nulldefn
- the proposed index definition; never nullnodeTypeSupplier
- the supplier for the NodeTypes object that contains information about the currently-registered
node types; never nullproblems
- the problems that should be used to report any issues with the index definition; never nullprotected ManagedIndexBuilder getIndexBuilder(IndexDefinition defn, String workspaceName, NodeTypes.Supplier nodeTypesSupplier, ChangeSetAdapter.NodeTypePredicate matcher)
IndexProvider
ManagedIndexBuilder
instance which significantly simplifies the
task of creating or updating ManagedIndex
instances for providers.
If a provider chooses to override this method, it does not have to override
the #createIndex(IndexDefinition, String, NodeTypes.Supplier, NodeTypePredicate, IndexFeedback)
method or
the #updateIndex(IndexDefinition, IndexDefinition, ManagedIndex, String, NodeTypes.Supplier, NodeTypePredicate, IndexFeedback)
method, as the builder instance will be used to create specific indexes and adapters, based on the index definition.
Providers can also choose to ignore this method, in which case they will have to override the
#createIndex(IndexDefinition, String, NodeTypes.Supplier, NodeTypePredicate, IndexFeedback)
and
#updateIndex(IndexDefinition, IndexDefinition, ManagedIndex, String, NodeTypes.Supplier, NodeTypePredicate, IndexFeedback)
methods.
getIndexBuilder
in class IndexProvider
defn
- the definition of the index; never nullworkspaceName
- the name of the actual workspace to which the new index applies; never nullnodeTypesSupplier
- the supplier for the current node types cache; never nullmatcher
- the node type matcher used to determine which nodes should be included in the index, and which automatically
updates when node types are changed in the repository; may not be nullManagedIndexBuilder
instance, or null
(the default) which indicates that a provider chooses to
ovveride both the createIndex and updateIndex methods.protected IndexUsage evaluateUsage(QueryContext context, IndexCostCalculator calculator, IndexDefinition defn)
IndexProvider
evaluateUsage
in class IndexProvider
context
- the context of the original query; never nullcalculator
- the calculator that should be used to record plan information for the index; never nulldefn
- the definition for the index; never nullIndexUsage
instance, or null
which is the default and which indicates that a provider chooses
to override the IndexProvider.planUseOfIndex(QueryContext, IndexCostCalculator, String, ManagedIndex, IndexDefinition)
methodIndexProvider.planUseOfIndex(QueryContext, IndexCostCalculator, String, ManagedIndex, IndexDefinition)
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.