From f3f9f37cd05c81867e2852746b169132d8f1b598 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Fri, 01 Jul 2016 14:30:12 +0000
Subject: [PATCH] Partial OPENDJ-2625 Convert all code that uses JNDI to use the SDK instead

---
 opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java |   13 +++++--------
 1 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java
index 346553f..9337132 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java
@@ -19,8 +19,6 @@
 import java.util.Collections;
 import java.util.Set;
 
-import javax.naming.ldap.InitialLdapContext;
-
 /**
  * A simple class that is used to be able to specify which URL and connection
  * type to use when we connect to a server.
@@ -95,20 +93,19 @@
 
   /**
    * Commodity method that returns a PreferredConnection object with the
-   * information on a given InitialLdapContext.
+   * information on a given connection.
    * @param conn the connection we retrieve the information from.
    * @return a preferred connection object.
    */
   private static PreferredConnection getPreferredConnection(ConnectionWrapper conn)
   {
-    InitialLdapContext ctx = conn.getLdapContext();
-    String ldapUrl = ConnectionUtils.getLdapUrl(ctx);
+    String ldapUrl = conn.getLdapUrl();
     PreferredConnection.Type type;
-    if (ConnectionUtils.isStartTLS(ctx))
+    if (conn.isStartTLS())
     {
       type = PreferredConnection.Type.START_TLS;
     }
-    else if (ConnectionUtils.isSSL(ctx))
+    else if (conn.isSSL())
     {
       type = PreferredConnection.Type.LDAPS;
     }
@@ -121,7 +118,7 @@
 
   /**
    * Commodity method that generates a list of preferred connection (of just
-   * one) with the information on a given InitialLdapContext.
+   * one) with the information on a given connection.
    * @param conn the connection we retrieve the information from.
    * @return a list containing the preferred connection object.
    */

--
Gitblit v1.10.0