From 35af51f9683f5ef8cec66baca7b89aa1e1cbc44e Mon Sep 17 00:00:00 2001
From: coulbeck <coulbeck@localhost>
Date: Fri, 11 May 2007 23:27:30 +0000
Subject: [PATCH] Issue 1532: Remove ConfigEntry from Backend API. (DS-1532)

---
 opends/src/server/org/opends/server/backends/RootDSEBackend.java |   46 +++++++++++++++++++++++-----------------------
 1 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/RootDSEBackend.java b/opends/src/server/org/opends/server/backends/RootDSEBackend.java
index 5b492c5..fff0b3b 100644
--- a/opends/src/server/org/opends/server/backends/RootDSEBackend.java
+++ b/opends/src/server/org/opends/server/backends/RootDSEBackend.java
@@ -47,7 +47,6 @@
 import org.opends.server.core.ModifyOperation;
 import org.opends.server.core.ModifyDNOperation;
 import org.opends.server.core.SearchOperation;
-import org.opends.server.core.BackendConfigManager;
 import org.opends.server.protocols.asn1.ASN1OctetString;
 import org.opends.server.types.Attribute;
 import org.opends.server.types.AttributeType;
@@ -71,6 +70,7 @@
 import org.opends.server.types.ResultCode;
 import org.opends.server.types.SearchFilter;
 import org.opends.server.util.LDIFWriter;
+import org.opends.server.util.Validator;
 
 import static org.opends.server.config.ConfigConstants.*;
 import static org.opends.server.loggers.debug.DebugLogger.debugCaught;
@@ -84,8 +84,8 @@
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
 import org.opends.server.admin.std.server.RootDSEBackendCfg;
-import org.opends.server.admin.std.meta.RootDSEBackendCfgDefn;
 import org.opends.server.admin.server.ConfigurationChangeListener;
+import org.opends.server.admin.Configuration;
 
 
 /**
@@ -156,13 +156,26 @@
   }
 
 
+  /**
+   * {@inheritDoc}
+   */
+  public void configureBackend(Configuration config) throws ConfigException
+  {
+    Validator.ensureNotNull(config);
+    Validator.ensureTrue(config instanceof RootDSEBackendCfg);
+    currentConfig = (RootDSEBackendCfg)config;
+    configEntryDN = config.dn();
+  }
 
   /**
    * {@inheritDoc}
    */
-  public void initializeBackend(ConfigEntry configEntry, DN[] baseDNs)
+  public void initializeBackend()
          throws ConfigException, InitializationException
   {
+    ConfigEntry configEntry =
+         DirectoryServer.getConfigEntry(configEntryDN);
+
     // Make sure that a configuration entry was provided.  If not, then we will
     // not be able to complete initialization.
     if (configEntry == null)
@@ -172,10 +185,6 @@
       throw new ConfigException(msgID, message);
     }
 
-    configEntryDN = configEntry.getDN();
-    RootDSEBackendCfg cfg = getRootDSEBackendCfg(configEntry);
-
-
     // Get the set of user-defined attributes for the configuration entry.  Any
     // attributes that we don't recognize will be included directly in the root
     // DSE.
@@ -215,7 +224,7 @@
     // backends defined in the server.
     try
     {
-      Set<DN> subDNs = cfg.getSubordinateBaseDN();
+      Set<DN> subDNs = currentConfig.getSubordinateBaseDN();
       if (subDNs.isEmpty())
       {
         // This is fine -- we'll just use the set of user-defined suffixes.
@@ -256,7 +265,7 @@
 
     // Determine whether all root DSE attributes should be treated as user
     // attributes.
-    showAllAttributes = cfg.isShowAllAttributes();
+    showAllAttributes = currentConfig.isShowAllAttributes();
 
 
     // Construct the set of "static" attributes that will always be present in
@@ -303,8 +312,7 @@
 
 
     // Register as a change listener.
-    currentConfig = cfg;
-    cfg.addChangeListener(this);
+    currentConfig.addChangeListener(this);
   }
 
 
@@ -1119,8 +1127,7 @@
   /**
    * {@inheritDoc}
    */
-  public void exportLDIF(ConfigEntry configEntry, DN[] baseDNs,
-                         LDIFExportConfig exportConfig)
+  public void exportLDIF(LDIFExportConfig exportConfig)
          throws DirectoryException
   {
     // Create the LDIF writer.
@@ -1197,8 +1204,7 @@
   /**
    * {@inheritDoc}
    */
-  public void importLDIF(ConfigEntry configEntry, DN[] baseDNs,
-                         LDIFImportConfig importConfig)
+  public void importLDIF(LDIFImportConfig importConfig)
          throws DirectoryException
   {
     // This backend does not support LDIF imports.
@@ -1256,7 +1262,7 @@
   /**
    * {@inheritDoc}
    */
-  public void createBackup(ConfigEntry configEntry, BackupConfig backupConfig)
+  public void createBackup(BackupConfig backupConfig)
          throws DirectoryException
   {
     // This backend does not provide a backup/restore mechanism.
@@ -1310,8 +1316,7 @@
   /**
    * {@inheritDoc}
    */
-  public void restoreBackup(ConfigEntry configEntry,
-                            RestoreConfig restoreConfig)
+  public void restoreBackup(RestoreConfig restoreConfig)
          throws DirectoryException
   {
     // This backend does not provide a backup/restore mechanism.
@@ -1542,10 +1547,5 @@
 
 
 
-  private static RootDSEBackendCfg getRootDSEBackendCfg(ConfigEntry configEntry)
-      throws ConfigException {
-    return BackendConfigManager.getConfiguration(
-         RootDSEBackendCfgDefn.getInstance(), configEntry);
-  }
 }
 

--
Gitblit v1.10.0