From 0418e30716942bc043d20cf1580391f44b2cb73e Mon Sep 17 00:00:00 2001
From: coulbeck <coulbeck@localhost>
Date: Tue, 25 Sep 2007 18:38:03 +0000
Subject: [PATCH] These changes use the new LDIF backend implementation so that the adminRoot backend is always present. The adminRoot LDIF backend is initially populated with the admin container entries, except for the cn=Servers container. To avoid breaking the setup and dsreplication tools, I have changed things so that the absence of the cn=Servers container entry implies that the server is not yet configured as an ADS server. I have commented out code that is no longer applicable.
---
opends/src/ads/org/opends/admin/ads/ADSContextHelper.java | 98 ++++++++++++++++++++++++-------------------------
1 files changed, 48 insertions(+), 50 deletions(-)
diff --git a/opends/src/ads/org/opends/admin/ads/ADSContextHelper.java b/opends/src/ads/org/opends/admin/ads/ADSContextHelper.java
index 608cdd2..3c931f8 100644
--- a/opends/src/ads/org/opends/admin/ads/ADSContextHelper.java
+++ b/opends/src/ads/org/opends/admin/ads/ADSContextHelper.java
@@ -28,7 +28,6 @@
package org.opends.admin.ads;
import java.util.SortedSet;
-import java.util.TreeSet;
import javax.naming.ldap.InitialLdapContext;
@@ -37,7 +36,6 @@
import org.opends.server.admin.client.ldap.JNDIDirContextAdaptor;
import org.opends.server.admin.client.ldap.LDAPManagementContext;
import org.opends.server.admin.std.client.*;
-import org.opends.server.admin.std.meta.*;
import org.opends.server.types.DN;
/**
@@ -122,52 +120,52 @@
* @throws ADSContextException if the administration suffix could not be
* created.
*/
- public void createAdministrationSuffix(InitialLdapContext ctx,
- String backendName, String dbDirectory, String importTempDirectory)
- throws ADSContextException
- {
- try
- {
- ManagementContext mCtx = LDAPManagementContext.createFromContext(
- JNDIDirContextAdaptor.adapt(ctx));
- RootCfgClient root = mCtx.getRootConfiguration();
- JEBackendCfgClient backend = null;
- try
- {
- backend = (JEBackendCfgClient)root.getBackend(backendName);
- }
- catch (ManagedObjectNotFoundException e)
- {
- }
- catch (ClassCastException cce)
- {
- throw new ADSContextException(
- ADSContextException.ErrorType.UNEXPECTED_ADS_BACKEND_TYPE, cce);
- }
- if (backend == null)
- {
- JEBackendCfgDefn provider = JEBackendCfgDefn.getInstance();
- backend = root.createBackend(provider, backendName, null);
- backend.setBackendEnabled(true);
- backend.setBackendId(backendName);
- backend.setBackendDirectory(dbDirectory);
- backend.setBackendImportTempDirectory(importTempDirectory);
- backend.setBackendWritabilityMode(
- BackendCfgDefn.BackendWritabilityMode.ENABLED);
- }
- SortedSet<DN> suffixes = backend.getBackendBaseDN();
- if (suffixes == null)
- {
- suffixes = new TreeSet<DN>();
- }
- suffixes.add(DN.decode(ADSContext.getAdministrationSuffixDN()));
- backend.setBackendBaseDN(suffixes);
- backend.commit();
- }
- catch (Throwable t)
- {
- throw new ADSContextException(
- ADSContextException.ErrorType.ERROR_UNEXPECTED, t);
- }
- }
+// public void createAdministrationSuffix(InitialLdapContext ctx,
+// String backendName, String dbDirectory, String importTempDirectory)
+// throws ADSContextException
+// {
+// try
+// {
+// ManagementContext mCtx = LDAPManagementContext.createFromContext(
+// JNDIDirContextAdaptor.adapt(ctx));
+// RootCfgClient root = mCtx.getRootConfiguration();
+// JEBackendCfgClient backend = null;
+// try
+// {
+// backend = (JEBackendCfgClient)root.getBackend(backendName);
+// }
+// catch (ManagedObjectNotFoundException e)
+// {
+// }
+// catch (ClassCastException cce)
+// {
+// throw new ADSContextException(
+// ADSContextException.ErrorType.UNEXPECTED_ADS_BACKEND_TYPE, cce);
+// }
+// if (backend == null)
+// {
+// JEBackendCfgDefn provider = JEBackendCfgDefn.getInstance();
+// backend = root.createBackend(provider, backendName, null);
+// backend.setBackendEnabled(true);
+// backend.setBackendId(backendName);
+// backend.setBackendDirectory(dbDirectory);
+// backend.setBackendImportTempDirectory(importTempDirectory);
+// backend.setBackendWritabilityMode(
+// BackendCfgDefn.BackendWritabilityMode.ENABLED);
+// }
+// SortedSet<DN> suffixes = backend.getBackendBaseDN();
+// if (suffixes == null)
+// {
+// suffixes = new TreeSet<DN>();
+// }
+// suffixes.add(DN.decode(ADSContext.getAdministrationSuffixDN()));
+// backend.setBackendBaseDN(suffixes);
+// backend.commit();
+// }
+// catch (Throwable t)
+// {
+// throw new ADSContextException(
+// ADSContextException.ErrorType.ERROR_UNEXPECTED, t);
+// }
+// }
}
--
Gitblit v1.10.0