Interface DirectoryManager
-
- All Known Implementing Classes:
FSDirectoryManager
,RAMDirectoryManager
public interface DirectoryManager
DirectoryManager
defines an interface for managing directory instances used by the search index.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description boolean
delete(String name)
Deletes the directory with the given name.void
dispose()
Frees resources associated with this directory manager.Directory
getDirectory(String name)
Gets the directory with the givenname
.String[]
getDirectoryNames()
Returns the names of the currently available directories.boolean
hasDirectory(String name)
Checks if there exists a directory with the givenname
.void
init(SearchIndex handler)
Initializes the directory manager with a reference to the search index.boolean
rename(String from, String to)
Renames a directory.
-
-
-
Method Detail
-
init
void init(SearchIndex handler) throws IOException
Initializes the directory manager with a reference to the search index.- Parameters:
handler
- the query handler implementation.- Throws:
IOException
- if an error occurs while initializing the directory manager.
-
hasDirectory
boolean hasDirectory(String name) throws IOException
Checks if there exists a directory with the givenname
.- 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
Directory getDirectory(String name) throws IOException
Gets the directory with the givenname
. If the directory does not yet exist then it will be created.- Parameters:
name
- the name of a directory.- Returns:
- the directory.
- Throws:
IOException
- if an error occurs while getting or creating the directory.
-
getDirectoryNames
String[] getDirectoryNames() throws IOException
Returns the names of the currently available directories.- Returns:
- names of the currently available directories.
- Throws:
IOException
- if an error occurs while retrieving the directory names.
-
delete
boolean delete(String name)
Deletes the directory with the given name.- Parameters:
name
- the name of the directory to delete.- Returns:
true
if the directory could be deleted successfully,false
otherwise. This method also returnsfalse
when the directory with the givenname
does not exist.
-
rename
boolean rename(String from, String to)
Renames a directory.- Parameters:
from
- the name of the directory to rename.to
- the new name for the directory.- Returns:
true
if the directory was successfully renamed. Returnsfalse
if there is no directory with namefrom
or there already exists a directory with nameto
or an error occurs while renaming the directory.
-
dispose
void dispose()
Frees resources associated with this directory manager.
-
-