org.apache.jackrabbit.core.query.lucene.directory
Class FSDirectoryManager

java.lang.Object
  extended by org.apache.jackrabbit.core.query.lucene.directory.FSDirectoryManager
All Implemented Interfaces:
DirectoryManager

public class FSDirectoryManager
extends Object
implements DirectoryManager

FSDirectoryManager implements a directory manager for FSDirectory instances.


Constructor Summary
FSDirectoryManager()
           
 
Method Summary
 boolean delete(String name)
          Deletes the directory with the given name.
 void dispose()
          Frees resources associated with this directory manager.
 org.apache.lucene.store.Directory getDirectory(String name)
          Gets the directory with the given name.
 String[] getDirectoryNames()
          Returns the names of the currently available directories.
 boolean hasDirectory(String name)
          Checks if there exists a directory with the given name.
 void init(SearchIndex handler)
          Initializes the directory manager with a reference to the search index.
 boolean rename(String from, String to)
          Renames a directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FSDirectoryManager

public FSDirectoryManager()
Method Detail

init

public void init(SearchIndex handler)
          throws IOException
Initializes the directory manager with a reference to the search index.

Specified by:
init in interface DirectoryManager
Parameters:
handler - the query handler implementation.
Throws:
IOException - if an error occurs while initializing the directory manager.

hasDirectory

public boolean hasDirectory(String name)
                     throws IOException
Checks if there exists a directory with the given name.

Specified by:
hasDirectory in interface DirectoryManager
Parameters:
name - the name of a directory.
Returns:
true if the directory exists; false otherwise.
Throws:
IOException - if an error occurs while looking up directories.

getDirectory

public org.apache.lucene.store.Directory getDirectory(String name)
                                               throws IOException
Gets the directory with the given name. If the directory does not yet exist then it will be created.

Specified by:
getDirectory in interface DirectoryManager
Parameters:
name - the name of a directory.
Returns:
the directory.
Throws:
IOException - if an error occurs while getting or creating the directory.

getDirectoryNames

public String[] getDirectoryNames()
                           throws IOException
Returns the names of the currently available directories.

Specified by:
getDirectoryNames in interface DirectoryManager
Returns:
names of the currently available directories.
Throws:
IOException - if an error occurs while retrieving the directory names.

delete

public boolean delete(String name)
Deletes the directory with the given name.

Specified by:
delete in interface DirectoryManager
Parameters:
name - the name of the directory to delete.
Returns:
true if the directory could be deleted successfully, false otherwise. This method also returns false when the directory with the given name does not exist.

rename

public boolean rename(String from,
                      String to)
Renames a directory.

Specified by:
rename in interface DirectoryManager
Parameters:
from - the name of the directory to rename.
to - the new name for the directory.
Returns:
true if the directory was successfully renamed. Returns false if there is no directory with name from or there already exists a directory with name to or an error occurs while renaming the directory.

dispose

public void dispose()
Frees resources associated with this directory manager.

Specified by:
dispose in interface DirectoryManager


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.