org.compass.core.lucene.engine.store
Class AbstractDirectoryStore

java.lang.Object
  extended by org.compass.core.lucene.engine.store.AbstractDirectoryStore
All Implemented Interfaces:
DirectoryStore
Direct Known Subclasses:
AbstractCoherenceDirectoryStore, FSDirectoryStore, GigaSpaceDirectoryStore, JdbcDirectoryStore, RAMDirectoryStore, TerracottaDirectoryStore

public abstract class AbstractDirectoryStore
extends Object
implements DirectoryStore

Base class for different DirectoryStore implementations.

Author:
kimchy

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
AbstractDirectoryStore()
           
 
Method Summary
 void afterFailedCopyFrom(String subContext, String subIndex, CopyFromHolder holder)
           
 void afterSuccessfulCopyFrom(String subContext, String subIndex, CopyFromHolder holder)
           
 CopyFromHolder beforeCopyFrom(String subContext, String subIndex, Directory dir)
           
 void cleanIndex(Directory dir, String subContext, String subIndex)
          If applicable, cleans the given directory.
 void close()
          Closes the given directory.
 void closeDirectory(Directory dir, String subContext, String subIndex)
          Closes the given directory.
 void deleteIndex(Directory dir, String subContext, String subIndex)
          If applicable, deletes the given directory.
 Boolean indexExists(Directory dir)
          Returns true if the inex exists, false if it does not.
 String[] listSubIndexes(String subContext)
          Lists all the sub indexes for the given sub context.
 void performScheduledTasks(Directory dir, String subContext, String subIndex)
          Perform any scheduled tasks that are needed on the given directory.
 void registerEventListeners(SearchEngine searchEngine, SearchEngineEventManager eventManager)
           
 boolean requiresAsyncTransactionalContext()
          By default, stores do not require transactional context.
 String suggestedIndexDeletionPolicy()
          By default, return null which means let globabl settings to decide what the default index deletion policy should be.
 boolean suggestedUseCompoundFile()
          By default, stores should not use compound file format.
 boolean supportsConcurrentCommits()
          By default, stores support concurrent commits.
 boolean supportsConcurrentOperations()
          By defualt, stores support concurrent operations (return true).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.compass.core.lucene.engine.store.DirectoryStore
open
 

Field Detail

log

protected final transient org.apache.commons.logging.Log log
Constructor Detail

AbstractDirectoryStore

public AbstractDirectoryStore()
Method Detail

closeDirectory

public void closeDirectory(Directory dir,
                           String subContext,
                           String subIndex)
                    throws SearchEngineException
Description copied from interface: DirectoryStore
Closes the given directory.

Specified by:
closeDirectory in interface DirectoryStore
Throws:
SearchEngineException

indexExists

public Boolean indexExists(Directory dir)
                    throws SearchEngineException
Description copied from interface: DirectoryStore
Returns true if the inex exists, false if it does not. Can return null which then will cause the default checking to apply.

Specified by:
indexExists in interface DirectoryStore
Throws:
SearchEngineException

listSubIndexes

public String[] listSubIndexes(String subContext)
                        throws SearchEngineException,
                               UnsupportedOperationException
Description copied from interface: DirectoryStore
Lists all the sub indexes for the given sub context. Retruns null if the sub context directory does not even exists.

Throws an UnsupportedOperationException when the directory store does not support listing sub indexes.

Specified by:
listSubIndexes in interface DirectoryStore
Throws:
SearchEngineException
UnsupportedOperationException

deleteIndex

public void deleteIndex(Directory dir,
                        String subContext,
                        String subIndex)
                 throws SearchEngineException
Description copied from interface: DirectoryStore
If applicable, deletes the given directory.

Specified by:
deleteIndex in interface DirectoryStore
Throws:
SearchEngineException

cleanIndex

public void cleanIndex(Directory dir,
                       String subContext,
                       String subIndex)
                throws SearchEngineException
Description copied from interface: DirectoryStore
If applicable, cleans the given directory. Notes, this will be called right before the directory will be closed. And then a create index will be done.

Specified by:
cleanIndex in interface DirectoryStore
Throws:
SearchEngineException

performScheduledTasks

public void performScheduledTasks(Directory dir,
                                  String subContext,
                                  String subIndex)
                           throws SearchEngineException
Description copied from interface: DirectoryStore
Perform any scheduled tasks that are needed on the given directory.

Specified by:
performScheduledTasks in interface DirectoryStore
Throws:
SearchEngineException

registerEventListeners

public void registerEventListeners(SearchEngine searchEngine,
                                   SearchEngineEventManager eventManager)
Specified by:
registerEventListeners in interface DirectoryStore

beforeCopyFrom

public CopyFromHolder beforeCopyFrom(String subContext,
                                     String subIndex,
                                     Directory dir)
                              throws SearchEngineException
Specified by:
beforeCopyFrom in interface DirectoryStore
Throws:
SearchEngineException

afterSuccessfulCopyFrom

public void afterSuccessfulCopyFrom(String subContext,
                                    String subIndex,
                                    CopyFromHolder holder)
                             throws SearchEngineException
Specified by:
afterSuccessfulCopyFrom in interface DirectoryStore
Throws:
SearchEngineException

afterFailedCopyFrom

public void afterFailedCopyFrom(String subContext,
                                String subIndex,
                                CopyFromHolder holder)
                         throws SearchEngineException
Specified by:
afterFailedCopyFrom in interface DirectoryStore
Throws:
SearchEngineException

close

public void close()
Description copied from interface: DirectoryStore
Closes the given directory.

Specified by:
close in interface DirectoryStore

requiresAsyncTransactionalContext

public boolean requiresAsyncTransactionalContext()
By default, stores do not require transactional context.

Specified by:
requiresAsyncTransactionalContext in interface DirectoryStore

suggestedUseCompoundFile

public boolean suggestedUseCompoundFile()
By default, stores should not use compound file format.

Specified by:
suggestedUseCompoundFile in interface DirectoryStore

supportsConcurrentOperations

public boolean supportsConcurrentOperations()
By defualt, stores support concurrent operations (return true).

Specified by:
supportsConcurrentOperations in interface DirectoryStore

supportsConcurrentCommits

public boolean supportsConcurrentCommits()
By default, stores support concurrent commits.

Specified by:
supportsConcurrentCommits in interface DirectoryStore

suggestedIndexDeletionPolicy

public String suggestedIndexDeletionPolicy()
By default, return null which means let globabl settings to decide what the default index deletion policy should be.

Specified by:
suggestedIndexDeletionPolicy in interface DirectoryStore


Copyright (c) 2004-2009 The Compass Project.