org.exist.indexing
Interface Index

All Known Implementing Classes:
AbstractIndex, NGramIndex

public interface Index

Represents an arbitrary index structure that can be used by eXist. This is the main interface to be registered with the database instance. It provides methods to configure, open and close the index. These methods will be called by the main database instance during startup/shutdown. They don't need to be synchronized.


Method Summary
 void close()
          Close 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()
           
 String getIndexId()
          Returns an id which uniquely identifies this index.
 String getIndexName()
          Returns a name which uniquely identifies this index.
 IndexWorker getWorker()
          Create a new IndexWorker, which is used to access the index in a multi-threaded environment.
 void open()
          Open the index for writing and reading.
 void remove()
          Close the index and remove it completely, including all resources and files associated to it.
 void sync()
          Sync the index.
 

Method Detail

getIndexName

String getIndexName()
Returns a name which uniquely identifies this index. This is configured by the user

Returns:
a unique name identifying this index.

getIndexId

String getIndexId()
Returns an id which uniquely identifies this index. This is usually the class name

Returns:
a unique name identifying this index.

getBrokerPool

BrokerPool getBrokerPool()

configure

void configure(BrokerPool pool,
               String dataDir,
               Element config)
               throws DatabaseConfigurationException
Configure the index and all resources associated with it. This method is called while the database instance is initializing..

Parameters:
pool - the BrokerPool representing the current database instance.
dataDir - the main data directory where eXist stores its files.
config - the module element which configures this index, as found in conf.xml
Throws:
DatabaseConfigurationException

open

void open()
          throws DatabaseConfigurationException
Open the index for writing and reading. Will be called during initialization, but also if the database had to be restarted.

Throws:
DatabaseConfigurationException

close

void close()
           throws DBException
Close the index and all associated resources.

Throws:
DBException

sync

void sync()
          throws DBException
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.

Throws:
DBException

getWorker

IndexWorker getWorker()
Create 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.

Returns:
a new IndexWorker that can be used for concurrent access to the index.

remove

void remove()
            throws DBException
Close the index and remove it completely, including all resources and files associated to it. This method is called during database repair before the db contents are reindexed.

Throws:
DBException


Copyright (C) Wolfgang Meier. All rights reserved.