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/core/BackendConfigManager.java | 68 ++++------------------------------
1 files changed, 8 insertions(+), 60 deletions(-)
diff --git a/opends/src/server/org/opends/server/core/BackendConfigManager.java b/opends/src/server/org/opends/server/core/BackendConfigManager.java
index 7acd8b9..c7f6dab 100644
--- a/opends/src/server/org/opends/server/core/BackendConfigManager.java
+++ b/opends/src/server/org/opends/server/core/BackendConfigManager.java
@@ -53,16 +53,9 @@
import org.opends.server.admin.server.ConfigurationAddListener;
import org.opends.server.admin.server.ConfigurationDeleteListener;
import org.opends.server.admin.server.ServerManagementContext;
-import org.opends.server.admin.server.ServerManagedObject;
-import org.opends.server.admin.server.ConfigExceptionFactory;
-import org.opends.server.admin.server.ServerManagedObjectDecodingException;
import org.opends.server.admin.std.server.BackendCfg;
import org.opends.server.admin.std.server.RootCfg;
import org.opends.server.admin.std.meta.BackendCfgDefn;
-import org.opends.server.admin.Configuration;
-import org.opends.server.admin.AbstractManagedObjectDefinition;
-import org.opends.server.admin.ManagedObjectPath;
-import org.opends.server.admin.DefinitionDecodingException;
/**
@@ -285,12 +278,9 @@
// Perform the necessary initialization for the backend entry.
- DN[] baseDNs = new DN[backendCfg.getBackendBaseDN().size()];
- baseDNs = backendCfg.getBackendBaseDN().toArray(baseDNs);
try
{
- backend.initializeBackend(
- DirectoryServer.getConfigEntry(backendCfg.dn()), baseDNs);
+ initializeBackend(backend, backendCfg);
}
catch (Exception e)
{
@@ -769,8 +759,7 @@
try
{
- backend.initializeBackend(
- DirectoryServer.getConfigEntry(cfg.dn()), baseDNs);
+ initializeBackend(backend, cfg);
}
catch (Exception e)
{
@@ -1146,8 +1135,7 @@
// Perform the necessary initialization for the backend entry.
try
{
- backend.initializeBackend(
- DirectoryServer.getConfigEntry(cfg.dn()), baseDNs);
+ initializeBackend(backend, cfg);
}
catch (Exception e)
{
@@ -1364,53 +1352,13 @@
}
}
- /**
- * Gets the configuration corresponding to a config entry.
- *
- * @param <S>
- * The type of server configuration.
- * @param definition
- * The required definition of the required managed object.
- * @param configEntry
- * A configuration entry.
- * @return Returns the server-side configuration.
- * @throws ConfigException
- * If the entry could not be decoded.
- */
- public static <S extends Configuration> S getConfiguration(
- AbstractManagedObjectDefinition<?, S> definition, ConfigEntry configEntry)
- throws ConfigException {
-
- try {
- ServerManagedObject<? extends S> mo = ServerManagedObject
- .decode(ManagedObjectPath.emptyPath(), definition,
- configEntry);
- return mo.getConfiguration();
- } catch (DefinitionDecodingException e) {
- throw ConfigExceptionFactory.getInstance()
- .createDecodingExceptionAdaptor(configEntry.getDN(), e);
- } catch (ServerManagedObjectDecodingException e) {
- throw ConfigExceptionFactory.getInstance()
- .createDecodingExceptionAdaptor(e);
- }
- }
-
-
-
- /**
- * Gets the backend configuration corresponding to a backend config entry.
- *
- * @param configEntry A backend config entry.
- * @return Returns the backend configuration.
- * @throws ConfigException If the config entry could not be decoded.
- */
- public static BackendCfg getBackendCfg(ConfigEntry configEntry)
- throws ConfigException
+ @SuppressWarnings("unchecked")
+ private static void initializeBackend(Backend backend, BackendCfg cfg)
+ throws ConfigException, InitializationException
{
- return getConfiguration(BackendCfgDefn.getInstance(), configEntry);
+ backend.configureBackend(cfg);
+ backend.initializeBackend();
}
-
-
}
--
Gitblit v1.10.0