org.opends.server.backends.jeb
Class DatabaseContainer

java.lang.Object
  extended by org.opends.server.backends.jeb.DatabaseContainer
Direct Known Subclasses:
DN2ID, DN2URI, ID2Entry, Index, State, VLVIndex

public abstract class DatabaseContainer
extends java.lang.Object

This class is a wrapper around the JE database object and provides basic read and write methods for entries.


Field Summary
protected  com.sleepycat.je.DatabaseConfig dbConfig
          The JE database configuration.
protected  EntryContainer entryContainer
          The database entryContainer.
protected  java.lang.String name
          The name of the database within the entryContainer.
 
Constructor Summary
protected DatabaseContainer(java.lang.String name, com.sleepycat.je.Environment env, EntryContainer entryContainer)
          Create a new DatabaseContainer object.
 
Method Summary
protected  com.sleepycat.je.OperationStatus delete(com.sleepycat.je.Transaction txn, com.sleepycat.je.DatabaseEntry key)
          Delete a record from a JE database, with optional debug logging.
 java.lang.String getName()
          Get the JE database name for this database container.
 long getRecordCount()
          Get the count of key/data pairs in the database in a JE database.
protected  com.sleepycat.je.OperationStatus insert(com.sleepycat.je.Transaction txn, com.sleepycat.je.DatabaseEntry key, com.sleepycat.je.DatabaseEntry data)
          Insert a record into a JE database, with optional debug logging.
 void open()
          Opens a JE database in this database container.
 com.sleepycat.je.Cursor openCursor(com.sleepycat.je.Transaction txn, com.sleepycat.je.CursorConfig cursorConfig)
          Open a JE cursor on the DN database.
 com.sleepycat.je.PreloadStats preload(com.sleepycat.je.PreloadConfig config)
          Preload the database into cache.
protected  com.sleepycat.je.OperationStatus put(com.sleepycat.je.Transaction txn, com.sleepycat.je.DatabaseEntry key, com.sleepycat.je.DatabaseEntry data)
          Replace or insert a record into a JE database, with optional debug logging.
protected  com.sleepycat.je.OperationStatus read(com.sleepycat.je.Transaction txn, com.sleepycat.je.DatabaseEntry key, com.sleepycat.je.DatabaseEntry data, com.sleepycat.je.LockMode lockMode)
          Read a record from a JE database, with optional debug logging.
 java.lang.String toString()
          Get a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

entryContainer

protected EntryContainer entryContainer
The database entryContainer.


dbConfig

protected com.sleepycat.je.DatabaseConfig dbConfig
The JE database configuration.


name

protected java.lang.String name
The name of the database within the entryContainer.

Constructor Detail

DatabaseContainer

protected DatabaseContainer(java.lang.String name,
                            com.sleepycat.je.Environment env,
                            EntryContainer entryContainer)
                     throws com.sleepycat.je.DatabaseException
Create a new DatabaseContainer object.

Parameters:
name - The name of the entry database.
env - The JE Environment.
entryContainer - The entryContainer of the entry database.
Throws:
com.sleepycat.je.DatabaseException - if a JE database error occurs.
Method Detail

open

public void open()
          throws com.sleepycat.je.DatabaseException
Opens a JE database in this database container. If the provided database configuration is transactional, a transaction will be created and used to perform the open.

Throws:
com.sleepycat.je.DatabaseException - if a JE database error occurs while openning the index.

put

protected com.sleepycat.je.OperationStatus put(com.sleepycat.je.Transaction txn,
                                               com.sleepycat.je.DatabaseEntry key,
                                               com.sleepycat.je.DatabaseEntry data)
                                        throws com.sleepycat.je.DatabaseException
Replace or insert a record into a JE database, with optional debug logging. This is a simple wrapper around the JE Database.put method.

Parameters:
txn - The JE transaction handle, or null if none.
key - The record key.
data - The record value.
Returns:
The operation status.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE operation.

read

protected com.sleepycat.je.OperationStatus read(com.sleepycat.je.Transaction txn,
                                                com.sleepycat.je.DatabaseEntry key,
                                                com.sleepycat.je.DatabaseEntry data,
                                                com.sleepycat.je.LockMode lockMode)
                                         throws com.sleepycat.je.DatabaseException
Read a record from a JE database, with optional debug logging. This is a simple wrapper around the JE Database.get method.

Parameters:
txn - The JE transaction handle, or null if none.
key - The key of the record to be read.
data - The record value returned as output. Its byte array does not need to be initialized by the caller.
lockMode - The JE locking mode to be used for the read.
Returns:
The operation status.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE operation.

insert

protected com.sleepycat.je.OperationStatus insert(com.sleepycat.je.Transaction txn,
                                                  com.sleepycat.je.DatabaseEntry key,
                                                  com.sleepycat.je.DatabaseEntry data)
                                           throws com.sleepycat.je.DatabaseException
Insert a record into a JE database, with optional debug logging. This is a simple wrapper around the JE Database.putNoOverwrite method.

Parameters:
txn - The JE transaction handle, or null if none.
key - The record key.
data - The record value.
Returns:
The operation status.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE operation.

delete

protected com.sleepycat.je.OperationStatus delete(com.sleepycat.je.Transaction txn,
                                                  com.sleepycat.je.DatabaseEntry key)
                                           throws com.sleepycat.je.DatabaseException
Delete a record from a JE database, with optional debug logging. This is a simple wrapper around the JE Database.delete method.

Parameters:
txn - The JE transaction handle, or null if none.
key - The key of the record to be read.
Returns:
The operation status.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE operation.

openCursor

public com.sleepycat.je.Cursor openCursor(com.sleepycat.je.Transaction txn,
                                          com.sleepycat.je.CursorConfig cursorConfig)
                                   throws com.sleepycat.je.DatabaseException
Open a JE cursor on the DN database.

Parameters:
txn - A JE database transaction to be used by the cursor, or null if none.
cursorConfig - The JE cursor configuration.
Returns:
A JE cursor.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs while attempting to open the cursor.

getRecordCount

public long getRecordCount()
                    throws com.sleepycat.je.DatabaseException
Get the count of key/data pairs in the database in a JE database. This is a simple wrapper around the JE Database.count method.

Returns:
The count of key/data pairs in the database.
Throws:
com.sleepycat.je.DatabaseException - If an error occurs in the JE operation.

toString

public java.lang.String toString()
Get a string representation of this object.

Overrides:
toString in class java.lang.Object
Returns:
return A string representation of this object.

getName

public java.lang.String getName()
Get the JE database name for this database container.

Returns:
JE database name for this database container.

preload

public com.sleepycat.je.PreloadStats preload(com.sleepycat.je.PreloadConfig config)
                                      throws com.sleepycat.je.DatabaseException
Preload the database into cache.

Parameters:
config - The preload configuration.
Returns:
Statistics about the preload process.
Throws:
com.sleepycat.je.DatabaseException - If an JE database error occurs during the preload.