From 9fa1aa8315996dc555e9921a1c77979e07050878 Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Wed, 29 Jun 2016 15:48:26 +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/ConnectionWrapper.java | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionWrapper.java b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionWrapper.java
index 1f35ac0..575f2a3 100644
--- a/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionWrapper.java
+++ b/opendj-server-legacy/src/main/java/org/opends/admin/ads/util/ConnectionWrapper.java
@@ -38,6 +38,7 @@
import org.forgerock.opendj.config.LDAPProfile;
import org.forgerock.opendj.ldap.Connection;
+import org.forgerock.opendj.ldap.DN;
import org.forgerock.opendj.ldap.LDAPConnectionFactory;
import org.forgerock.opendj.ldap.LdapException;
import org.forgerock.opendj.ldap.SSLContextBuilder;
@@ -63,6 +64,8 @@
private final Connection connection;
private final InitialLdapContext ldapContext;
private final HostPort hostPort;
+ private DN bindDn;
+ private String bindPwd;
private final int connectTimeout;
private final TrustManager trustManager;
private final KeyManager keyManager;
@@ -152,6 +155,8 @@
int connectTimeout, TrustManager trustManager, KeyManager keyManager) throws NamingException
{
this.hostPort = hostPort;
+ this.bindDn = DN.valueOf(bindDn);
+ this.bindPwd = bindPwd;
this.connectTimeout = connectTimeout;
this.trustManager = trustManager;
this.keyManager = keyManager;
@@ -196,6 +201,36 @@
}
}
+ /**
+ * Returns the bind DN used by this connection.
+ *
+ * @return the bind DN used by this connection.
+ */
+ public DN getBindDn()
+ {
+ return bindDn;
+ }
+
+ /**
+ * Returns the bind password used by this connection.
+ *
+ * @return the bind password used by this connection.
+ */
+ public String getBindPassword()
+ {
+ return bindPwd;
+ }
+
+ /**
+ * Returns the LDAP URL used by the InitialLdapContext.
+ *
+ * @return the LDAP URL used by the InitialLdapContext.
+ */
+ public String getLdapUrl()
+ {
+ return ConnectionUtils.getLdapUrl(ldapContext);
+ }
+
private InitialLdapContext createAdministrativeContext(Options options, String bindDn, String bindPwd)
throws NamingException
{
--
Gitblit v1.10.0