From 83dd61651cb5d73c1a15dfcb7d217c0f272722d2 Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Tue, 03 Oct 2006 19:09:36 +0000
Subject: [PATCH] Refactoring of the JEB backend to simplify the container and entryContainer abstraction. This also elimates exposing the JE interface to backendImpl by creating a new RootContainer class. It provides a higher-level interface to access raw data in JE from anywhere in the server (ie. unit tests).
---
opends/src/server/org/opends/server/backends/jeb/DN2ID.java | 30 ++++++++++++++++--------------
1 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/DN2ID.java b/opends/src/server/org/opends/server/backends/jeb/DN2ID.java
index c238ba9..929277d 100644
--- a/opends/src/server/org/opends/server/backends/jeb/DN2ID.java
+++ b/opends/src/server/org/opends/server/backends/jeb/DN2ID.java
@@ -49,9 +49,9 @@
public class DN2ID
{
/**
- * The database container.
+ * The database entryContainer.
*/
- private Container container;
+ private EntryContainer entryContainer;
/**
* The JE database configuration.
@@ -59,7 +59,7 @@
private DatabaseConfig dbConfig;
/**
- * The name of the database within the container.
+ * The name of the database within the entryContainer.
*/
private String name;
@@ -70,16 +70,17 @@
new ThreadLocal<Database>();
/**
- * Create a DN2ID instance for the DN database in a given container.
+ * Create a DN2ID instance for the DN database in a given entryContainer.
*
- * @param container The container of the DN database.
+ * @param entryContainer The entryContainer of the DN database.
* @param dbConfig The JE database configuration which will be used to
* open the database.
* @param name The name of the DN database ("dn2id").
*/
- public DN2ID(Container container, DatabaseConfig dbConfig, String name)
+ public DN2ID(EntryContainer entryContainer, DatabaseConfig dbConfig,
+ String name)
{
- this.container = container;
+ this.entryContainer = entryContainer;
this.dbConfig = dbConfig;
this.name = name;
}
@@ -96,7 +97,7 @@
/**
* Get a handle to the database. It returns a per-thread handle to avoid
- * any thread contention on the database handle. The container is
+ * any thread contention on the database handle. The entryContainer is
* responsible for closing all handles.
*
* @return A database handle.
@@ -108,7 +109,7 @@
Database database = threadLocalDatabase.get();
if (database == null)
{
- database = container.openDatabase(dbConfig, name);
+ database = entryContainer.openDatabase(dbConfig, name);
threadLocalDatabase.set(database);
}
return database;
@@ -144,7 +145,7 @@
OperationStatus status;
- status = Container.insert(getDatabase(), txn, key, data);
+ status = EntryContainer.insert(getDatabase(), txn, key, data);
if (status != OperationStatus.SUCCESS)
{
return false;
@@ -171,7 +172,7 @@
DatabaseEntry data = id.getDatabaseEntry();
OperationStatus status;
- status = Container.put(getDatabase(), txn, key, data);
+ status = EntryContainer.put(getDatabase(), txn, key, data);
if (status != OperationStatus.SUCCESS)
{
return false;
@@ -194,7 +195,7 @@
throws DatabaseException
{
OperationStatus status;
- status = Container.put(getDatabase(), txn, key, data);
+ status = EntryContainer.put(getDatabase(), txn, key, data);
if (status != OperationStatus.SUCCESS)
{
return false;
@@ -216,7 +217,7 @@
{
DatabaseEntry key = DNdata(dn);
- OperationStatus status = Container.delete(getDatabase(), txn, key);
+ OperationStatus status = EntryContainer.delete(getDatabase(), txn, key);
if (status != OperationStatus.SUCCESS)
{
return false;
@@ -239,7 +240,8 @@
DatabaseEntry data = new DatabaseEntry();
OperationStatus status;
- status = Container.read(getDatabase(), txn, key, data, LockMode.DEFAULT);
+ status = EntryContainer.read(getDatabase(), txn, key, data,
+ LockMode.DEFAULT);
if (status != OperationStatus.SUCCESS)
{
return null;
--
Gitblit v1.10.0