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/DataConfig.java |   40 ++++++++++++++++++++++++++++++++++------
 1 files changed, 34 insertions(+), 6 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/DataConfig.java b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/DataConfig.java
index e1eda2f..aca9401 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/DataConfig.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/backends/jeb/DataConfig.java
@@ -28,6 +28,8 @@
 
 import org.opends.server.types.EntryEncodeConfig;
 
+import static org.opends.server.util.Validator.*;
+
 /**
  * Configuration class to indicate desired compression and cryptographic options
  * for the data stored in the database.
@@ -50,12 +52,25 @@
    * @param compressed true if data should be compressed, false if not.
    * @param compactEncoding true if data should be encoded in compact form,
    * false if not.
+   * @param compressedSchema the compressed schema manager to use.  It must not
+   * be {@code null} if compactEncoding is {@code true}.
    */
-  public DataConfig(boolean compressed, boolean compactEncoding)
+  public DataConfig(boolean compressed, boolean compactEncoding,
+                    JECompressedSchema compressedSchema)
   {
     this.compressed = compressed;
-    this.encodeConfig = new EntryEncodeConfig(false, compactEncoding,
-                                              compactEncoding);
+
+    if (compressedSchema == null)
+    {
+      ensureTrue(! compactEncoding);
+      this.encodeConfig = new EntryEncodeConfig(false, compactEncoding, false);
+    }
+    else
+    {
+      this.encodeConfig =
+           new EntryEncodeConfig(false, compactEncoding, compactEncoding,
+                                 compressedSchema);
+    }
   }
 
   /**
@@ -93,11 +108,24 @@
    * writing to the database.
    * @param compactEncoding true if data should be encoded in compact form,
    * false if not.
+   * @param compressedSchema The compressed schema manager to use.  It must not
+   * be {@code null} if compactEncoding is {@code true}.
    */
-  public void setCompactEncoding(boolean compactEncoding)
+  public void setCompactEncoding(boolean compactEncoding,
+                                 JECompressedSchema compressedSchema)
   {
-    this.encodeConfig = new EntryEncodeConfig(false, compactEncoding,
-                                              compactEncoding);
+    if (compressedSchema == null)
+    {
+      ensureTrue(! compactEncoding);
+      this.encodeConfig = new EntryEncodeConfig(false, compactEncoding,
+                                                compactEncoding);
+    }
+    else
+    {
+      this.encodeConfig = new EntryEncodeConfig(false, compactEncoding,
+                                                compactEncoding,
+                                                compressedSchema);
+    }
   }
 
   /**

--
Gitblit v1.10.0