From c3420bec486f1921ea67fab4b1019ef06a0cea16 Mon Sep 17 00:00:00 2001
From: gbellato <gbellato@localhost>
Date: Mon, 23 Mar 2009 09:04:22 +0000
Subject: [PATCH] Fix for 3889 : Replication domain don't have access to the Replica ServerStates

---
 opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 52 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java b/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
index d7a71f5..a9ade5f 100644
--- a/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
+++ b/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java
@@ -1427,6 +1427,58 @@
           errorMsg.getDetails()));
       } else if (msg instanceof MonitorRequestMsg)
       {
+        // If the request comes from a Directory Server we need to
+        // build the full list of all servers in the topology
+        // and send back a MonitorMsg with the full list of all the servers
+        // in the topology.
+        if (senderHandler.isLDAPserver())
+        {
+          MonitorMsg returnMsg =
+            new MonitorMsg(msg.getDestination(), msg.getsenderID());
+          try
+          {
+            returnMsg.setReplServerDbState(getDbServerState());
+            // Update the information we have about all servers
+            // in the topology.
+            MonitorData md = computeMonitorData();
+
+            // Add the informations about the Replicas currently in
+            // the topology.
+            Iterator<Short> it = md.ldapIterator();
+            while (it.hasNext())
+            {
+              short replicaId = it.next();
+              returnMsg.setServerState(
+                  replicaId, md.getLDAPServerState(replicaId),
+                  md.getApproxFirstMissingDate(replicaId), true);
+            }
+
+            // Add the informations about the Replication Servers
+            // currently in the topology.
+            it = md.rsIterator();
+            while (it.hasNext())
+            {
+              short replicaId = it.next();
+              returnMsg.setServerState(
+                  replicaId, md.getRSStates(replicaId),
+                  md.getRSApproxFirstMissingDate(replicaId), false);
+            }
+          }
+          catch (DirectoryException e)
+          {
+            // If we can't compute the Monitor Information, send
+            // back an empty message.
+          }
+          try
+          {
+            senderHandler.send(returnMsg);
+          } catch (IOException e)
+          {
+            // the connection was closed.
+          }
+          return;
+        }
+
         MonitorRequestMsg replServerMonitorRequestMsg =
           (MonitorRequestMsg) msg;
 

--
Gitblit v1.10.0