From 08154804f671e1c471df14ac999e6d6bb18bbd37 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/ServerLoader.java | 16 +++++++---------
1 files changed, 7 insertions(+), 9 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ServerLoader.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ServerLoader.java
index 15e6673..f5adcd7 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ServerLoader.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ServerLoader.java
@@ -24,10 +24,10 @@
import javax.naming.NamingException;
import javax.naming.NoPermissionException;
import javax.naming.TimeLimitExceededException;
-import javax.naming.ldap.LdapName;
import org.forgerock.i18n.LocalizableMessage;
import org.forgerock.i18n.slf4j.LocalizedLogger;
+import org.forgerock.opendj.ldap.DN;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.ADSContext.ServerProperty;
import org.opends.admin.ads.ServerDescriptor;
@@ -53,7 +53,7 @@
private ServerDescriptor serverDescriptor;
private final ApplicationTrustManager trustManager;
private final int timeout;
- private final String dn;
+ private final DN dn;
private final String pwd;
private final LinkedHashSet<PreferredConnection> preferredLDAPURLs;
private final TopologyCacheFilter filter;
@@ -77,8 +77,7 @@
* to retrieve all the information.
*/
public ServerLoader(Map<ServerProperty,Object> serverProperties,
- String dn, String pwd, ApplicationTrustManager trustManager,
- int timeout,
+ DN dn, String pwd, ApplicationTrustManager trustManager, int timeout,
Set<PreferredConnection> preferredLDAPURLs,
TopologyCacheFilter filter)
{
@@ -215,7 +214,8 @@
for (PreferredConnection connection : getLDAPURLsByPreference())
{
lastLdapUrl = connection.getLDAPURL();
- ConnectionWrapper conn = new ConnectionWrapper(lastLdapUrl, connection.getType(), dn, pwd, timeout, trustManager);
+ ConnectionWrapper conn =
+ new ConnectionWrapper(lastLdapUrl, connection.getType(), dn.toString(), pwd, timeout, trustManager);
if (conn.getLdapContext() != null)
{
return conn;
@@ -345,10 +345,8 @@
{
try
{
- LdapName theDn = new LdapName(dn);
- LdapName containerDn =
- new LdapName(ADSContext.getAdministratorContainerDN());
- return theDn.startsWith(containerDn);
+ DN containerDn = DN.valueOf(ADSContext.getAdministratorContainerDN());
+ return dn.isSubordinateOrEqualTo(containerDn);
}
catch (Throwable t)
{
--
Gitblit v1.10.0