org.exist.indexing
Class AbstractIndex

java.lang.Object
  extended by org.exist.indexing.AbstractIndex
All Implemented Interfaces:
Index
Direct Known Subclasses:
FTIndex, IndexStatistics

public abstract class AbstractIndex
extends Object
implements Index


Constructor Summary
AbstractIndex()
           
 
Method Summary
abstract  boolean checkIndex(DBBroker broker)
          Convenience method that allows to check index consistency.
abstract  void close()
          Closes the index and all associated resources.
 void configure(BrokerPool pool, String dataDir, Element config)
          Configure the index and all resources associated with it.
 BrokerPool getBrokerPool()
          Returns the BrokerPool on with this Index operates.
 String getDataDir()
           
 String getIndexId()
          Returns an id which uniquely identifies this index.
 String getIndexName()
          Returns a human-readable name which uniquely identifies this index.
abstract  IndexWorker getWorker(DBBroker broker)
          Returns a new IndexWorker, which is used to access the index in a multi-threaded environment.
abstract  void open()
          Opens the index for writing and reading.
abstract  void remove()
          Closes the index and removes it completely, including all resources and files associated to it.
abstract  void sync()
          Sync the index.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractIndex

public AbstractIndex()
Method Detail

configure

public void configure(BrokerPool pool,
                      String dataDir,
                      Element config)
               throws DatabaseConfigurationException
Description copied from interface: Index
Configure the index and all resources associated with it. This method is called while the database instance is initializing and receives the
<module id="foo" class="bar"/>
section of the configuration file.

Specified by:
configure in interface Index
Parameters:
pool - the BrokerPool representing the current database instance.
dataDir - the main data directory where eXist stores its files (if relevant).
config - the module element which configures this index, as found in conf.xml
Throws:
DatabaseConfigurationException

getIndexId

public String getIndexId()
Description copied from interface: Index
Returns an id which uniquely identifies this index. This is usually the class name.

Specified by:
getIndexId in interface Index
Returns:
a unique name identifying this index.

getIndexName

public String getIndexName()
Description copied from interface: Index
Returns a human-readable name which uniquely identifies this index. This is configured by the user

Specified by:
getIndexName in interface Index
Returns:
a unique name identifying this index.

getBrokerPool

public BrokerPool getBrokerPool()
Description copied from interface: Index
Returns the BrokerPool on with this Index operates.

Specified by:
getBrokerPool in interface Index
Returns:
the broker pool

getDataDir

public String getDataDir()

open

public abstract void open()
                   throws DatabaseConfigurationException
Description copied from interface: Index
Opens the index for writing and reading. Will be called during initialization, but also if the database has to be restarted.

Specified by:
open in interface Index
Throws:
DatabaseConfigurationException

close

public abstract void close()
                    throws DBException
Description copied from interface: Index
Closes the index and all associated resources.

Specified by:
close in interface Index
Throws:
DBException

sync

public abstract void sync()
                   throws DBException
Description copied from interface: Index
Sync the index. This method should make sure that all index contents are written to disk. It will be called during checkpoint events and the system relies on the index to materialize all data.

Specified by:
sync in interface Index
Throws:
DBException

remove

public abstract void remove()
                     throws DBException
Description copied from interface: Index
Closes the index and removes it completely, including all resources and files associated to it. This method is called during database repair before the db contents are reindexed.

Specified by:
remove in interface Index
Throws:
DBException

getWorker

public abstract IndexWorker getWorker(DBBroker broker)
Description copied from interface: Index
Returns a new IndexWorker, which is used to access the index in a multi-threaded environment. Every database instance has a number of DBBroker objects. All operations on the db have to go through one of these brokers. Each DBBroker retrieves an IndexWorker for every index by calling this method.

Specified by:
getWorker in interface Index
Parameters:
broker - The DBBroker that owns this worker
Returns:
a new IndexWorker that can be used for concurrent access to the index.

checkIndex

public abstract boolean checkIndex(DBBroker broker)
Description copied from interface: Index
Convenience method that allows to check index consistency.

Specified by:
checkIndex in interface Index
Parameters:
broker - the broker that will perform the operation.
Returns:
whether or not the index is in a consistent state. The definition of "consistency" is left to the user.


Copyright (C) Wolfgang Meier. All rights reserved.