From 0bd57577bb85119b2b4495c5ef525ba189d8d17c Mon Sep 17 00:00:00 2001
From: Matthew Swift <matthew.swift@forgerock.com>
Date: Wed, 04 Mar 2015 23:14:55 +0000
Subject: [PATCH] OPENDJ-1848: in-line and remove various storage related access methods from DatabaseContainer.

---
 opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ID2Entry.java |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ID2Entry.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ID2Entry.java
index 97b78f1..617e913 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ID2Entry.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/ID2Entry.java
@@ -333,7 +333,7 @@
     try
     {
       ByteString value = codec.encodeInternal(entry, dataConfig);
-      return insert(txn, key, value);
+      return txn.putIfAbsent(getName(), key, value);
     }
     finally
     {
@@ -359,7 +359,7 @@
     try
     {
       ByteString value = codec.encodeInternal(entry, dataConfig);
-      put(txn, key, value);
+      txn.create(getName(), key, value);
     }
     finally
     {
@@ -377,7 +377,7 @@
    */
   boolean remove(WriteableStorage txn, EntryID id) throws StorageRuntimeException
   {
-    return delete(txn, id.toByteString());
+    return txn.delete(getName(), id.toByteString());
   }
 
   /**
@@ -385,15 +385,23 @@
    *
    * @param txn The database transaction or null if none.
    * @param id The desired entry ID which forms the key.
-   * @param isRMW whether the read operation is part of a larger read-modify-write operation
    * @return The requested entry, or null if there is no such record.
    * @throws DirectoryException If a problem occurs while getting the entry.
    * @throws StorageRuntimeException If an error occurs in the JE database.
    */
-  public Entry get(ReadableStorage txn, EntryID id, boolean isRMW)
+  public Entry get(ReadableStorage txn, EntryID id)
        throws DirectoryException, StorageRuntimeException
   {
-    ByteString value = read(txn, id.toByteString(), isRMW);
+    return get0(id, txn.read(getName(), id.toByteString()));
+  }
+
+  public Entry getRMW(ReadableStorage txn, EntryID id) throws DirectoryException, StorageRuntimeException
+  {
+    return get0(id, txn.getRMW(getName(), id.toByteString()));
+  }
+
+  private Entry get0(EntryID id, ByteString value) throws DirectoryException
+  {
     if (value == null)
     {
       return null;

--
Gitblit v1.10.0