From bba4ae2052d704110137110ec01c535ced0e1a0c Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 15 Dec 2014 10:28:58 +0000
Subject: [PATCH] OPENDJ-1602 (CR-5566) New pluggable storage based backend
---
opendj3-server-dev/src/server/org/opends/server/backends/pluggable/JECompressedSchema.java | 17 +++--------------
opendj3-server-dev/src/server/org/opends/server/backends/pluggable/EntryContainer.java | 8 ++++----
opendj3-server-dev/src/server/org/opends/server/backends/pluggable/BackendImpl.java | 20 ++++++++++----------
3 files changed, 17 insertions(+), 28 deletions(-)
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/BackendImpl.java b/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/BackendImpl.java
index 718e88d..7fd7911 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/BackendImpl.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/BackendImpl.java
@@ -80,7 +80,7 @@
{
private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
- interface Importer extends Closeable
+ public interface Importer extends Closeable
{
void createTree(TreeName name);
@@ -90,12 +90,12 @@
void close();
}
- interface ReadOperation<T>
+ public interface ReadOperation<T>
{
T run(ReadableStorage txn) throws Exception;
}
- interface ReadableStorage
+ public interface ReadableStorage
{
ByteString get(TreeName name, ByteSequence key);
@@ -106,7 +106,7 @@
// TODO: contains, etc.
}
- interface Cursor extends Closeable
+ public interface Cursor extends Closeable
{
boolean positionToKey(ByteSequence key);
@@ -126,7 +126,7 @@
public void close();
}
- interface Storage extends Closeable
+ public interface Storage extends Closeable
{
void initialize(Map<String, String> options) throws Exception;
@@ -138,7 +138,7 @@
<T> T read(ReadOperation<T> readTransaction) throws Exception;
- void update(WriteOperation updateTransaction) throws Exception;
+ void write(WriteOperation updateTransaction) throws Exception;
Cursor openCursor(TreeName name);
@@ -147,7 +147,7 @@
}
@SuppressWarnings("serial")
- static final class StorageRuntimeException extends RuntimeException
+ public static final class StorageRuntimeException extends RuntimeException
{
public StorageRuntimeException(final String message)
@@ -167,7 +167,7 @@
}
/** Assumes name components don't contain a '/'. */
- static final class TreeName
+ public static final class TreeName
{
public static TreeName of(final String... names)
{
@@ -257,12 +257,12 @@
}
}
- interface WriteOperation
+ public interface WriteOperation
{
void run(WriteableStorage txn) throws Exception;
}
- interface WriteableStorage extends ReadableStorage
+ public interface WriteableStorage extends ReadableStorage
{
void put(TreeName name, ByteSequence key, ByteSequence value);
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/EntryContainer.java b/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/EntryContainer.java
index a585eb3..2227cd3 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/EntryContainer.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/EntryContainer.java
@@ -1478,7 +1478,7 @@
{
try
{
- storage.update(new WriteOperation()
+ storage.write(new WriteOperation()
{
@Override
public void run(WriteableStorage txn) throws Exception
@@ -1641,7 +1641,7 @@
{
try
{
- storage.update(new WriteOperation()
+ storage.write(new WriteOperation()
{
@Override
public void run(WriteableStorage txn) throws Exception
@@ -2040,7 +2040,7 @@
{
try
{
- storage.update(new WriteOperation()
+ storage.write(new WriteOperation()
{
@Override
public void run(WriteableStorage txn) throws Exception
@@ -2175,7 +2175,7 @@
{
try
{
- storage.update(new WriteOperation()
+ storage.write(new WriteOperation()
{
@Override
public void run(WriteableStorage txn) throws Exception
diff --git a/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/JECompressedSchema.java b/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/JECompressedSchema.java
index 0292ce9..12d458d 100644
--- a/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/JECompressedSchema.java
+++ b/opendj3-server-dev/src/server/org/opends/server/backends/pluggable/JECompressedSchema.java
@@ -36,6 +36,7 @@
import org.forgerock.opendj.io.ASN1;
import org.forgerock.opendj.io.ASN1Reader;
import org.forgerock.opendj.io.ASN1Writer;
+import org.forgerock.opendj.ldap.ByteString;
import org.forgerock.opendj.ldap.ByteStringBuilder;
import org.opends.server.api.CompressedSchema;
import org.opends.server.backends.pluggable.BackendImpl.Cursor;
@@ -46,18 +47,6 @@
import org.opends.server.types.InitializationException;
import org.opends.server.util.StaticUtils;
-
-
-
-
-
-
-
-
-
-import static com.sleepycat.je.LockMode.*;
-import static com.sleepycat.je.OperationStatus.*;
-
import static org.opends.messages.JebMessages.*;
/**
@@ -281,8 +270,8 @@
private boolean putNoOverwrite(final Database database, final byte[] key, final ByteStringBuilder value)
throws DirectoryException
{
- final ByteString keyEntry = new ByteString(key);
- final ByteString valueEntry = new ByteString(value.getBackingArray(), 0, value.length());
+ final ByteString keyEntry = ByteString.wrap(key);
+ final ByteString valueEntry = ByteString.wrap(value.getBackingArray(), 0, value.length());
for (int i = 0; i < 3; i++)
{
try
--
Gitblit v1.10.0