org.apache.lucene.store.jdbc.handler
Class AbstractFileEntryHandler

java.lang.Object
  extended by org.apache.lucene.store.jdbc.handler.AbstractFileEntryHandler
All Implemented Interfaces:
FileEntryHandler
Direct Known Subclasses:
ActualDeleteFileEntryHandler, MarkDeleteFileEntryHandler

public abstract class AbstractFileEntryHandler
extends Object
implements FileEntryHandler

A base file entry handler that supports most of the file entry base operations.

Supports the creation of configurable IndexInput and IndexOutput, base on the JdbcFileEntrySettings.INDEX_INPUT_TYPE_SETTING and JdbcFileEntrySettings.INDEX_OUTPUT_TYPE_SETTING.

Does not implement the deletion of files.

Author:
kimchy

Field Summary
protected  JdbcDirectory jdbcDirectory
           
protected  JdbcTemplate jdbcTemplate
           
protected  JdbcTable table
           
 
Constructor Summary
AbstractFileEntryHandler()
           
 
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.
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.lucene.store.jdbc.handler.FileEntryHandler
deleteFile, deleteFiles
 

Field Detail

jdbcDirectory

protected JdbcDirectory jdbcDirectory

table

protected JdbcTable table

jdbcTemplate

protected JdbcTemplate jdbcTemplate
Constructor Detail

AbstractFileEntryHandler

public AbstractFileEntryHandler()
Method Detail

configure

public void configure(JdbcDirectory jdbcDirectory)
Description copied from interface: FileEntryHandler
Called after the entry is created (during the JdbcDirectory initialization process.

Specified by:
configure in interface FileEntryHandler

fileExists

public boolean fileExists(String name)
                   throws IOException
Description copied from interface: FileEntryHandler
Checks if the file exists for the given file name.

Specified by:
fileExists in interface FileEntryHandler
Parameters:
name - The name of the file
Returns:
true of the file exists, false if it does not.
Throws:
IOException

fileModified

public long fileModified(String name)
                  throws IOException
Description copied from interface: FileEntryHandler
Returns the last modified date of the file.

Specified by:
fileModified in interface FileEntryHandler
Parameters:
name - The name of the file
Returns:
The last modified date in millis.
Throws:
IOException

touchFile

public void touchFile(String name)
               throws IOException
Description copied from interface: FileEntryHandler
Updates the last modified date of the file to the current time.

Specified by:
touchFile in interface FileEntryHandler
Parameters:
name - The name of the file
Throws:
IOException

renameFile

public void renameFile(String from,
                       String to)
                throws IOException
Description copied from interface: FileEntryHandler
Renames the file entry from "from" to "to". The from entry is the one that maps to the actual file entry handler.

Specified by:
renameFile in interface FileEntryHandler
Parameters:
from - The name to rename from
to - The name to rename to
Throws:
IOException

fileLength

public long fileLength(String name)
                throws IOException
Description copied from interface: FileEntryHandler
Returns the length of the file (in bytes).

Specified by:
fileLength in interface FileEntryHandler
Parameters:
name - The name of the file
Returns:
The length of the file (in bytes)
Throws:
IOException

openInput

public IndexInput openInput(String name)
                     throws IOException
Description copied from interface: FileEntryHandler
Opens an IndexInput in order to read the file contents.

Specified by:
openInput in interface FileEntryHandler
Parameters:
name - The name of the file
Returns:
An IndexInput in order to read the file contents.
Throws:
IOException

createOutput

public IndexOutput createOutput(String name)
                         throws IOException
Description copied from interface: FileEntryHandler
Creates an IndexOutput in order to write the file contents.

Specified by:
createOutput in interface FileEntryHandler
Parameters:
name - The name of the file
Returns:
An IndexOutput to write the file contents
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: FileEntryHandler
Closes the file entry handler.

Specified by:
close in interface FileEntryHandler
Throws:
IOException


Copyright (c) 2004-2009 The Compass Project.