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/uninstaller/ui/LoginDialog.java |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java
index 5ca7b5c..d94336f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/uninstaller/ui/LoginDialog.java
@@ -12,7 +12,7 @@
  * information: "Portions Copyright [year] [name of copyright owner]".
  *
  * Copyright 2008-2010 Sun Microsystems, Inc.
- * Portions Copyright 2014-2015 ForgeRock AS.
+ * Portions Copyright 2014-2016 ForgeRock AS.
  */
 
 package org.opends.guitools.uninstaller.ui;
@@ -42,6 +42,7 @@
 import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.admin.ads.ADSContext;
 import org.opends.admin.ads.util.ApplicationTrustManager;
+import org.opends.admin.ads.util.ConnectionWrapper;
 import org.opends.guitools.controlpanel.datamodel.ConnectionProtocolPolicy;
 import org.opends.guitools.controlpanel.datamodel.ControlPanelInfo;
 import org.opends.guitools.controlpanel.util.ConfigFromFile;
@@ -61,7 +62,6 @@
 import org.opends.quicksetup.util.Utils;
 
 import static com.forgerock.opendj.cli.Utils.*;
-
 import static org.opends.messages.AdminToolMessages.*;
 import static org.opends.messages.QuickSetupMessages.*;
 
@@ -94,6 +94,8 @@
 
   private InitialLdapContext ctx;
 
+  private ConnectionWrapper connWrapper;
+
   private String usedUrl;
 
   private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
@@ -197,6 +199,16 @@
   }
 
   /**
+   * Returns the connection we got with the provided authentication.
+   *
+   * @return the connection
+   */
+  public ConnectionWrapper getConnection()
+  {
+    return connWrapper;
+  }
+
+  /**
    * Creates and returns the panel of the dialog.
    * @return the panel of the dialog.
    */
@@ -397,10 +409,8 @@
             throw new ApplicationException(ReturnCode.APPLICATION_ERROR,
                 ERR_COULD_NOT_FIND_VALID_LDAPURL.get(), null);
           }
-          ctx =
-            org.opends.guitools.controlpanel.util.Utilities.getAdminDirContext(
-              info, dn, pwd);
-
+          ctx = org.opends.guitools.controlpanel.util.Utilities.getAdminDirContext(info, dn, pwd);
+          connWrapper = new ConnectionWrapper(ctx, info.getConnectTimeout(), info.getTrustManager());
 
         } catch (NamingException ne)
         {

--
Gitblit v1.10.0