From 4783adc14c2d6b96260052d3b634eafa500c6ddf Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Thu, 01 Mar 2007 03:27:06 +0000
Subject: [PATCH] This removes old debug logging framework method calls that are going to be automatically instrumented by AspectJ. Non instrumented debug method calls are updated to use the new debug framework methods. However, the new debug logging framework is not yet active as the Aspects are not weaved in. After this revision, debug logging will be disabled in the server until the new AOP framework is complete. 

---
 opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java |  153 +++++++++++++++++++++++----------------------------
 1 files changed, 69 insertions(+), 84 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java b/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java
index 2742394..59d660e 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/protocols/jmx/RmiConnector.java
@@ -46,13 +46,15 @@
 import org.opends.server.config.JMXMBean;
 import org.opends.server.extensions.NullKeyManagerProvider;
 
-import org.opends.server.types.DebugLogCategory;
-import org.opends.server.types.DebugLogSeverity;
+import static org.opends.server.loggers.debug.DebugLogger.debugCought;
+import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
+import static org.opends.server.loggers.debug.DebugLogger.debugVerbose;
+import static org.opends.server.loggers.debug.DebugLogger.debugWarning;
+import static org.opends.server.loggers.debug.DebugLogger.debugError;
+import org.opends.server.types.DebugLogLevel;
 
 import org.opends.server.util.SelectableCertificateKeyManager;
 
-import static org.opends.server.loggers.Debug.*;
-
 /**
  * The RMI connector class starts and stops the JMX RMI connector server.
  * There are 2 different connector servers
@@ -76,11 +78,6 @@
    */
   private MBeanServer mbs = null;
 
