From 18dc6866af53fb06efb0879f9c9c369e698d7379 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 18 Apr 2016 06:57:37 +0000
Subject: [PATCH] Remove ConnectionWrapper constructor accepting an InitialLdapContext
---
opendj-server-legacy/src/main/java/org/opends/admin/ads/util/PreferredConnection.java | 22 +++++++---------------
1 files changed, 7 insertions(+), 15 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 8eaf32a..08d4bf9 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
@@ -12,11 +12,11 @@
* information: "Portions Copyright [year] [name of copyright owner]".
*
* Copyright 2008-2009 Sun Microsystems, Inc.
- * Portions Copyright 2013-2015 ForgeRock AS.
+ * Portions Copyright 2013-2016 ForgeRock AS.
*/
package org.opends.admin.ads.util;
-import java.util.LinkedHashSet;
+import java.util.Collections;
import java.util.Set;
import javax.naming.ldap.InitialLdapContext;
@@ -71,13 +71,13 @@
return type;
}
- /** {@inheritDoc} */
+ @Override
public int hashCode()
{
return (type+ldapUrl.toLowerCase()).hashCode();
}
- /** {@inheritDoc} */
+ @Override
public boolean equals(Object o)
{
if (this == o)
@@ -93,15 +93,13 @@
return false;
}
-
/**
* Commodity method that returns a PreferredConnection object with the
* information on a given InitialLdapContext.
* @param ctx the connection we retrieve the information from.
* @return a preferred connection object.
*/
- public static PreferredConnection getPreferredConnection(
- InitialLdapContext ctx)
+ public static PreferredConnection getPreferredConnection(InitialLdapContext ctx)
{
String ldapUrl = ConnectionUtils.getLdapUrl(ctx);
PreferredConnection.Type type;
@@ -120,20 +118,14 @@
return new PreferredConnection(ldapUrl, type);
}
-
-
/**
* Commodity method that generates a list of preferred connection (of just
* one) with the information on a given InitialLdapContext.
* @param ctx the connection we retrieve the information from.
* @return a list containing the preferred connection object.
*/
- public static Set<PreferredConnection> getPreferredConnections(
- InitialLdapContext ctx)
+ public static Set<PreferredConnection> getPreferredConnections(InitialLdapContext ctx)
{
- PreferredConnection cnx = PreferredConnection.getPreferredConnection(ctx);
- Set<PreferredConnection> returnValue = new LinkedHashSet<>();
- returnValue.add(cnx);
- return returnValue;
+ return Collections.singleton(getPreferredConnection(ctx));
}
}
--
Gitblit v1.10.0