From fa6e5bb0c17c4d59d8598979feb1a7701bc32679 Mon Sep 17 00:00:00 2001
From: neil_a_wilson <neil_a_wilson@localhost>
Date: Tue, 12 Dec 2006 23:55:39 +0000
Subject: [PATCH] Publish a separate monitor entry for each connection handler, which includes the protocol, listen address/port, number of established connections, and information about each connection.

---
 opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java |   69 ++++++++++++++++++++++++++++++++--
 1 files changed, 65 insertions(+), 4 deletions(-)

diff --git a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
index 105d52b..c8c22af 100644
--- a/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
+++ b/opends/src/server/org/opends/server/protocols/ldap/LDAPClientConnection.java
@@ -188,6 +188,10 @@
   // The string representation of the address of the client.
   private String clientAddress;
 
+  // The name of the protocol that the client is using to communicate with the
+  // server.
+  private String protocol;
+
   // The string representation of the address of the server to which the client
   // has connected.
   private String serverAddress;
@@ -237,6 +241,7 @@
     disconnectRequested  = false;
     operationsInProgress = new ConcurrentHashMap<Integer,Operation>();
     keepStats            = connectionHandler.keepStats();
+    protocol             = "LDAP";
 
     clientAddress = clientChannel.socket().getInetAddress().getHostAddress();
     clientPort    = clientChannel.socket().getPort();
@@ -351,9 +356,7 @@
   {
     assert debugEnter(CLASS_NAME, "getProtocol");
 
-    // FIXME -- what if it is a secure connection?  And what if it is secure now
-    // but wasn't when it was established?
-    return "LDAP";
+    return protocol;
   }
 
 
@@ -522,6 +525,15 @@
                       String.valueOf(securityProvider));
 
     this.securityProvider = securityProvider;
+
+    if (securityProvider.isSecure())
+    {
+      protocol = "LDAP+" + securityProvider.getSecurityMechanismName();
+    }
+    else
+    {
+      protocol = "LDAP";
+    }
   }
 
 
@@ -2355,6 +2367,55 @@
 
 
   /**
+   * {@inheritDoc}
+   */
+  public String getMonitorSummary()
+  {
+    assert debugEnter(CLASS_NAME, "getMonitorSummary");
+
+    StringBuilder buffer = new StringBuilder();
+    buffer.append("connID=\"");
+    buffer.append(connectionID);
+    buffer.append("\" connectTime=\"");
+    buffer.append(getConnectTimeString());
+    buffer.append("\" source=\"");
+    buffer.append(clientAddress);
+    buffer.append(":");
+    buffer.append(clientPort);
+    buffer.append("\" destination=\"");
+    buffer.append(serverAddress);
+    buffer.append(":");
+    buffer.append(connectionHandler.getListenPort());
+    buffer.append("\" ldapVersion=\"");
+    buffer.append(ldapVersion);
+    buffer.append("\" authDN=\"");
+
+    DN authDN = getAuthenticationInfo().getAuthenticationDN();
+    if (authDN != null)
+    {
+      authDN.toString(buffer);
+    }
+
+    buffer.append("\" security=\"");
+    if (securityProvider.isSecure())
+    {
+      buffer.append(securityProvider.getSecurityMechanismName());
+    }
+    else
+    {
+      buffer.append("none");
+    }
+
+    buffer.append("\" opsInProgress=\"");
+    buffer.append(operationsInProgress.size());
+    buffer.append("\"");
+
+    return buffer.toString();
+  }
+
+
+
+  /**
    * Appends a string representation of this client connection to the provided
    * buffer.
    *
@@ -2480,7 +2541,7 @@
     }
 
     clearSecurityProvider = securityProvider;
-    securityProvider      = tlsSecurityProvider;
+    setConnectionSecurityProvider(tlsSecurityProvider);
   }
 
 

--
Gitblit v1.10.0