org.h2.store
Interface DataHandler

All Known Implementing Classes:
Database, Recover, RunScriptCommand, ScriptCommand, SessionRemote, TestDataPage, TestFile, TestValueHashMap, TestValueMemory

public interface DataHandler

A data handler contains a number of callback methods. The most important implementing class is a database.


Method Summary
 void checkPowerOff()
          Check if the simulated power failure occurred.
 void checkWritingAllowed()
          Check if writing is allowed.
 java.lang.String getDatabasePath()
          Get the database path.
 java.lang.String getLobCompressionAlgorithm(int type)
          Get the compression algorithm used for large objects.
 java.sql.Connection getLobConnection()
          Get a database connection to be used for LOB access.
 SmallLRUCache<java.lang.String,java.lang.String[]> getLobFileListCache()
          Get the lob file list cache if it is used.
 LobStorage getLobStorage()
          Get the lob storage mechanism to use.
 java.lang.Object getLobSyncObject()
          Get the synchronization object for lob operations.
 int getMaxLengthInplaceLob()
          Get the maximum length of a in-place large object
 TempFileDeleter getTempFileDeleter()
          Get the temp file deleter mechanism.
 FileStore openFile(java.lang.String name, java.lang.String mode, boolean mustExist)
          Open a file at the given location.
 int readLob(long lobId, long offset, byte[] buff, int off, int length)
          Read from a lob.
 

Method Detail

getDatabasePath

java.lang.String getDatabasePath()
Get the database path.

Returns:
the database path

openFile

FileStore openFile(java.lang.String name,
                   java.lang.String mode,
                   boolean mustExist)
Open a file at the given location.

Parameters:
name - the file name
mode - the mode
mustExist - whether the file must already exist
Returns:
the file

checkPowerOff

void checkPowerOff()
                   throws DbException
Check if the simulated power failure occurred. This call will decrement the countdown.

Throws:
DbException - if the simulated power failure occurred

checkWritingAllowed

void checkWritingAllowed()
                         throws DbException
Check if writing is allowed.

Throws:
DbException - if it is not allowed

getMaxLengthInplaceLob

int getMaxLengthInplaceLob()
Get the maximum length of a in-place large object

Returns:
the maximum size

getLobCompressionAlgorithm

java.lang.String getLobCompressionAlgorithm(int type)
Get the compression algorithm used for large objects.

Parameters:
type - the data type (CLOB or BLOB)
Returns:
the compression algorithm, or null

getTempFileDeleter

TempFileDeleter getTempFileDeleter()
Get the temp file deleter mechanism.

Returns:
the temp file deleter

getLobSyncObject

java.lang.Object getLobSyncObject()
Get the synchronization object for lob operations.

Returns:
the synchronization object

getLobFileListCache

SmallLRUCache<java.lang.String,java.lang.String[]> getLobFileListCache()
Get the lob file list cache if it is used.

Returns:
the cache or null

getLobStorage

LobStorage getLobStorage()
Get the lob storage mechanism to use.

Returns:
the lob storage mechanism

getLobConnection

java.sql.Connection getLobConnection()
Get a database connection to be used for LOB access.

Returns:
the connection or null

readLob

int readLob(long lobId,
            long offset,
            byte[] buff,
            int off,
            int length)
Read from a lob.

Parameters:
lobId - the lob
offset - the offset within the lob
buff - the target buffer
off - the offset within the target buffer
length - the number of bytes to read
Returns:
the number of bytes read