From 943a2d7d4cca6371830b33db941af3ec0431fb5c Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Sun, 26 Aug 2007 03:16:07 +0000
Subject: [PATCH] This commit includes all the code for the first version of the replication tools.  As they require further testing the command line associated with them has not been committed.

---
 opendj-sdk/opends/src/ads/org/opends/admin/ads/TopologyCache.java |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/opendj-sdk/opends/src/ads/org/opends/admin/ads/TopologyCache.java b/opendj-sdk/opends/src/ads/org/opends/admin/ads/TopologyCache.java
index 666f59a..4b0cff2 100644
--- a/opendj-sdk/opends/src/ads/org/opends/admin/ads/TopologyCache.java
+++ b/opendj-sdk/opends/src/ads/org/opends/admin/ads/TopologyCache.java
@@ -36,12 +36,11 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.naming.Context;
-import javax.naming.NamingException;
 import javax.naming.ldap.LdapName;
 
 import org.opends.admin.ads.ADSContext.ServerProperty;
 import org.opends.admin.ads.util.ApplicationTrustManager;
+import org.opends.admin.ads.util.ConnectionUtils;
 import org.opends.admin.ads.util.ServerLoader;
 
 /**
@@ -72,27 +71,14 @@
    * @param trustManager the ApplicationTrustManager that must be used to trust
    * certificates when we create connections to the registered servers to read
    * their configuration.
-   * @throws TopologyCacheException if an error occurred reading the
-   * authentication data in the DirContext associated with the provided
-   * ADSContext.
    */
   public TopologyCache(ADSContext adsContext,
       ApplicationTrustManager trustManager)
-  throws TopologyCacheException
   {
     this.adsContext = adsContext;
     this.trustManager = trustManager;
-    try
-    {
-      dn = (String)adsContext.getDirContext().getEnvironment().get(
-          Context.SECURITY_PRINCIPAL);
-      pwd = (String)adsContext.getDirContext().getEnvironment().get(
-          Context.SECURITY_CREDENTIALS);
-    }
-    catch (NamingException ne)
-    {
-      throw new TopologyCacheException(TopologyCacheException.Type.BUG, ne);
-    }
+    dn = ConnectionUtils.getBindDN(adsContext.getDirContext());
+    pwd = ConnectionUtils.getBindPassword(adsContext.getDirContext());
   }
 
   /**
@@ -256,4 +242,13 @@
     return new ServerLoader(serverProperties, dn, pwd,
         trustManager.createCopy());
   }
+
+  /**
+   * Returns the adsContext used by this TopologyCache.
+   * @return the adsContext used by this TopologyCache.
+   */
+  public ADSContext getAdsContext()
+  {
+    return adsContext;
+  }
 }

--
Gitblit v1.10.0