org.opends.server.replication.server
Class ReplicationDB

java.lang.Object
  extended by org.opends.server.replication.server.ReplicationDB

public class ReplicationDB
extends java.lang.Object

This class implements the interface between the underlying database and the dbHandler class. This is the only class that should have code using the BDB interfaces.


Nested Class Summary
 class ReplicationDB.ReplServerDBCursor
          This Class implements a cursor that can be used to browse a replicationServer database.
 
Constructor Summary
ReplicationDB(java.lang.Short serverId, DN baseDn, ReplicationServer replicationServer, ReplicationDbEnv dbenv)
          Creates a new database or open existing database that will be used to store and retrieve changes from an LDAP server.
 
Method Summary
 void addEntries(java.util.List<UpdateMessage> changes)
          add a list of changes to the underlying db.
 void clear()
          Clears this change DB from the changes it contains.
 ReplicationDB.ReplServerDBCursor openDeleteCursor()
          Create a cursor that can be used to delete some record from this ReplicationServer database.
 ReplicationDB.ReplServerDBCursor openReadCursor(ChangeNumber changeNumber)
          Create a cursor that can be used to search or iterate on this ReplicationServer DB.
 ChangeNumber readFirstChange()
          Read the first Change from the database.
 ChangeNumber readLastChange()
          Read the last Change from the database.
 void shutdown()
          Shutdown the database.
 java.lang.String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReplicationDB

public ReplicationDB(java.lang.Short serverId,
                     DN baseDn,
                     ReplicationServer replicationServer,
                     ReplicationDbEnv dbenv)
              throws com.sleepycat.je.DatabaseException
Creates a new database or open existing database that will be used to store and retrieve changes from an LDAP server.

Parameters:
serverId - The identifier of the LDAP server.
baseDn - The baseDn of the replication domain.
replicationServer - The ReplicationServer that needs to be shutdown.
dbenv - The Db environment to use to create the db.
Throws:
com.sleepycat.je.DatabaseException - If a database problem happened.
Method Detail

addEntries

public void addEntries(java.util.List<UpdateMessage> changes)
add a list of changes to the underlying db.

Parameters:
changes - The list of changes to add to the underlying db.

shutdown

public void shutdown()
Shutdown the database.


openReadCursor

public ReplicationDB.ReplServerDBCursor openReadCursor(ChangeNumber changeNumber)
                                                throws com.sleepycat.je.DatabaseException,
                                                       java.lang.Exception
Create a cursor that can be used to search or iterate on this ReplicationServer DB.

Parameters:
changeNumber - The ChangeNumber from which the cursor must start.
Returns:
The ReplServerDBCursor.
Throws:
com.sleepycat.je.DatabaseException - If a database error prevented the cursor creation.
java.lang.Exception - if the ReplServerDBCursor creation failed.

openDeleteCursor

public ReplicationDB.ReplServerDBCursor openDeleteCursor()
                                                  throws com.sleepycat.je.DatabaseException,
                                                         java.lang.Exception
Create a cursor that can be used to delete some record from this ReplicationServer database.

Returns:
The ReplServerDBCursor.
Throws:
com.sleepycat.je.DatabaseException - If a database error prevented the cursor creation.
java.lang.Exception - if the ReplServerDBCursor creation failed.

readFirstChange

public ChangeNumber readFirstChange()
Read the first Change from the database.

Returns:
the first ChangeNumber.

readLastChange

public ChangeNumber readLastChange()
Read the last Change from the database.

Returns:
the last ChangeNumber.

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

clear

public void clear()
           throws java.lang.Exception,
                  com.sleepycat.je.DatabaseException
Clears this change DB from the changes it contains.

Throws:
java.lang.Exception - Throws an exception it occurs.
com.sleepycat.je.DatabaseException - Throws a DatabaseException when it occurs.