org.apache.lucene.store.jdbc.index
Class RAMAndFileJdbcIndexOutput

java.lang.Object
  extended by org.apache.lucene.store.IndexOutput
      extended by org.apache.lucene.store.jdbc.index.RAMAndFileJdbcIndexOutput
All Implemented Interfaces:
JdbcIndexConfigurable
Direct Known Subclasses:
OracleRAMAndFileJdbcIndexOutput

public class RAMAndFileJdbcIndexOutput
extends IndexOutput
implements JdbcIndexConfigurable

An IndexOutput implementation that initially writes the data to a memory buffer. Once it exceeds the configured threshold (INDEX_OUTPUT_THRESHOLD_SETTING, will start working with a temporary file, releasing the previous buffer.

Author:
kimchy

Field Summary
static long DEFAULT_THRESHOLD
          The default value for the threshold (in bytes).
static String INDEX_OUTPUT_THRESHOLD_SETTING
          The threshold setting name.
 
Constructor Summary
RAMAndFileJdbcIndexOutput()
           
 
Method Summary
 void close()
           
 void configure(String name, JdbcDirectory jdbcDirectory, JdbcFileEntrySettings settings)
          Configures the newly created IndexInput or IndexOutput implementations.
protected  FileJdbcIndexOutput createFileJdbcIndexOutput()
           
protected  RAMJdbcIndexOutput createRamJdbcIndexOutput()
           
 void flush()
           
 long getFilePointer()
           
 long length()
           
 void seek(long pos)
           
 void writeByte(byte b)
           
 void writeBytes(byte[] b, int offset, int length)
           
 
Methods inherited from class org.apache.lucene.store.IndexOutput
copyBytes, setLength, writeBytes, writeChars, writeChars, writeInt, writeLong, writeString, writeVInt, writeVLong
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INDEX_OUTPUT_THRESHOLD_SETTING

public static final String INDEX_OUTPUT_THRESHOLD_SETTING
The threshold setting name. See JdbcFileEntrySettings.setLongSetting(String, long). Should be set in bytes.

See Also:
Constant Field Values

DEFAULT_THRESHOLD

public static final long DEFAULT_THRESHOLD
The default value for the threshold (in bytes). Currently 16K.

See Also:
Constant Field Values
Constructor Detail

RAMAndFileJdbcIndexOutput

public RAMAndFileJdbcIndexOutput()
Method Detail

configure

public void configure(String name,
                      JdbcDirectory jdbcDirectory,
                      JdbcFileEntrySettings settings)
               throws IOException
Description copied from interface: JdbcIndexConfigurable
Configures the newly created IndexInput or IndexOutput implementations.

Specified by:
configure in interface JdbcIndexConfigurable
Parameters:
name - The name of the file entry
jdbcDirectory - The jdbc directory instance
settings - The relevant file entry settings
Throws:
IOException

writeByte

public void writeByte(byte b)
               throws IOException
Specified by:
writeByte in class IndexOutput
Throws:
IOException

writeBytes

public void writeBytes(byte[] b,
                       int offset,
                       int length)
                throws IOException
Specified by:
writeBytes in class IndexOutput
Throws:
IOException

flush

public void flush()
           throws IOException
Specified by:
flush in class IndexOutput
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in class IndexOutput
Throws:
IOException

getFilePointer

public long getFilePointer()
Specified by:
getFilePointer in class IndexOutput

seek

public void seek(long pos)
          throws IOException
Specified by:
seek in class IndexOutput
Throws:
IOException

length

public long length()
            throws IOException
Specified by:
length in class IndexOutput
Throws:
IOException

createFileJdbcIndexOutput

protected FileJdbcIndexOutput createFileJdbcIndexOutput()

createRamJdbcIndexOutput

protected RAMJdbcIndexOutput createRamJdbcIndexOutput()


Copyright (c) 2004-2009 The Compass Project.