From 5be072c20e46f0921bb00401ff26d0defb3e8991 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 05 Dec 2006 21:41:50 +0000
Subject: [PATCH] Update the base DN registration process to address a number of issues:

---
 opends/src/server/org/opends/server/backends/SchemaBackend.java |   73 ++++++++++++++----------------------
 1 files changed, 28 insertions(+), 45 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/SchemaBackend.java b/opends/src/server/org/opends/server/backends/SchemaBackend.java
index ac62d24..1bf567d 100644
--- a/opends/src/server/org/opends/server/backends/SchemaBackend.java
+++ b/opends/src/server/org/opends/server/backends/SchemaBackend.java
@@ -251,11 +251,22 @@
     // Register each of the suffixes with the Directory Server.  Also, register
     // the first one as the schema base.
     this.baseDNs = baseDNs;
-    DirectoryServer.registerPrivateSuffix(baseDNs[0], this);
     DirectoryServer.setSchemaDN(baseDNs[0]);
-    for (int i=1; i < baseDNs.length; i++)
+    for (int i=0; i < baseDNs.length; i++)
     {
-      DirectoryServer.registerPrivateSuffix(baseDNs[i], this);
+      try
+      {
+        DirectoryServer.registerBaseDN(baseDNs[i], this, true, false);
+      }
+      catch (Exception e)
+      {
+        assert debugException(CLASS_NAME, "initializeBackend", e);
+
+        msgID = MSGID_BACKEND_CANNOT_REGISTER_BASEDN;
+        String message = getMessage(msgID, baseDNs[i].toString(),
+                                    stackTraceToSingleLineString(e));
+        throw new InitializationException(msgID, message, e);
+      }
     }
 
 
@@ -306,6 +317,18 @@
     assert debugEnter(CLASS_NAME, "finalizeBackend");
 
     DirectoryServer.deregisterConfigurableComponent(this);
+
+    for (DN baseDN : baseDNs)
+    {
+      try
+      {
+        DirectoryServer.deregisterBaseDN(baseDN, false);
+      }
+      catch (Exception e)
+      {
+        assert debugException(CLASS_NAME, "finalizeBackend", e);
+      }
+    }
   }
 
 
@@ -801,26 +824,6 @@
 
 
   /**
-   * Indicates whether this backend supports the specified control.
-   *
-   * @param  controlOID  The OID of the control for which to make the
-   *                     determination.
-   *
-   * @return  <CODE>true</CODE> if this backend does support the requested
-   *          control, or <CODE>false</CODE>
-   */
-  public boolean supportsControl(String controlOID)
-  {
-    assert debugEnter(CLASS_NAME, "supportsControl",
-                      String.valueOf(controlOID));
-
-    // This backend does not provide any special control support.
-    return false;
-  }
-
-
-
-  /**
    * Retrieves the OIDs of the features that may be supported by this backend.
    *
    * @return  The OIDs of the features that may be supported by this backend.
@@ -835,26 +838,6 @@
 
 
   /**
-   * Indicates whether this backend supports the specified feature.
-   *
-   * @param  featureOID  The OID of the feature for which to make the
-   *                     determination.
-   *
-   * @return  <CODE>true</CODE> if this backend does support the requested
-   *          feature, or <CODE>false</CODE>
-   */
-  public boolean supportsFeature(String featureOID)
-  {
-    assert debugEnter(CLASS_NAME, "supportsFeature",
-                      String.valueOf(featureOID));
-
-    // This backend does not provide any special feature support.
-    return false;
-  }
-
-
-
-  /**
    * Indicates whether this backend provides a mechanism to export the data it
    * contains to an LDIF file.
    *
@@ -2227,7 +2210,7 @@
       {
         try
         {
-          DirectoryServer.deregisterSuffix(dn);
+          DirectoryServer.deregisterBaseDN(dn, false);
           if (detailedResults)
           {
             msgID = MSGID_SCHEMA_DEREGISTERED_BASE_DN;
@@ -2250,7 +2233,7 @@
       {
         try
         {
-          DirectoryServer.registerPrivateSuffix(dn, this);
+          DirectoryServer.registerBaseDN(dn, this, true, false);
           if (detailedResults)
           {
             msgID = MSGID_SCHEMA_REGISTERED_BASE_DN;

--
Gitblit v1.10.0