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/ID2Entry.java |   33 +++++++++++++++++----------------
 1 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/jeb/ID2Entry.java b/opends/src/server/org/opends/server/backends/jeb/ID2Entry.java
index ce9d480..f2439af 100644
--- a/opends/src/server/org/opends/server/backends/jeb/ID2Entry.java
+++ b/opends/src/server/org/opends/server/backends/jeb/ID2Entry.java
@@ -49,9 +49,9 @@
 public class ID2Entry
 {
   /**
-   * The database container.
+   * The database entryContainer.
    */
-  private Container container;
+  private EntryContainer entryContainer;
 
   /**
    * The JE database configuration.
@@ -64,7 +64,7 @@
   private DataConfig dataConfig;
 
   /**
-   * The name of the database within the container.
+   * The name of the database within the entryContainer.
    */
   private String name;
 
@@ -76,17 +76,17 @@
 
   /**
    * Create a new ID2Entry object.
-   * @param container The container of the entry database.
+   * @param entryContainer The entryContainer of the entry database.
    * @param dbConfig The JE database configuration to be used to open the
    * underlying JE database.
    * @param dataConfig The desired compression and encryption options for data
    * stored in the entry database.
    * @param name The name of the entry database.
    */
-  public ID2Entry(Container container, DatabaseConfig dbConfig,
+  public ID2Entry(EntryContainer entryContainer, DatabaseConfig dbConfig,
                   DataConfig dataConfig, String name)
   {
-    this.container = container;
+    this.entryContainer = entryContainer;
     this.dbConfig = dbConfig;
     this.name = name;
     this.dataConfig = dataConfig;
@@ -104,7 +104,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.
@@ -116,7 +116,7 @@
     Database database = threadLocalDatabase.get();
     if (database == null)
     {
-      database = container.openDatabase(dbConfig, name);
+      database = entryContainer.openDatabase(dbConfig, name);
       threadLocalDatabase.set(database);
     }
     return database;
@@ -152,7 +152,7 @@
     DatabaseEntry data = entryData(entry);
 
     OperationStatus status;
-    status = Container.insert(getDatabase(), txn, key, data);
+    status = EntryContainer.insert(getDatabase(), txn, key, data);
     if (status != OperationStatus.SUCCESS)
     {
       return false;
@@ -176,7 +176,7 @@
     DatabaseEntry data = entryData(entry);
 
     OperationStatus status;
-    status = Container.put(getDatabase(), txn, key, data);
+    status = EntryContainer.put(getDatabase(), txn, key, data);
     if (status != OperationStatus.SUCCESS)
     {
       return false;
@@ -197,7 +197,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;
@@ -218,7 +218,7 @@
   {
     DatabaseEntry key = id.getDatabaseEntry();
 
-    OperationStatus status = Container.delete(getDatabase(), txn, key);
+    OperationStatus status = EntryContainer.delete(getDatabase(), txn, key);
     if (status != OperationStatus.SUCCESS)
     {
       return false;
@@ -242,7 +242,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)
     {
@@ -311,7 +312,7 @@
     key = id.getDatabaseEntry();
 
     // Read the current count, if any.
-    OperationStatus status = Container.read(getDatabase(), txn,
+    OperationStatus status = EntryContainer.read(getDatabase(), txn,
                                             key, data, LockMode.DEFAULT);
 
     // Parse the current count.
@@ -343,7 +344,7 @@
     key = id.getDatabaseEntry();
 
     // Read the current count, if any.
-    OperationStatus status = Container.read(getDatabase(), txn,
+    OperationStatus status = EntryContainer.read(getDatabase(), txn,
                                             key, data, LockMode.RMW);
 
     // Parse the current count.
@@ -359,6 +360,6 @@
     // Write it.
     byte[] bytes = JebFormat.entryIDToDatabase(count);
     data.setData(bytes);
-    Container.put(getDatabase(), txn, key, data);
+    EntryContainer.put(getDatabase(), txn, key, data);
   }
 }

--
Gitblit v1.10.0