From c30a14be35ba387e61b960740f6afc1b9774bb3d Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 04 Apr 2016 13:38:34 +0000
Subject: [PATCH] Add ConnectionWrapper to replace all uses of InitialLdapContext
---
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java | 22 +++++++++-------------
1 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java
index 92d206c..a839973 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/IndexPanel.java
@@ -32,7 +32,6 @@
import java.util.SortedSet;
import java.util.TreeSet;
-import javax.naming.ldap.InitialLdapContext;
import javax.swing.Box;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
@@ -45,6 +44,7 @@
import javax.swing.event.DocumentListener;
import org.forgerock.i18n.LocalizableMessage;
+import org.opends.admin.ads.util.ConnectionWrapper;
import org.opends.guitools.controlpanel.datamodel.AbstractIndexDescriptor;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
import org.opends.guitools.controlpanel.datamodel.IndexDescriptor;
@@ -56,16 +56,13 @@
import org.opends.guitools.controlpanel.task.Task;
import org.opends.guitools.controlpanel.util.ConfigReader;
import org.opends.guitools.controlpanel.util.Utilities;
-import org.forgerock.opendj.config.client.ManagementContext;
-import org.opends.server.admin.client.ldap.JNDIDirContextAdaptor;
-import org.forgerock.opendj.config.client.ldap.LDAPManagementContext;
import org.forgerock.opendj.server.config.client.BackendCfgClient;
import org.forgerock.opendj.server.config.client.BackendIndexCfgClient;
import org.forgerock.opendj.server.config.client.PluggableBackendCfgClient;
+import org.opends.server.core.ConfigurationHandler;
import org.opends.server.core.DirectoryServer;
import org.forgerock.opendj.ldap.schema.AttributeType;
import org.forgerock.opendj.ldap.DN;
-import org.opends.server.types.OpenDsException;
/**
* The panel that displays an existing index (it appears on the right of the
@@ -549,7 +546,7 @@
* @throws OpenDsException
* if there is an error updating the configuration.
*/
- private void updateConfiguration() throws OpenDsException
+ private void updateConfiguration() throws Exception
{
boolean configHandlerUpdated = false;
try
@@ -563,7 +560,7 @@
DirectoryServer.deregisterBaseDN(DN.valueOf("cn=config"));
}
DirectoryServer.getInstance().initializeConfiguration(
- org.opends.server.extensions.ConfigFileHandler.class.getName(), ConfigReader.configFile);
+ ConfigurationHandler.class.getName(), ConfigReader.configFile);
getInfo().setMustDeregisterConfig(true);
}
else
@@ -598,7 +595,7 @@
if (isServerRunning())
{
- modifyIndexOnline(getInfo().getDirContext());
+ modifyIndexOnline(getInfo().getConnection());
}
else
{
@@ -628,19 +625,18 @@
/**
* Modifies index using the provided connection.
*
- * @param ctx
+ * @param connWrapper
* the connection to be used to update the index configuration.
* @throws OpenDsException
* if there is an error updating the server.
*/
- private void modifyIndexOnline(final InitialLdapContext ctx) throws OpenDsException
+ private void modifyIndexOnline(final ConnectionWrapper connWrapper) throws Exception
{
- final ManagementContext mCtx = LDAPManagementContext.createFromContext(JNDIDirContextAdaptor.adapt(ctx));
- final BackendCfgClient backend = mCtx.getRootConfiguration().getBackend(backendName);
+ final BackendCfgClient backend = connWrapper.getRootConfiguration().getBackend(backendName);
modifyBackendIndexOnline((PluggableBackendCfgClient) backend);
}
- private void modifyBackendIndexOnline(final PluggableBackendCfgClient backend) throws OpenDsException
+ private void modifyBackendIndexOnline(final PluggableBackendCfgClient backend) throws Exception
{
final BackendIndexCfgClient index = backend.getBackendIndex(attributeName);
if (!indexTypes.equals(indexToModify.getTypes()))
--
Gitblit v1.10.0