From 7886f35b46cac515f73de8c6af33b8d8df3e2a3b Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Fri, 08 Jun 2007 12:00:22 +0000
Subject: [PATCH] Commit quite a lot of bug fixes to the ADS.
---
opends/src/ads/org/opends/admin/ads/ADSContextHelper.java | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/opends/src/ads/org/opends/admin/ads/ADSContextHelper.java b/opends/src/ads/org/opends/admin/ads/ADSContextHelper.java
index b239f6f..608cdd2 100644
--- a/opends/src/ads/org/opends/admin/ads/ADSContextHelper.java
+++ b/opends/src/ads/org/opends/admin/ads/ADSContextHelper.java
@@ -115,22 +115,45 @@
* @param ctx the DirContext to be used.
* @param backendName the name of the backend where the administration
* suffix is stored.
+ * @param dbDirectory the path of the backend where the administration
+ * suffix is stored (will be used if the backend must be created).
+ * @param importTempDirectory the path of the backend where the temporary
+ * files of import are stored (will be used if the backend must be created).
* @throws ADSContextException if the administration suffix could not be
* created.
*/
public void createAdministrationSuffix(InitialLdapContext ctx,
- String backendName) throws ADSContextException
+ String backendName, String dbDirectory, String importTempDirectory)
+ throws ADSContextException
{
try
{
ManagementContext mCtx = LDAPManagementContext.createFromContext(
JNDIDirContextAdaptor.adapt(ctx));
RootCfgClient root = mCtx.getRootConfiguration();
- BackendCfgClient backend = root.getBackend(backendName);
+ 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)
{
- BackendCfgDefn provider = BackendCfgDefn.getInstance();
+ 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)
--
Gitblit v1.10.0