From aaee394b8c7fdcb653d09d35ea1a28e574632a22 Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 08 May 2007 21:29:14 +0000
Subject: [PATCH] Do not display the replication monitoring information if there are no replicated suffixes.

---
 opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ConfigFromLDAP.java |   37 ++++++++++++++++++++-----------------
 1 files changed, 20 insertions(+), 17 deletions(-)

diff --git a/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ConfigFromLDAP.java b/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ConfigFromLDAP.java
index 64575b4..22c9722 100644
--- a/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ConfigFromLDAP.java
+++ b/opendj-sdk/opends/src/statuspanel/org/opends/statuspanel/ConfigFromLDAP.java
@@ -29,7 +29,6 @@
 
 import java.util.HashMap;
 import java.util.HashSet;
-import java.util.LinkedHashSet;
 import java.util.Set;
 import java.util.TreeSet;
 
@@ -204,25 +203,31 @@
    */
   public HashSet<String> getAdministrativeUsers()
   {
-    return administrativeUsers;
+    HashSet<String> copy = new HashSet<String>();
+    copy.addAll(administrativeUsers);
+    return copy;
   }
 
   /**
-   * Returns the database descriptors found using LDAP.
-   * @return the database descriptors found using LDAP.
+   * Returns the database descriptors found in the config.ldif.
+   * @return the database descriptors found in the config.ldif.
    */
   public HashSet<DatabaseDescriptor> getDatabases()
   {
-    return databases;
+    HashSet<DatabaseDescriptor> copy = new HashSet<DatabaseDescriptor>();
+    copy.addAll(databases);
+    return copy;
   }
 
   /**
-   * Returns the listener descriptors found using LDAP.
-   * @return the listeners descriptors found using LDAP.
+   * Returns the listener descriptors found in the config.ldif.
+   * @return the listeners descriptors found in the config.ldif.
    */
   public HashSet<ListenerDescriptor> getListeners()
   {
-    return listeners;
+    HashSet<ListenerDescriptor> copy = new HashSet<ListenerDescriptor>();
+    copy.addAll(listeners);
+    return copy;
   }
 
   /**
@@ -794,22 +799,20 @@
 
     if (!isConfigBackend(id))
     {
-      Set<String> baseDns = new TreeSet<String>();
-      baseDns.addAll(getValues(entry, "ds-cfg-backend-base-dn"));
-      Set<BaseDNDescriptor> replicas = new LinkedHashSet<BaseDNDescriptor>();
+      Set<String> baseDns = getValues(entry, "ds-cfg-backend-base-dn");
+      TreeSet<BaseDNDescriptor> replicas = new TreeSet<BaseDNDescriptor>();
       int nEntries = getEntryCount(ctx, id);
 
+      DatabaseDescriptor db = new DatabaseDescriptor(id, replicas, nEntries);
+
       for (String baseDn : baseDns)
       {
-        replicas.add(getBaseDNDescriptor(ctx, baseDn));
+        BaseDNDescriptor rep = getBaseDNDescriptor(ctx, baseDn);
+        rep.setDatabase(db);
+        db.getBaseDns().add(rep);
       }
 
-      DatabaseDescriptor db = new DatabaseDescriptor(id, replicas, nEntries);
       databases.add(db);
-      for (BaseDNDescriptor rep: replicas)
-      {
-        rep.setDatabase(db);
-      }
     }
   }
 

--
Gitblit v1.10.0