org.opends.server.replication.server
Class ReplicationDbEnv

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

public class ReplicationDbEnv
extends java.lang.Object

This class is used to represent a Db environement that can be used to create ReplicationDB.


Constructor Summary
ReplicationDbEnv(java.lang.String path, ReplicationServer replicationServer)
          Initialize this class.
 
Method Summary
 com.sleepycat.je.Transaction beginTransaction()
          Creates a new transaction.
 void clearDb(java.lang.String databaseName)
          Clears the database.
 void clearGenerationId(DN baseDn)
          Clears the provided generationId associated to the provided baseDn from the state Db.
 void clearServerId(DN baseDn, java.lang.Short serverId)
          Clears the provided serverId associated to the provided baseDn from the state Db.
 com.sleepycat.je.Database getOrAddDb(java.lang.Short serverId, DN baseDn, java.lang.Long generationId)
          Finds or creates the database used to store changes from the server with the given serverId and the given baseDn.
 void shutdown()
          Shutdown the Db environment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicationDbEnv

public ReplicationDbEnv(java.lang.String path,
                        ReplicationServer replicationServer)
                 throws com.sleepycat.je.DatabaseException,
                        ReplicationDBException
Initialize this class. Creates Db environment that will be used to create databases. It also reads the currently known databases from the "changelogstate" database.

Parameters:
path - Path where the backing files must be created.
replicationServer - the ReplicationServer that creates this ReplicationDbEnv.
Throws:
com.sleepycat.je.DatabaseException - If a DatabaseException occurred that prevented the initialization to happen.
ReplicationDBException - If a replicationServer internal error caused a failure of the replicationServer processing.
Method Detail

getOrAddDb

public com.sleepycat.je.Database getOrAddDb(java.lang.Short serverId,
                                            DN baseDn,
                                            java.lang.Long generationId)
                                     throws com.sleepycat.je.DatabaseException
Finds or creates the database used to store changes from the server with the given serverId and the given baseDn.

Parameters:
serverId - The server id that identifies the server.
baseDn - The baseDn that identifies the domain.
generationId - The generationId associated to this domain.
Returns:
the Database.
Throws:
com.sleepycat.je.DatabaseException - in case of underlying Exception.

beginTransaction

public com.sleepycat.je.Transaction beginTransaction()
                                              throws com.sleepycat.je.DatabaseException
Creates a new transaction.

Returns:
the transaction.
Throws:
com.sleepycat.je.DatabaseException - in case of underlying database Exception.

shutdown

public void shutdown()
Shutdown the Db environment.


clearGenerationId

public void clearGenerationId(DN baseDn)
Clears the provided generationId associated to the provided baseDn from the state Db.

Parameters:
baseDn - The baseDn for which the generationID must be cleared.

clearServerId

public void clearServerId(DN baseDn,
                          java.lang.Short serverId)
Clears the provided serverId associated to the provided baseDn from the state Db.

Parameters:
baseDn - The baseDn for which the generationID must be cleared.
serverId - The serverId to remove from the Db.

clearDb

public final void clearDb(java.lang.String databaseName)
Clears the database.

Parameters:
databaseName - The name of the database to clear.