From 35463f0a916da67afa96909112b0314e25d4432f Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Fri, 31 Aug 2007 17:55:26 +0000
Subject: [PATCH] Add support into the JE backend that can be used to store its compact schema encoding data in the database itself, and re-enable compact encoding by default in the configuration.  By storing the compact schema encoding data in the database (a separate copy for each backend), we have eliminated the potential problems in backup/restore and binary copy initialization if there are dependencies on an external schematokens.dat file.

---
 opendj-sdk/opends/src/server/org/opends/server/backends/jeb/JebFormat.java |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/JebFormat.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/JebFormat.java
index 934a70f..952cd32 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/JebFormat.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/JebFormat.java
@@ -27,6 +27,7 @@
 package org.opends.server.backends.jeb;
 
 
+import org.opends.server.api.CompressedSchema;
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.protocols.asn1.ASN1Element;
 import org.opends.server.protocols.asn1.ASN1Exception;
@@ -145,6 +146,7 @@
    * </pre>
    *
    * @param bytes A byte array containing the encoded database value.
+   * @param compressedSchema The compressed schema manager to use when decoding.
    * @return The decoded entry.
    * @throws ASN1Exception If the data is not in the expected ASN.1 encoding
    * format.
@@ -154,17 +156,19 @@
    * compressed data.
    * @throws DirectoryException If a Directory Server error occurs.
    */
-  static public Entry entryFromDatabase(byte[] bytes)
+  static public Entry entryFromDatabase(byte[] bytes,
+                                        CompressedSchema compressedSchema)
        throws DirectoryException,ASN1Exception,LDAPException,DataFormatException
   {
     byte[] uncompressedBytes = decodeDatabaseEntry(bytes);
-    return decodeDirectoryServerEntry(uncompressedBytes);
+    return decodeDirectoryServerEntry(uncompressedBytes, compressedSchema);
   }
 
   /**
    * Decode an entry from a ASN1 encoded DirectoryServerEntry.
    *
    * @param bytes A byte array containing the encoding of DirectoryServerEntry.
+   * @param compressedSchema The compressed schema manager to use when decoding.
    * @return The decoded entry.
    * @throws ASN1Exception If the data is not in the expected ASN.1 encoding
    * format.
@@ -172,10 +176,11 @@
    * format.
    * @throws DirectoryException If a Directory Server error occurs.
    */
-  static private Entry decodeDirectoryServerEntry(byte[] bytes)
+  static private Entry decodeDirectoryServerEntry(byte[] bytes,
+                            CompressedSchema compressedSchema)
        throws DirectoryException,ASN1Exception,LDAPException
   {
-    return Entry.decode(bytes);
+    return Entry.decode(bytes, compressedSchema);
   }
 
   /**
@@ -261,7 +266,7 @@
   static public byte[] entryToDatabase(Entry entry)
          throws DirectoryException
   {
-    return entryToDatabase(entry, new DataConfig(false, false));
+    return entryToDatabase(entry, new DataConfig(false, false, null));
   }
 
   /**

--
Gitblit v1.10.0