org.apache.lucene.store.jdbc.handler
Interface FileEntryHandler

All Known Implementing Classes:
AbstractFileEntryHandler, ActualDeleteFileEntryHandler, MarkDeleteFileEntryHandler, NoOpFileEntryHandler

public interface FileEntryHandler

A file entry handler acts as a delegate to the JdbcDirectory for all "file" level operations. Allows the JdbcDirectory to be abstracted from any specific implementation details regarding a file entry, and have several different file entries for different files or files groups.

Author:
kimchy
See Also:
JdbcDirectorySettings.registerFileEntrySettings(String, org.apache.lucene.store.jdbc.JdbcFileEntrySettings)

Method Summary
 void close()
          Closes the file entry handler.
 void configure(JdbcDirectory jdbcDirectory)
          Called after the entry is created (during the JdbcDirectory initialization process.
 IndexOutput createOutput(String name)
          Creates an IndexOutput in order to write the file contents.
 void deleteFile(String name)
          Deletes the given file name.
 List deleteFiles(List names)
          Deletes a list of files.
 boolean fileExists(String name)
          Checks if the file exists for the given file name.
 long fileLength(String name)
          Returns the length of the file (in bytes).
 long fileModified(String name)
          Returns the last modified date of the file.
 IndexInput openInput(String name)
          Opens an IndexInput in order to read the file contents.
 void renameFile(String from, String to)
          Renames the file entry from "from" to "to".
 void touchFile(String name)
          Updates the last modified date of the file to the current time.
 

Method Detail

configure

void configure(JdbcDirectory jdbcDirectory)
Called after the entry is created (during the JdbcDirectory initialization process.


fileExists

boolean fileExists(String name)
                   throws IOException
Checks if the file exists for the given file name.

Parameters:
name - The name of the file
Returns:
true of the file exists, false if it does not.
Throws:
IOException

fileModified

long fileModified(String name)
                  throws IOException
Returns the last modified date of the file.

Parameters:
name - The name of the file
Returns:
The last modified date in millis.
Throws:
IOException

touchFile

void touchFile(String name)
               throws IOException
Updates the last modified date of the file to the current time.

Parameters:
name - The name of the file
Throws:
IOException

deleteFile

void deleteFile(String name)
                throws IOException
Deletes the given file name.

Parameters:
name - The name of the file to delete
Throws:
IOException

deleteFiles

List deleteFiles(List names)
                 throws IOException
Deletes a list of files. It must be verified by the caller that all files correlate to this file entry handler.

Parameters:
names - The list of file names to delete
Returns:
List of files that were not deleted (or null if all were deleted)
Throws:
IOException

renameFile

void renameFile(String from,
                String to)
                throws IOException
Renames the file entry from "from" to "to". The from entry is the one that maps to the actual file entry handler.

Parameters:
from - The name to rename from
to - The name to rename to
Throws:
IOException

fileLength

long fileLength(String name)
                throws IOException
Returns the length of the file (in bytes).

Parameters:
name - The name of the file
Returns:
The length of the file (in bytes)
Throws:
IOException

openInput

IndexInput openInput(String name)
                     throws IOException
Opens an IndexInput in order to read the file contents.

Parameters:
name - The name of the file
Returns:
An IndexInput in order to read the file contents.
Throws:
IOException

createOutput

IndexOutput createOutput(String name)
                         throws IOException
Creates an IndexOutput in order to write the file contents.

Parameters:
name - The name of the file
Returns:
An IndexOutput to write the file contents
Throws:
IOException

close

void close()
           throws IOException
Closes the file entry handler.

Throws:
IOException


Copyright (c) 2004-2008 The Compass Project.