From 1b57e037402f002dc849e824b92d98fb7dd44f30 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Fri, 21 Dec 2012 13:49:32 +0000
Subject: [PATCH] Additional fix for OPENDJ-554. Stats from SSL connections were not showing up due to the inclusion of an invalid connection handler monitor.  Also tidy up some typos.

---
 opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/SNMPMonitor.java              |   10 ++++++----
 opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DIRECTORY_SERVER_MIBImpl.java |    5 +++--
 opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DsApplIfOpsEntryImpl.java     |    6 +-----
 opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DsMIBImpl.java                |   15 +++++++++++----
 4 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DIRECTORY_SERVER_MIBImpl.java b/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DIRECTORY_SERVER_MIBImpl.java
index 2cd7640..b8837e2 100644
--- a/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DIRECTORY_SERVER_MIBImpl.java
+++ b/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DIRECTORY_SERVER_MIBImpl.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2012 ForgeRock Inc.
  */
 package org.opends.server.snmp;
 
@@ -56,7 +57,7 @@
      */
     private DsMIBImpl dsMibGroup = null;
     /**
-     * ObjectName of the Current Direcotry Server MIB.
+     * ObjectName of the Current Directory Server MIB.
      */
     private ObjectName mibObName;
     /**
@@ -67,7 +68,7 @@
     /**
      * Creates the Current Directory Server MIB.
      * @param registeredMBean indicates if the SNMP MBean has to register
-     * in the Direcotry Server MBeanServer
+     * in the Directory Server MBeanServer
      * @param mibName of the Directory Server MIB
      */
     public DIRECTORY_SERVER_MIBImpl(boolean registeredMBean,
diff --git a/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DsApplIfOpsEntryImpl.java b/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DsApplIfOpsEntryImpl.java
index 87b1070..719ab58 100644
--- a/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DsApplIfOpsEntryImpl.java
+++ b/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DsApplIfOpsEntryImpl.java
@@ -64,7 +64,7 @@
    */
   private ObjectName connectionHandlerName;
   /**
-   * SNMPMonitor representing the gateway beetween SNMP MBeans and cn=monitor
+   * SNMPMonitor representing the gateway between SNMP MBeans and cn=monitor
    * MBeans.
    */
   private SNMPMonitor monitor;
@@ -130,7 +130,6 @@
     } else {
       return 0L;
     }
-
   }
 
   /**
@@ -150,7 +149,6 @@
     } else {
       return 0L;
     }
-
   }
 
   /**
@@ -170,7 +168,6 @@
     } else {
       return 0L;
     }
-
   }
 
   /**
@@ -355,7 +352,6 @@
         }
         return null;
       }
-      return this.entryName;
     }
     return this.entryName;
   }
diff --git a/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DsMIBImpl.java b/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DsMIBImpl.java
index 970f6b6..ee13482 100644
--- a/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DsMIBImpl.java
+++ b/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/DsMIBImpl.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2008-2009 Sun Microsystems, Inc.
+ *      Portions Copyright 2012 ForgeRock Inc.
  */
 package org.opends.server.snmp;
 
@@ -43,7 +44,7 @@
 
 
 /**
- * The class reprents the "DsMIB" group implementation.
+ * The class represents the "DsMIB" group implementation.
  * The group is defined with the following oid: 1.3.6.1.2.1.66.
  */
 public class DsMIBImpl extends DsMIB implements NotificationListener {
@@ -73,18 +74,24 @@
 
   /**
    * List of DsTableEntries.
+   * SNMP dsTable contains the list of Directory Servers
    */
   private Hashtable<ObjectName, DsEntry> dsTableEntries =
           new Hashtable<ObjectName, DsEntry>();
 
   /**
-   * List of DsIntTableEntries.
+   * List of DsApplIfOpsTableEntries.
+   * SNMP dsAppIfOpsTable provides summary statistics on the accesses
+   * operations and errors for each application protocol interface
+   * of a Directory Server
    */
   private Hashtable<ObjectName, DsEntry> dsApplIfOpsTableEntries =
           new Hashtable<ObjectName, DsEntry>();
 
-   /**
+  /**
    * List of DsIntTableEntries.
+   * SNMP dsIntTable provides some useful information on the
+   * interactions of the monitored DS with peer DS
    */
   private Hashtable<ObjectName, DsEntry> dsIntTableEntries =
           new Hashtable<ObjectName, DsEntry>();
@@ -246,7 +253,7 @@
       DsTableEntryImpl entry = new DsTableEntryImpl(
               this.mib, this.server, this.applIndex);
 
-      // if the entry alreday exists nothing to do
+      // if the entry already exists nothing to do
       if ((this.dsTableEntries.containsKey(entry.getObjectName())) ||
               (entry == null)) {
         return true;
diff --git a/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/SNMPMonitor.java b/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/SNMPMonitor.java
index 085df2c..aad1f18 100644
--- a/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/SNMPMonitor.java
+++ b/opendj-sdk/opends/src/snmp/src/org/opends/server/snmp/SNMPMonitor.java
@@ -23,6 +23,7 @@
  *
  *
  *      Copyright 2008 Sun Microsystems, Inc.
+ *      Portions Copyright 2012 ForgeRock Inc.
  */
 package org.opends.server.snmp;
 
@@ -112,7 +113,7 @@
   /**
    * Gets the Connection Handlers Statistics MBean.
    * @return the Set of Connection Handlers Statistics.
-   *     If Statistics do not exixist then an empty Set is returned
+   *         If Statistics do not exist then an empty Set is returned
    */
   public Set<ObjectName> getConnectionHandlersStatistics() {
     Set<ObjectName> results = new HashSet<ObjectName>();
@@ -180,7 +181,8 @@
       for (Iterator iter = monitorObjects.iterator(); iter.hasNext();) {
         ObjectName name = (ObjectName) iter.next();
         if ((name.getCanonicalName().contains("Connection_Handler")) &&
-                (!(name.getCanonicalName().endsWith("_Statistics")))) {
+                (!(name.getCanonicalName().endsWith("_Statistics"))) &&
+                (name.getKeyProperty("Rdn3") == null)) {
           results.add(name);
         }
       }
@@ -197,8 +199,8 @@
    * Returns the ObjectName of the Statistics Connection Handler name.
    * corresponding to the Connection Handler name
    * @param connectionHandlerName The connection handler name
-   * @return the ObjectName of the statistics ObjectName, null if the statistics
-   * could not be found
+   * @return the ObjectName of the statistics ObjectName,
+   *         null if the statistics could not be found
    */
   public ObjectName getConnectionHandlerStatistics(
           ObjectName connectionHandlerName) {

--
Gitblit v1.10.0