@Immutable public final class DefaultManagedIndex extends Object implements ManagedIndex
ManagedIndex
implementation which wraps an index instance created by a particular provider, offering
a default implementation for some index-related operations.Filter.Results
Constructor and Description |
---|
DefaultManagedIndex(ProvidedIndex<?> index,
IndexChangeAdapter adapter)
Creates a new managed index instance which wraps an provider-specific instance and a change adapter.
|
Modifier and Type | Method and Description |
---|---|
void |
clearAllData()
Remove all of the index entries from the index.
|
void |
enable(boolean enable)
Mark whether this index is enabled for use, or not enabled meaning it should not be used.
|
long |
estimateCardinality(List<Constraint> andedConstraints,
Map<String,Object> variables)
Compute the cost applying the given constraints joined together conceptually using AND.
|
long |
estimateTotalCount()
Get the estimated number of entries within this index.
|
Filter.Results |
filter(IndexConstraints constraints)
Return a
Filter.Results instance from which ModeShape can obtain the nodes that satisfy the supplied constraints. |
IndexChangeAdapter |
getIndexChangeAdapter()
Get the ChangeSetAdapter implementation through which changes to content are sent to the index.
|
IndexManager.IndexStatus |
getStatus()
Return the current status of the managed index
|
boolean |
isEnabled()
Determine if this index is enabled for use.
|
boolean |
requiresReindexing()
Return whether this index is newly created and requires reindexing, or false if the index already exists.
|
void |
shutdown(boolean destroyed)
Shut down this index and release all runtime resources.
|
void |
updateStatus(IndexManager.IndexStatus currentStatus,
IndexManager.IndexStatus newStatus)
Update the status of this index to a new value if the current status is
currentStatus |
public DefaultManagedIndex(ProvidedIndex<?> index, IndexChangeAdapter adapter)
index
- a ProvidedIndex
instance, may not be null.adapter
- a IndexChangeAdapter
instance, may not be null.public long estimateTotalCount()
Costable
estimateTotalCount
in interface Costable
public long estimateCardinality(List<Constraint> andedConstraints, Map<String,Object> variables)
Costable
estimateCardinality
in interface Costable
andedConstraints
- the constraints; never nullvariables
- the bound variables for the query that is being costed; never nullpublic Filter.Results filter(IndexConstraints constraints)
Filter
Filter.Results
instance from which ModeShape can obtain the nodes that satisfy the supplied constraints. This
method should return quickly, since no work (or at least very little work) should be done. All of the work should be
performed when the Filter.Results.getNextBatch(ResultWriter, int)
method is called on the results.public IndexChangeAdapter getIndexChangeAdapter()
ManagedIndex
ChangeSetListener
that is registered on the event bus and kept throughout the lifetime of the index (even if there
are changes), and that listener delegates to this adapter.getIndexChangeAdapter
in interface ManagedIndex
public void enable(boolean enable)
ManagedIndex
enable
in interface ManagedIndex
enable
- true if the index is to be enabled, or false otherwisepublic boolean isEnabled()
ManagedIndex
isEnabled
in interface ManagedIndex
public void shutdown(boolean destroyed)
Lifecycle
destroyed
is true
, then this index has been
removed from the repository and will not be reused; thus all persistent resources should also be released. If
destroyed
is false
, then this repository is merely shutting down and the index's persistent resources
should be kept so that they are available when the repository is restarted.shutdown
in interface Lifecycle
destroyed
- true if this index is being permanently removed from the repository and all runtime and persistent
resources can/should be released and cleaned up, or false if the repository is being shutdown and this index will be
needed the next time the repository is startedpublic void clearAllData()
Reindexable
clearAllData
in interface Reindexable
public IndexManager.IndexStatus getStatus()
ManagedIndex
getStatus
in interface ManagedIndex
IndexManager.IndexStatus
instance, never nullpublic void updateStatus(IndexManager.IndexStatus currentStatus, IndexManager.IndexStatus newStatus)
ManagedIndex
currentStatus
updateStatus
in interface ManagedIndex
currentStatus
- a IndexManager.IndexStatus
instance, may not be nullnewStatus
- a IndexManager.IndexStatus
instance, may not be nullpublic boolean requiresReindexing()
Reindexable
requiresReindexing
in interface Reindexable
Copyright © 2008–2016 JBoss, a division of Red Hat. All rights reserved.