From 8395e95048f9670f0889eb1b0518d1595f01dd07 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Thu, 07 Jun 2007 20:07:26 +0000
Subject: [PATCH] Provide a new mechanism for encoding entries. This method adds an extra element that includes flags that indicate how the entry was encoded. The flags currently defined include:
---
opends/src/server/org/opends/server/backends/jeb/JebFormat.java | 20 +++++++++++++++++++-
1 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/opends/src/server/org/opends/server/backends/jeb/JebFormat.java b/opends/src/server/org/opends/server/backends/jeb/JebFormat.java
index 2100d37..6c950fb 100644
--- a/opends/src/server/org/opends/server/backends/jeb/JebFormat.java
+++ b/opends/src/server/org/opends/server/backends/jeb/JebFormat.java
@@ -36,6 +36,7 @@
import org.opends.server.types.CryptoManager;
import org.opends.server.types.DirectoryException;
import org.opends.server.types.Entry;
+import org.opends.server.types.EntryEncodeConfig;
import org.opends.server.types.LDAPException;
import static org.opends.server.loggers.debug.DebugLogger.*;
@@ -72,6 +73,11 @@
public static final byte TAG_DIRECTORY_SERVER_ENTRY = 0x61;
/**
+ * The configuration to use when encoding entries in the database.
+ */
+ private static EntryEncodeConfig encodeConfig = new EntryEncodeConfig();
+
+ /**
* Decode a DatabaseEntry. The encoded bytes may be compressed and/or
* encrypted.
*
@@ -236,8 +242,12 @@
* @param entry The entry to encode.
* @param dataConfig Compression and cryptographic options.
* @return A byte array containing the encoded database value.
+ *
+ * @throws DirectoryException If a problem occurs while attempting to encode
+ * the entry.
*/
static public byte[] entryToDatabase(Entry entry, DataConfig dataConfig)
+ throws DirectoryException
{
byte[] uncompressedBytes = encodeDirectoryServerEntry(entry);
return encodeDatabaseEntry(uncompressedBytes, dataConfig);
@@ -248,8 +258,12 @@
*
* @param entry The entry to encode.
* @return A byte array containing the encoded database value.
+ *
+ * @throws DirectoryException If a problem occurs while attempting to encode
+ * the entry.
*/
static public byte[] entryToDatabase(Entry entry)
+ throws DirectoryException
{
return entryToDatabase(entry, new DataConfig());
}
@@ -259,10 +273,14 @@
*
* @param entry The entry to encode.
* @return A byte array containing the encoded DirectoryServerEntry.
+ *
+ * @throws DirectoryException If a problem occurs while attempting to encode
+ * the entry.
*/
static private byte[] encodeDirectoryServerEntry(Entry entry)
+ throws DirectoryException
{
- return entry.encode();
+ return entry.encode(encodeConfig);
}
/**
--
Gitblit v1.10.0