-  /**
-   * The fully-qualified name of this class for debugging purposes.
-   */
-  private static final String CLASS_NAME =
-    "org.opends.server.protocols.jmx.RmiConnector";
 
   /**
    * the client address to connect to the common registry. Note that a
@@ -146,7 +143,6 @@
   public RmiConnector(MBeanServer mbs,
       JmxConnectionHandler jmxConnectionHandler)
   {
-    assert debugConstructor(CLASS_NAME);
     this.mbs = mbs;
     this.jmxConnectionHandler = jmxConnectionHandler;
 
@@ -168,7 +164,6 @@
    */
   public void initialize()
   {
-    assert debugEnter(CLASS_NAME, "initialize");
     try
     {
       //
@@ -187,18 +182,19 @@
     }
     catch (Exception e)
     {
-      assert debugException(CLASS_NAME, "start", e);
+      if (debugEnabled())
+      {
+        debugCought(DebugLogLevel.ERROR, e);
+      }
 
       throw new RuntimeException("Error while starting the RMI module : "
           + e.getMessage());
     }
 
-    assert debugMessage(
-        DebugLogCategory.CONNECTION_HANDLING,
-        DebugLogSeverity.VERBOSE,
-        CLASS_NAME,
-        "start",
-        "RMI module started");
+    if (debugEnabled())
+    {
+      debugVerbose("RMI module started");
+    }
   }
 
   /**
@@ -211,17 +207,14 @@
    */
   private void startCommonRegistry() throws Exception
   {
-    assert debugEnter(CLASS_NAME, "startCommonRegistry");
     int registryPort = jmxConnectionHandler.listenPort;
 
     //
     // create our local RMI registry if it does not exist already
-    assert debugMessage(
-        DebugLogCategory.CONNECTION_HANDLING,
-        DebugLogSeverity.VERBOSE,
-        CLASS_NAME,
-        "startCommonRegistry",
-        "start or reach an RMI registry on port " + registryPort);
+    if (debugEnabled())
+    {
+      debugVerbose("start or reach an RMI registry on port %d", registryPort);
+    }
     try
     {
       //
@@ -236,12 +229,10 @@
     {
       //
       // is the registry already created ?
-      assert debugMessage(
-          DebugLogCategory.CONNECTION_HANDLING,
-          DebugLogSeverity.WARNING,
-          CLASS_NAME,
-          "startCommonRegistry",
-          "cannot create the RMI registry -> already done ?");
+      if (debugEnabled())
+      {
+        debugWarning("cannot create the RMI registry -> already done ?");
+      }
       try
       {
         //
@@ -255,30 +246,26 @@
       }
       catch (Exception e)
       {
-        //
-        // no 'valid' registry found on the specified port
-        assert debugMessage(
-            DebugLogCategory.CONNECTION_HANDLING,
-            DebugLogSeverity.ERROR,
-            CLASS_NAME,
-            "startCommonRegistry",
-            "exception thrown while pinging the RMI registry");
+        if (debugEnabled())
+        {
+          //
+          // no 'valid' registry found on the specified port
+          debugError("exception thrown while pinging the RMI registry");
 
-        //
-        // throw the original exception
-        assert debugException(CLASS_NAME, "startCommonRegistry", re);
+          //
+          // throw the original exception
+          debugCought(DebugLogLevel.ERROR, re);
+        }
         throw re;
       }
 
       //
       // here the registry is ok even though
       // it was not created by this call
-      assert debugMessage(
-          DebugLogCategory.CONNECTION_HANDLING,
-          DebugLogSeverity.WARNING,
-          CLASS_NAME,
-          "startCommonRegistry",
-          "RMI was registry already started");
+      if (debugEnabled())
+      {
+        debugWarning("RMI was registry already started");
+      }
     }
   }
 
@@ -296,7 +283,6 @@
    */
   private void startConnectorNoClientCertificate() throws Exception
   {
-    assert debugEnter(CLASS_NAME, "startConnectorNoClientCertificate");
 
     try
     {
@@ -311,12 +297,10 @@
       DirectoryRMIServerSocketFactory rmiServerSockeyFactory = null;
       if (jmxConnectionHandler.useSSL)
       {
-        assert debugMessage(
-            DebugLogCategory.CONNECTION_HANDLING,
-            DebugLogSeverity.VERBOSE,
-            CLASS_NAME,
-            "startConnectorNoClientCertificate",
-            "SSL connection");
+        if (debugEnabled())
+        {
+          debugVerbose("SSL connection");
+        }
 
         // ---------------------
         // SERVER SIDE
@@ -371,22 +355,18 @@
       }
       else
       {
-        assert debugMessage(
-            DebugLogCategory.CONNECTION_HANDLING,
-            DebugLogSeverity.VERBOSE,
-            CLASS_NAME,
-            "startConnectorNoClientCertificate",
-            "UNSECURE CONNECTION");
+        if (debugEnabled())
+        {
+          debugVerbose("UNSECURE CONNECTION");
+        }
       }
 
       //
       // specify the rmi JMX authenticator to be used
-      assert debugMessage(
-          DebugLogCategory.CONNECTION_HANDLING,
-          DebugLogSeverity.VERBOSE,
-          CLASS_NAME,
-          "startConnectorNoClientCertificate",
-          "Add RmiAuthenticator into JMX map");
+      if (debugEnabled())
+      {
+        debugVerbose("Add RmiAuthenticator into JMX map");
+      }
       rmiAuthenticator = new RmiAuthenticator(jmxConnectionHandler);
 
       env.put(JMXConnectorServer.AUTHENTICATOR, rmiAuthenticator);
@@ -401,15 +381,13 @@
 
       //
       // Create and start the connector
-      assert debugMessage(
-          DebugLogCategory.CONNECTION_HANDLING,
-          DebugLogSeverity.VERBOSE,
-          CLASS_NAME,
-          "startConnectorNoClientCertificate",
-          "Create and start the JMX RMI connector");
+      if (debugEnabled())
+      {
+        debugVerbose("Create and start the JMX RMI connector");
+      }
       OpendsRMIJRMPServerImpl opendsRmiConnectorServer =
-        new OpendsRMIJRMPServerImpl(
-          0, rmiClientSockeyFactory, rmiServerSockeyFactory, env);
+          new OpendsRMIJRMPServerImpl(
+              0, rmiClientSockeyFactory, rmiServerSockeyFactory, env);
       jmxRmiConnectorNoClientCertificate = new RMIConnectorServer(url, env,
           opendsRmiConnectorServer, mbs);
       jmxRmiConnectorNoClientCertificate.start();
@@ -420,17 +398,18 @@
       ObjectName name = new ObjectName(jmxRmiConnectorNoClientCertificateName);
       mbs.registerMBean(jmxRmiConnectorNoClientCertificate, name);
 
-      assert debugMessage(
-          DebugLogCategory.CONNECTION_HANDLING,
-          DebugLogSeverity.VERBOSE,
-          CLASS_NAME,
-          "startConnectorNoClientCertificate",
-          "JMX RMI connector Started");
+      if (debugEnabled())
+      {
+        debugVerbose("JMX RMI connector Started");
+      }
 
     }
     catch (Exception e)
     {
-      debugException(CLASS_NAME, "startConnectorNoClientCertificate", e);
+      if (debugEnabled())
+      {
+        debugCought(DebugLogLevel.ERROR, e);
+      }
       throw e;
     }
 
@@ -499,7 +478,10 @@
     catch (Exception e)
     {
       // TODO Log an error message
-      assert debugException(CLASS_NAME, "finalizeConnectionHandler", e);
+      if (debugEnabled())
+      {
+        debugCought(DebugLogLevel.ERROR, e);
+      }
     }
 
     if (stopRegistry)
@@ -513,7 +495,10 @@
       catch (IOException e)
       {
         // TODO Log an error message
-        assert debugException(CLASS_NAME, "finalizeConnectionHandler", e);
+        if (debugEnabled())
+        {
+          debugCought(DebugLogLevel.ERROR, e);
+        }
       }
       registry = null;
     }

--
Gitblit v1.10.0