From 1d5d1a6a4a0a58d6bb4803527dacb6641c027816 Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <nicolas.capponi@forgerock.com>
Date: Tue, 28 Jan 2014 13:34:12 +0000
Subject: [PATCH] Checkpoint commit for OPENDJ-1288 :    Migrate I18n and logging support to i18n framework and SLF4J

---
 opendj3-server-dev/src/server/org/opends/server/plugins/SambaPasswordPlugin.java |   49 ++++++++++++++++++++++++-------------------------
 1 files changed, 24 insertions(+), 25 deletions(-)

diff --git a/opendj3-server-dev/src/server/org/opends/server/plugins/SambaPasswordPlugin.java b/opendj3-server-dev/src/server/org/opends/server/plugins/SambaPasswordPlugin.java
index 7bb03ef..3c41411 100644
--- a/opendj3-server-dev/src/server/org/opends/server/plugins/SambaPasswordPlugin.java
+++ b/opendj3-server-dev/src/server/org/opends/server/plugins/SambaPasswordPlugin.java
@@ -56,8 +56,7 @@
 import org.opends.server.core.DirectoryServer;
 import org.opends.server.core.ModifyOperation;
 import org.opends.server.extensions.PasswordModifyExtendedOperation;
-import org.opends.server.loggers.debug.DebugLogger;
-import org.opends.server.loggers.debug.DebugTracer;
+import org.forgerock.i18n.slf4j.LocalizedLogger;
 import org.opends.server.protocols.internal.InternalClientConnection;
 import org.opends.server.protocols.ldap.LDAPFilter;
 import org.opends.server.types.*;
@@ -455,7 +454,7 @@
   /**
    * Debug tracer object to log debugging information.
    */
-  private static final DebugTracer TRACER = DebugLogger.getTracer();
+  private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass();
 
   /**
    * Password Modify Extended Operation OID.
@@ -699,9 +698,9 @@
     {
       if (authDN.equals(sambaAdminDN))
       {
-        if (DebugLogger.debugEnabled())
+        if (logger.isTraceEnabled())
         {
-          TRACER.debugInfo("This operation will be skipped because"
+          logger.trace("This operation will be skipped because"
               + " it was performed by Samba admin user: " + sambaAdminDN);
         }
         return PluginResult.PostOperation.continueOperationProcessing();
@@ -715,9 +714,9 @@
     if (dn == null)
     {
       // The attachment is missing which should never happen.
-      if (DebugLogger.debugEnabled())
+      if (logger.isTraceEnabled())
       {
-        TRACER.debugInfo("SambaPasswordPlugin: missing DN attachment");
+        logger.trace("SambaPasswordPlugin: missing DN attachment");
       }
       return PluginResult.PostOperation.continueOperationProcessing();
     }
@@ -726,9 +725,9 @@
         PasswordModifyExtendedOperation.CLEAR_PWD_ATTACHMENT).toString();
     if (password == null)
     {
-      if (DebugLogger.debugEnabled())
+      if (logger.isTraceEnabled())
       {
-        TRACER.debugInfo("SambaPasswordPlugin: skipping syncing "
+        logger.trace("SambaPasswordPlugin: skipping syncing "
             + "pre-encoded password");
       }
       return PluginResult.PostOperation.continueOperationProcessing();
@@ -744,9 +743,9 @@
       final Entry entry = DirectoryServer.getEntry(dn);
       if (!isSynchronizable(entry))
       {
-        if (DebugLogger.debugEnabled())
+        if (logger.isTraceEnabled())
         {
-          TRACER.debugInfo("The entry is not Samba object.");
+          logger.trace("The entry is not Samba object.");
         }
         return PluginResult.PostOperation.continueOperationProcessing();
       }
@@ -780,9 +779,9 @@
       final ModifyOperation modifyOperation = connection.processModify(dn,
           modifications, controls);
 
-      if (DebugLogger.debugEnabled())
+      if (logger.isTraceEnabled())
       {
-        TRACER.debugInfo(modifyOperation.getResultCode().toString());
+        logger.trace(modifyOperation.getResultCode().toString());
       }
     }
     catch (final DirectoryException e)
@@ -792,9 +791,9 @@
        * This should never happen as we are processing the post-operation which
        * succeeded so the entry has to exist if we have reached this point.
        */
-      if (DebugLogger.debugEnabled())
+      if (logger.isTraceEnabled())
       {
-        TRACER.debugCaught(DebugLogLevel.WARNING, e);
+        logger.traceException(e);
       }
     }
 
@@ -831,9 +830,9 @@
     // Skip synchronization operations.
     if (modifyOperation.isSynchronizationOperation())
     {
-      if (DebugLogger.debugEnabled())
+      if (logger.isTraceEnabled())
       {
-        TRACER.debugInfo("Synchronization operation. Skipping.");
+        logger.trace("Synchronization operation. Skipping.");
       }
       return PluginResult.PreOperation.continueOperationProcessing();
     }
@@ -849,9 +848,9 @@
     {
       if (authDN.equals(sambaAdminDN))
       {
-        if (DebugLogger.debugEnabled())
+        if (logger.isTraceEnabled())
         {
-          TRACER.debugInfo("This operation will be skipped because"
+          logger.trace("This operation will be skipped because"
               + " it was performed by Samba admin user: " + sambaAdminDN);
         }
         return PluginResult.PreOperation.continueOperationProcessing();
@@ -864,9 +863,9 @@
      */
     if (!isSynchronizable(modifyOperation.getCurrentEntry()))
     {
-      if (DebugLogger.debugEnabled())
+      if (logger.isTraceEnabled())
       {
-        TRACER.debugInfo("Skipping '" + modifyOperation.getEntryDN().toString()
+        logger.trace("Skipping '" + modifyOperation.getEntryDN().toString()
             + "' because it does not have Samba object class.");
       }
       return PluginResult.PreOperation.continueOperationProcessing();
@@ -1004,9 +1003,9 @@
     catch (final Exception e)
     {
       ERR_PLUGIN_SAMBA_SYNC_ENCODING.get(e.getMessage());
-      if (DebugLogger.debugEnabled())
+      if (logger.isTraceEnabled())
       {
-        TRACER.debugError(e.getMessage(), e);
+        logger.trace(e.getMessage(), e);
       }
       modifications = null;
     }
@@ -1074,9 +1073,9 @@
     catch (final DirectoryException e)
     {
       ERR_PLUGIN_SAMBA_SYNC_MODIFICATION_PROCESSING.get(e.getMessage());
-      if (DebugLogger.debugEnabled())
+      if (logger.isTraceEnabled())
       {
-        TRACER.debugError(e.getMessage());
+        logger.trace(e.getMessage());
       }
     }
 

--
Gitblit v1.10.0