From 53e9b6737ff1f758a8b1cfc5c7fe6cebd158bf6e Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Tue, 29 Jan 2008 17:59:28 +0000
Subject: [PATCH] Fix for issue 2870: status and dsreplication status do not show replication monitoring The changes consist basically in using the new attributes "approx-older-change-not-synchronized-millis" and "missing-changes" in status and replication status command-lines.  In fact a millisecond version of approx-older-change-not-synchronized-millis has been added in order the remote command-line to be able to provide a localized version of the date (instead of directly presenting the date that was written by the server).

---
 opendj-sdk/opends/src/ads/org/opends/admin/ads/ServerDescriptor.java |   23 +++++++++++++++++------
 1 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/opendj-sdk/opends/src/ads/org/opends/admin/ads/ServerDescriptor.java b/opendj-sdk/opends/src/ads/org/opends/admin/ads/ServerDescriptor.java
index 6b8b387..f59a955 100644
--- a/opendj-sdk/opends/src/ads/org/opends/admin/ads/ServerDescriptor.java
+++ b/opendj-sdk/opends/src/ads/org/opends/admin/ads/ServerDescriptor.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Portions Copyright 2007 Sun Microsystems, Inc.
+ *      Portions Copyright 2007-2008 Sun Microsystems, Inc.
  */
 
 package org.opends.admin.ads;
@@ -877,9 +877,10 @@
     ctls.setSearchScope(SearchControls.ONELEVEL_SCOPE);
     ctls.setReturningAttributes(
     new String[] {
-      "approximate-delay", "waiting-changes", "base-dn"
+      "approx-older-change-not-synchronized-millis", "missing-changes",
+      "base-dn", "server-id"
     });
-    filter = "(approximate-delay=*)";
+    filter = "(missing-changes=*)";
 
     jndiName = new LdapName("cn=monitor");
 
@@ -894,16 +895,26 @@
           SearchResult sr = (SearchResult)monitorEntries.next();
 
           String dn = getFirstValue(sr, "base-dn");
+          int replicaId = -1;
+          try
+          {
+            replicaId = new Integer(getFirstValue(sr, "server-id"));
+          }
+          catch (Throwable t)
+          {
+          }
 
           for (ReplicaDescriptor replica: desc.getReplicas())
           {
             if (Utils.areDnsEqual(dn, replica.getSuffix().getDN()) &&
-                replica.isReplicated())
+                replica.isReplicated() &&
+                (replica.getReplicationId() == replicaId))
             {
               try
               {
                 replica.setAgeOfOldestMissingChange(
-                    new Integer(getFirstValue(sr, "approximate-delay")));
+                    new Long(getFirstValue(sr,
+                        "approx-older-change-not-synchronized-millis")));
               }
               catch (Throwable t)
               {
@@ -911,7 +922,7 @@
               try
               {
                 replica.setMissingChanges(
-                    new Integer(getFirstValue(sr, "waiting-changes")));
+                    new Integer(getFirstValue(sr, "missing-changes")));
               }
               catch (Throwable t)
               {

--
Gitblit v1.10.0