From 455897cc245b67d929f409a93cfa7106e835cc1f 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. 

---
 opends/src/server/org/opends/server/backends/MemoryBackend.java |   71 ++++++++++++-----------------------
 1 files changed, 25 insertions(+), 46 deletions(-)

diff --git a/opends/src/server/org/opends/server/backends/MemoryBackend.java b/opends/src/server/org/opends/server/backends/MemoryBackend.java
index 67f6399..bf94ed2 100644
--- a/opends/src/server/org/opends/server/backends/MemoryBackend.java
+++ b/opends/src/server/org/opends/server/backends/MemoryBackend.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Portions Copyright 2006 Sun Microsystems, Inc.
+ *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
  */
 package org.opends.server.backends;
 
@@ -59,7 +59,9 @@
 import org.opends.server.util.LDIFReader;
 import org.opends.server.util.LDIFWriter;
 
-import static org.opends.server.loggers.Debug.*;
+import static org.opends.server.loggers.debug.DebugLogger.debugCought;
+import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
+import org.opends.server.types.DebugLogLevel;
 import static org.opends.server.messages.BackendMessages.*;
 import static org.opends.server.messages.MessageHandler.*;
 import static org.opends.server.util.ServerConstants.*;
@@ -100,11 +102,6 @@
 public class MemoryBackend
        extends Backend
 {
-  /**
-   * The fully-qualified name of this class for debugging purposes.
-   */
-  private static final String CLASS_NAME =
-       "org.opends.server.backends.MemoryBackend";
 
 
 
@@ -137,7 +134,6 @@
   {
     super();
 
-    assert debugConstructor(CLASS_NAME);
 
 
     // Perform all initialization in initializeBackend.
@@ -152,8 +148,6 @@
                                              DN[] baseDNs)
          throws ConfigException, InitializationException
   {
-    assert debugEnter(CLASS_NAME, "initializeBackend",
-                      String.valueOf(configEntry), String.valueOf(baseDNs));
 
 
     // We won't support anything other than exactly one base DN in this
@@ -192,7 +186,10 @@
       }
       catch (Exception e)
       {
-        assert debugException(CLASS_NAME, "initializeBackend", e);
+        if (debugEnabled())
+        {
+          debugCought(DebugLogLevel.ERROR, e);
+        }
 
         int msgID = MSGID_BACKEND_CANNOT_REGISTER_BASEDN;
         String message = getMessage(msgID, dn.toString(),
@@ -220,7 +217,6 @@
    */
   public synchronized void finalizeBackend()
   {
-    assert debugEnter(CLASS_NAME, "finalizeBackend");
 
     clearMemoryBackend();
 
@@ -232,7 +228,10 @@
       }
       catch (Exception e)
       {
-        assert debugException(CLASS_NAME, "finalizeBackend", e);
+        if (debugEnabled())
+        {
+          debugCought(DebugLogLevel.ERROR, e);
+        }
       }
     }
   }
@@ -244,7 +243,6 @@
    */
   public DN[] getBaseDNs()
   {
-    assert debugEnter(CLASS_NAME, "getBaseDNs");
 
     return baseDNs;
   }
@@ -256,7 +254,6 @@
    */
   public synchronized long getEntryCount()
   {
-    assert debugEnter(CLASS_NAME, "getEntryCount");
 
     if (entryMap != null)
     {
@@ -273,7 +270,6 @@
    */
   public boolean isLocal()
   {
-    assert debugEnter(CLASS_NAME, "isLocal");
 
     // For the purposes of this method, this is a local backend.
     return true;
@@ -286,7 +282,6 @@
    */
   public synchronized Entry getEntry(DN entryDN)
   {
-    assert debugEnter(CLASS_NAME, "getEntry", String.valueOf(entryDN));
 
     return entryMap.get(entryDN);
   }
@@ -298,7 +293,6 @@
    */
   public synchronized boolean entryExists(DN entryDN)
   {
-    assert debugEnter(CLASS_NAME, "entryExists", String.valueOf(entryDN));
 
     return entryMap.containsKey(entryDN);
   }
@@ -311,8 +305,6 @@
   public synchronized void addEntry(Entry entry, AddOperation addOperation)
          throws DirectoryException
   {
-    assert debugEnter(CLASS_NAME, "addEntry", String.valueOf(entry),
-                      String.valueOf(addOperation));
 
 
     // See if the target entry already exists.  If so, then fail.
@@ -370,8 +362,6 @@
                                        DeleteOperation deleteOperation)
          throws DirectoryException
   {
-    assert debugEnter(CLASS_NAME, "deleteEntry", String.valueOf(entryDN),
-                      String.valueOf(deleteOperation));
 
 
     // Make sure the entry exists.  If not, then throw an exception.
@@ -412,7 +402,10 @@
           {
             // This shouldn't happen, but we want the delete to continue anyway
             // so just ignore it if it does for some reason.
-            assert debugException(CLASS_NAME, "deleteEntry", e);
+            if (debugEnabled())
+            {
+              debugCought(DebugLogLevel.ERROR, e);
+            }
           }
         }
       }
@@ -460,8 +453,6 @@
                                         ModifyOperation modifyOperation)
          throws DirectoryException
   {
-    assert debugEnter(CLASS_NAME, "replaceEntry", String.valueOf(entry),
-                      String.valueOf(modifyOperation));
 
 
     // Make sure the entry exists.  If not, then throw an exception.
@@ -487,8 +478,6 @@
                                        ModifyDNOperation modifyDNOperation)
          throws DirectoryException
   {
-    assert debugEnter(CLASS_NAME, "renameEntry", String.valueOf(currentDN),
-                      String.valueOf(entry), String.valueOf(modifyDNOperation));
 
 
     // Make sure that the target entry exists.
@@ -572,7 +561,6 @@
   public synchronized void search(SearchOperation searchOperation)
          throws DirectoryException
   {
-    assert debugEnter(CLASS_NAME, "search", String.valueOf(searchOperation));
 
 
     // Get the base DN, scope, and filter for the search.
@@ -618,7 +606,6 @@
    */
   public HashSet<String> getSupportedControls()
   {
-    assert debugEnter(CLASS_NAME, "getSupportedControls");
 
     return supportedControls;
   }
@@ -630,7 +617,6 @@
    */
   public HashSet<String> getSupportedFeatures()
   {
-    assert debugEnter(CLASS_NAME, "getSupportedFeatures");
 
     return supportedFeatures;
   }
@@ -642,7 +628,6 @@
    */
   public boolean supportsLDIFExport()
   {
-    assert debugEnter(CLASS_NAME, "supportsLDIFExport");
 
     return true;
   }
@@ -656,7 +641,6 @@
                                       LDIFExportConfig exportConfig)
          throws DirectoryException
   {
-    assert debugEnter(CLASS_NAME, "exportLDIF", String.valueOf(exportConfig));
 
 
     // Create the LDIF writer.
@@ -667,9 +651,12 @@
     }
     catch (Exception e)
     {
-      assert debugException(CLASS_NAME, "exportLDIF", e);
+      if (debugEnabled())
+      {
+        debugCought(DebugLogLevel.ERROR, e);
+      }
 
-      int    msgID   = MSGID_MEMORYBACKEND_CANNOT_CREATE_LDIF_WRITER;
+      int msgID = MSGID_MEMORYBACKEND_CANNOT_CREATE_LDIF_WRITER;
       String message = getMessage(msgID, String.valueOf(e));
       throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
                                    message, msgID, e);
@@ -702,7 +689,10 @@
       }
       catch (Exception e)
       {
-        assert debugException(CLASS_NAME, "exportLDIF", e);
+        if (debugEnabled())
+        {
+          debugCought(DebugLogLevel.ERROR, e);
+        }
       }
     }
   }
