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/VLVIndexPanel.java | 21 ++++++++-------------
1 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java
index 45d8fae..63cb735 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/ui/VLVIndexPanel.java
@@ -33,7 +33,6 @@
import java.util.Set;
import java.util.TreeSet;
-import javax.naming.ldap.InitialLdapContext;
import javax.swing.Box;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
@@ -50,9 +49,9 @@
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.LocalizedIllegalArgumentException;
-import org.forgerock.opendj.config.server.ConfigException;
import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.SearchScope;
+import org.opends.admin.ads.util.ConnectionWrapper;
import org.opends.guitools.controlpanel.datamodel.AbstractIndexDescriptor;
import org.opends.guitools.controlpanel.datamodel.CategorizedComboBoxElement;
import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
@@ -65,14 +64,11 @@
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.BackendVLVIndexCfgClient;
import org.forgerock.opendj.server.config.client.PluggableBackendCfgClient;
import org.forgerock.opendj.server.config.client.RootCfgClient;
+import org.opends.server.core.ConfigurationHandler;
import org.opends.server.core.DirectoryServer;
-import org.opends.server.types.OpenDsException;
/**
* The panel that displays an existing VLV index (it appears on the right of the
@@ -604,7 +600,7 @@
return canLaunch;
}
- private void updateConfiguration() throws OpenDsException, ConfigException
+ private void updateConfiguration() throws Exception
{
boolean configHandlerUpdated = false;
try
@@ -618,7 +614,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
@@ -648,7 +644,7 @@
if (isServerRunning())
{
- modifyVLVIndexOnline(getInfo().getDirContext());
+ modifyVLVIndexOnline(getInfo().getConnection());
}
else
{
@@ -683,14 +679,13 @@
* @throws OpenDsException
* if there is an error updating the server.
*/
- private void modifyVLVIndexOnline(InitialLdapContext ctx) throws OpenDsException
+ private void modifyVLVIndexOnline(ConnectionWrapper connWrapper) throws Exception
{
- final ManagementContext mCtx = LDAPManagementContext.createFromContext(JNDIDirContextAdaptor.adapt(ctx));
- final RootCfgClient root = mCtx.getRootConfiguration();
+ final RootCfgClient root = connWrapper.getRootConfiguration();
modifyBackendVLVIndexOnline((PluggableBackendCfgClient) root.getBackend(backendID));
}
- private void modifyBackendVLVIndexOnline(final PluggableBackendCfgClient backend) throws OpenDsException
+ private void modifyBackendVLVIndexOnline(final PluggableBackendCfgClient backend) throws Exception
{
final BackendVLVIndexCfgClient index = backend.getBackendVLVIndex(indexName);
final DN b = DN.valueOf(baseDN);
--
Gitblit v1.10.0