@@ -714,7 +704,6 @@
    */
   public boolean supportsLDIFImport()
   {
-    assert debugEnter(CLASS_NAME, "supportsLDIFImport");
 
     return true;
   }
@@ -728,7 +717,6 @@
                                       LDIFImportConfig importConfig)
          throws DirectoryException
   {
-    assert debugEnter(CLASS_NAME, "importLDIF", String.valueOf(importConfig));
 
 
     clearMemoryBackend();
@@ -810,7 +798,6 @@
    */
   public boolean supportsBackup()
   {
-    assert debugEnter(CLASS_NAME, "supportsBackup");
 
     // This backend does not provide a backup/restore mechanism.
     return false;
@@ -824,7 +811,6 @@
   public boolean supportsBackup(BackupConfig backupConfig,
                                 StringBuilder unsupportedReason)
   {
-    assert debugEnter(CLASS_NAME, "supportsBackup");
 
 
     // This backend does not provide a backup/restore mechanism.
@@ -839,7 +825,6 @@
   public void createBackup(ConfigEntry configEntry, BackupConfig backupConfig)
          throws DirectoryException
   {
-    assert debugEnter(CLASS_NAME, "createBackup", String.valueOf(backupConfig));
 
 
     int    msgID   = MSGID_MEMORYBACKEND_BACKUP_RESTORE_NOT_SUPPORTED;
@@ -857,9 +842,6 @@
                            String backupID)
          throws DirectoryException
   {
-    assert debugEnter(CLASS_NAME, "removeBackup",
-                      String.valueOf(backupDirectory),
-                      String.valueOf(backupID));
 
 
     int    msgID   = MSGID_MEMORYBACKEND_BACKUP_RESTORE_NOT_SUPPORTED;
@@ -875,7 +857,6 @@
    */
   public boolean supportsRestore()
   {
-    assert debugEnter(CLASS_NAME, "supportsRestore");
 
 
     // This backend does not provide a backup/restore mechanism.
@@ -891,8 +872,6 @@
                             RestoreConfig restoreConfig)
          throws DirectoryException
   {
-    assert debugEnter(CLASS_NAME, "restoreBackup",
-                      String.valueOf(restoreConfig));
 
 
     int    msgID   = MSGID_MEMORYBACKEND_BACKUP_RESTORE_NOT_SUPPORTED;

--
Gitblit v1.10.0