Author: rdonkin
Date: Tue Sep 15 20:43:35 2009
New Revision: 815477

URL: http://svn.apache.org/viewvc?rev=815477&view=rev
Log:
JAMES-917 Remove Avalon logger from helper interface and replace it's use with 
the commons logging including handler information 
http://issues.apache.org/jira/browse/JAMES-917

Modified:
    
james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/DelegatingJamesHandler.java
    
james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/ProtocolHandlerHelper.java
    
james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/NNTPHandler.java
    
james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Handler.java
    
james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/RemoteManagerHandler.java
    
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandler.java

Modified: 
james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/DelegatingJamesHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/DelegatingJamesHandler.java?rev=815477&r1=815476&r2=815477&view=diff
==============================================================================
--- 
james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/DelegatingJamesHandler.java
 (original)
+++ 
james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/DelegatingJamesHandler.java
 Tue Sep 15 20:43:35 2009
@@ -122,7 +122,6 @@
     private final ProtocolHandler protocolHandler;
     
     private final Log log;
-    private final Logger logger;
     
     public DelegatingJamesHandler(final ProtocolHandler delegated, final 
DNSService dnsServer, final String name, 
             final Logger logger) {
@@ -135,7 +134,6 @@
             this.name = name;
         }
         this.log = new HandlerLog(logger, "[" + name + "] ");
-        this.logger = logger;
     }
 
     /**
@@ -541,13 +539,6 @@
     }
     
     /**
-     * @see org.apache.james.socket.ProtocolHandlerHelper#getAvalonLogger()
-     */
-    public Logger getAvalonLogger() {
-        return logger;
-    }
-
-    /**
      * @see org.apache.james.socket.ProtocolHandlerHelper#getWatchdog()
      */
     public Watchdog getWatchdog() {

Modified: 
james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/ProtocolHandlerHelper.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/ProtocolHandlerHelper.java?rev=815477&r1=815476&r2=815477&view=diff
==============================================================================
--- 
james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/ProtocolHandlerHelper.java
 (original)
+++ 
james/server/trunk/avalon-socket-library/src/main/java/org/apache/james/socket/ProtocolHandlerHelper.java
 Tue Sep 15 20:43:35 2009
@@ -20,14 +20,13 @@
 
 package org.apache.james.socket;
 
-import org.apache.avalon.framework.logger.Logger;
-import org.apache.commons.logging.Log;
-
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.net.Socket;
 
+import org.apache.commons.logging.Log;
+
 /**
  * This is the helper interface provided to ProtocolHandlers to let them
  * communicate with the outside world.
@@ -51,12 +50,6 @@
      * @return the watchdog instance
      */
     public Watchdog getWatchdog();
-    
-    /**
-     * Provides logging facility to the handler.
-     * @return logger instance
-     */
-    public Logger getAvalonLogger();
 
     /**
      * getter for the remote hostname

Modified: 
james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/NNTPHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/NNTPHandler.java?rev=815477&r1=815476&r2=815477&view=diff
==============================================================================
--- 
james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/NNTPHandler.java
 (original)
+++ 
james/server/trunk/nntpserver-function/src/main/java/org/apache/james/nntpserver/NNTPHandler.java
 Tue Sep 15 20:43:35 2009
@@ -289,7 +289,7 @@
         }
         helper.getWatchdog().stop();
 
-        helper.getAvalonLogger().info("Connection closed");
+        helper.getLogger().info("Connection closed");
     }
     
     /**
@@ -341,8 +341,8 @@
         if (commandRaw == null) {
             return false;
         }
-        if (helper.getAvalonLogger().isDebugEnabled()) {
-            helper.getAvalonLogger().debug("Command received: " + commandRaw);
+        if (helper.getLogger().isDebugEnabled()) {
+            helper.getLogger().debug("Command received: " + commandRaw);
         }
 
         String command = commandRaw.trim();
@@ -357,7 +357,7 @@
         boolean returnValue = true;
         if (!isAuthorized(command) ) {
             helper.writeLoggedFlushedResponse("480 User is not authenticated");
-            helper.getAvalonLogger().debug("Command not allowed.");
+            helper.getLogger().debug("Command not allowed.");
             return returnValue;
         }
         if ((command.equals(COMMAND_MODE)) && (argument != null)) {
@@ -428,14 +428,14 @@
      * @param argument the argument passed in with the command
      */
     private void doUnknownCommand(String command, String argument) {
-        if (helper.getAvalonLogger().isDebugEnabled()) {
+        if (helper.getLogger().isDebugEnabled()) {
             StringBuffer logBuffer =
                 new StringBuffer(128)
                     .append("Received unknown command ")
                     .append(command)
                     .append(" with argument ")
                     .append(argument);
-            helper.getAvalonLogger().debug(logBuffer.toString());
+            helper.getLogger().debug(logBuffer.toString());
         }
         helper.writeLoggedFlushedResponse("500 Unknown command");
     }
@@ -525,12 +525,12 @@
                 wildmat = argument.substring(0, spaceIndex);
                 argument = argument.substring(spaceIndex + 1);
             } else {
-                helper.getAvalonLogger().error("NEWNEWS had an invalid 
argument");
+                helper.getLogger().error("NEWNEWS had an invalid argument");
                 helper.writeLoggedFlushedResponse("501 Syntax error");
                 return;
             }
         } else {
-            helper.getAvalonLogger().error("NEWNEWS had a null argument");
+            helper.getLogger().error("NEWNEWS had a null argument");
             helper.writeLoggedFlushedResponse("501 Syntax error");
             return;
         }
@@ -539,7 +539,7 @@
         try {
             theDate = getDateFrom(argument);
         } catch (NNTPException nntpe) {
-            helper.getAvalonLogger().error("NEWNEWS had an invalid argument", 
nntpe);
+            helper.getLogger().error("NEWNEWS had an invalid argument", nntpe);
             helper.writeLoggedFlushedResponse("501 Syntax error");
             return;
         }
@@ -579,7 +579,7 @@
         try {
             theDate = getDateFrom(argument);
         } catch (NNTPException nntpe) {
-            helper.getAvalonLogger().error("NEWGROUPS had an invalid 
argument", nntpe);
+            helper.getLogger().error("NEWGROUPS had an invalid argument", 
nntpe);
             helper.writeLoggedFlushedResponse("501 Syntax error");
             return;
         }

Modified: 
james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Handler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Handler.java?rev=815477&r1=815476&r2=815477&view=diff
==============================================================================
--- 
james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Handler.java
 (original)
+++ 
james/server/trunk/pop3server-function/src/main/java/org/apache/james/pop3server/POP3Handler.java
 Tue Sep 15 20:43:35 2009
@@ -223,12 +223,12 @@
           }
           curCommandName = curCommandName.toUpperCase(Locale.US);
 
-          if (helper.getAvalonLogger().isDebugEnabled()) {
+          if (helper.getLogger().isDebugEnabled()) {
               // Don't display password in logger
               if (!curCommandName.equals("PASS")) {
-                  helper.getAvalonLogger().debug("Command received: " + 
cmdString);
+                  helper.getLogger().debug("Command received: " + cmdString);
               } else {
-                  helper.getAvalonLogger().debug("Command received: PASS 
<password omitted>");
+                  helper.getLogger().debug("Command received: PASS <password 
omitted>");
               }
           }
 
@@ -251,7 +251,7 @@
           }
         }
         helper.getWatchdog().stop();
-        if (helper.getAvalonLogger().isInfoEnabled()) {
+        if (helper.getLogger().isInfoEnabled()) {
             StringBuffer logBuffer =
                 new StringBuffer(128)
                     .append("Connection for ")
@@ -261,7 +261,7 @@
                     .append(" (")
                     .append(helper.getRemoteIP())
                     .append(") closed.");
-            helper.getAvalonLogger().info(logBuffer.toString());
+            helper.getLogger().info(logBuffer.toString());
         }
     }
     

Modified: 
james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/RemoteManagerHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/RemoteManagerHandler.java?rev=815477&r1=815476&r2=815477&view=diff
==============================================================================
--- 
james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/RemoteManagerHandler.java
 (original)
+++ 
james/server/trunk/remotemanager-function/src/main/java/org/apache/james/remotemanager/RemoteManagerHandler.java
 Tue Sep 15 20:43:35 2009
@@ -170,13 +170,13 @@
                     .append(". HELP for a list of commands");
         helper.getOutputWriter().println( messageBuffer.toString() );
         helper.getOutputWriter().flush();
-        if (helper.getAvalonLogger().isInfoEnabled()) {
+        if (helper.getLogger().isInfoEnabled()) {
             StringBuffer infoBuffer =
                 new StringBuffer(128)
                         .append("Login for ")
                         .append(login)
                         .append(" successful");
-            helper.getAvalonLogger().info(infoBuffer.toString());
+            helper.getLogger().info(infoBuffer.toString());
         }
 
         try {
@@ -193,14 +193,14 @@
             //We can cleanly ignore this as it's probably a socket timeout
         } catch (Throwable thr) {
             System.out.println("Exception: " + thr.getMessage());
-            helper.getAvalonLogger().error("Encountered exception in handling 
the remote manager connection.", thr);
+            helper.getLogger().error("Encountered exception in handling the 
remote manager connection.", thr);
         }
         StringBuffer infoBuffer =
             new StringBuffer(64)
                     .append("Logout for ")
                     .append(login)
                     .append(".");
-        helper.getAvalonLogger().info(infoBuffer.toString());
+        helper.getLogger().info(infoBuffer.toString());
 
     }
 
@@ -210,7 +210,7 @@
     public void errorHandler(RuntimeException e) {
         helper.getOutputWriter().println("Unexpected Error: "+e.getMessage());
         helper.getOutputWriter().flush();
-        if (helper.getAvalonLogger().isErrorEnabled()) {
+        if (helper.getLogger().isErrorEnabled()) {
             StringBuffer exceptionBuffer =
                 new StringBuffer(128)
                         .append("Exception during connection from ")
@@ -219,7 +219,7 @@
                         .append(helper.getRemoteIP())
                         .append("): ")
                         .append(e.getMessage());
-            helper.getAvalonLogger().error(exceptionBuffer.toString(),e);
+            helper.getLogger().error(exceptionBuffer.toString(),e);
         }
     }
 
@@ -354,10 +354,10 @@
                         .append(" added");
             String response = responseBuffer.toString();
             helper.getOutputWriter().println(response);
-            helper.getAvalonLogger().info(response);
+            helper.getLogger().info(response);
         } else {
             helper.getOutputWriter().println("Error adding user " + username);
-            helper.getAvalonLogger().error("Error adding user " + username);
+            helper.getLogger().error("Error adding user " + username);
         }
         helper.getOutputWriter().flush();
         return true;
@@ -400,10 +400,10 @@
                         .append(" reset");
             String response = responseBuffer.toString();
             helper.getOutputWriter().println(response);
-            helper.getAvalonLogger().info(response);
+            helper.getLogger().info(response);
         } else {
             helper.getOutputWriter().println("Error resetting password");
-            helper.getAvalonLogger().error("Error resetting password");
+            helper.getLogger().error("Error resetting password");
         }
         helper.getOutputWriter().flush();
         return true;
@@ -431,7 +431,7 @@
                                              .append(" deleted");
                 String response = responseBuffer.toString();
                 helper.getOutputWriter().println(response);
-                helper.getAvalonLogger().info(response);
+                helper.getLogger().info(response);
             } catch (Exception e) {
                 StringBuffer exceptionBuffer =
                                               new StringBuffer(128)
@@ -441,7 +441,7 @@
                                               .append(e.getMessage());
                 String exception = exceptionBuffer.toString();
                 helper.getOutputWriter().println(exception);
-                helper.getAvalonLogger().error(exception);
+                helper.getLogger().error(exception);
             }
         } else {
             StringBuffer responseBuffer =
@@ -643,10 +643,10 @@
                         .append(alias);
             String response = responseBuffer.toString();
             helper.getOutputWriter().println(response);
-            helper.getAvalonLogger().info(response);
+            helper.getLogger().info(response);
         } else {
             helper.getOutputWriter().println("Error setting alias");
-            helper.getAvalonLogger().error("Error setting alias");
+            helper.getLogger().error("Error setting alias");
         }
         helper.getOutputWriter().flush();
         return true;
@@ -704,10 +704,10 @@
                         .append(forwardAddr.toString());
             String response = responseBuffer.toString();
             helper.getOutputWriter().println(response);
-            helper.getAvalonLogger().info(response);
+            helper.getLogger().info(response);
         } else {
             helper.getOutputWriter().println("Error setting forwarding");
-            helper.getAvalonLogger().error("Error setting forwarding");
+            helper.getLogger().error("Error setting forwarding");
         }
         helper.getOutputWriter().flush();
         return true;
@@ -751,7 +751,7 @@
         if ( alias == null || alias.equals("") ) {    //  defensive 
programming -- neither should occur
             String errmsg = "For user " + username + ", the system indicates 
that aliasing is set but no alias was found";
             helper.getOutputWriter().println(errmsg);
-            helper.getAvalonLogger().error(errmsg);
+            helper.getLogger().error(errmsg);
             return true;
         }
 
@@ -796,7 +796,7 @@
         if ( fwdAddr == null ) {    //  defensive programming -- should not 
occur
             String errmsg = "For user " + username + ", the system indicates 
that forwarding is set but no forwarding destination was found";
             helper.getOutputWriter().println(errmsg);
-            helper.getAvalonLogger().error(errmsg);
+            helper.getLogger().error(errmsg);
             return true;
         }
 
@@ -829,7 +829,7 @@
                         .append(" unset");
             String response = responseBuffer.toString();
             helper.getOutputWriter().println(response);
-            helper.getAvalonLogger().info(response);
+            helper.getLogger().info(response);
         } else {
             helper.writeLoggedResponse("Aliasing not active for" + username);
         }
@@ -863,7 +863,7 @@
             String response = responseBuffer.toString();
             helper.getOutputWriter().println(response);
             helper.getOutputWriter().flush();
-            helper.getAvalonLogger().info(response);
+            helper.getLogger().info(response);
         } else {
             helper.writeLoggedFlushedResponse("Forwarding not active for" + 
username);
         }
@@ -947,7 +947,7 @@
         } catch (Exception e) {
             helper.getOutputWriter().println("Error opening the 
spoolrepository " + e.getMessage());
             helper.getOutputWriter().flush();
-            helper.getAvalonLogger().error(
+            helper.getLogger().error(
                     "Error opening the spoolrepository " + e.getMessage());
         }
         return true;
@@ -1000,7 +1000,7 @@
                     .println("Error accessing the spoolrepository "
                             + e.getMessage());
             helper.getOutputWriter().flush();
-            helper.getAvalonLogger().error(
+            helper.getLogger().error(
                     "Error accessing the spoolrepository " + e.getMessage());
         }
         return true;
@@ -1061,7 +1061,7 @@
         } catch (Exception e) {
             helper.getOutputWriter().println("Error opening the 
spoolrepository " + e.getMessage());
             helper.getOutputWriter().flush();
-            helper.getAvalonLogger().error("Error opeing the spoolrepository " 
+ e.getMessage());
+            helper.getLogger().error("Error opeing the spoolrepository " + 
e.getMessage());
         }
         return true;
     }
@@ -1130,7 +1130,7 @@
         } catch (Exception e) {
             helper.getOutputWriter().println("Error opening the 
spoolrepository " + e.getMessage());
             helper.getOutputWriter().flush();
-            helper.getAvalonLogger().error("Error opeing the spoolrepository " 
+ e.getMessage());
+            helper.getLogger().error("Error opeing the spoolrepository " + 
e.getMessage());
         }
         return true;
     }
@@ -1210,7 +1210,7 @@
             helper.getOutputWriter().flush();
         
         } catch (BayesianAnalyzerManagementException e) {
-            helper.getAvalonLogger().error("Error on feeding BayesianAnalysis: 
" + e);
+            helper.getLogger().error("Error on feeding BayesianAnalysis: " + 
e);
             helper.getOutputWriter().println("Error on feeding 
BayesianAnalysis: " + e);
             helper.getOutputWriter().flush();
             return true;
@@ -1258,7 +1258,7 @@
             helper.getOutputWriter().flush();
             
         } catch (BayesianAnalyzerManagementException e) {
-            helper.getAvalonLogger().error("Error on feeding BayesianAnalysis: 
" + e);
+            helper.getLogger().error("Error on feeding BayesianAnalysis: " + 
e);
             helper.getOutputWriter().println("Error on feeding 
BayesianAnalysis: " + e);
             helper.getOutputWriter().flush();
             return true;
@@ -1288,7 +1288,7 @@
             helper.getOutputWriter().flush();
 
         } catch (BayesianAnalyzerManagementException e) {
-            helper.getAvalonLogger().error("Error on exporting 
BayesianAnalysis data: " + e);
+            helper.getLogger().error("Error on exporting BayesianAnalysis 
data: " + e);
             helper.getOutputWriter().println("Error on exporting 
BayesianAnalysis data: " + e);
             helper.getOutputWriter().flush();
             return true;
@@ -1317,7 +1317,7 @@
             helper.getOutputWriter().flush();
 
         } catch (BayesianAnalyzerManagementException e) {
-            helper.getAvalonLogger().error("Error on importing 
BayesianAnalysis data: " + e);
+            helper.getLogger().error("Error on importing BayesianAnalysis 
data: " + e);
             helper.getOutputWriter().println("Error on importing 
BayesianAnalysis data: " + e);
             helper.getOutputWriter().flush();
             return true;
@@ -1339,7 +1339,7 @@
             helper.getOutputWriter().flush();
 
         } catch (BayesianAnalyzerManagementException e) {
-            helper.getAvalonLogger().error("Error on reseting BayesianAnalysis 
data: " + e);
+            helper.getLogger().error("Error on reseting BayesianAnalysis data: 
" + e);
             helper.getOutputWriter().println("Error on reseting 
BayesianAnalysis data: " + e);
             helper.getOutputWriter().flush();
             return true;
@@ -1490,11 +1490,11 @@
             helper.getOutputWriter().println("Adding mapping successful: " + 
mappingAction(args,ADD_MAPPING_ACTION));
             helper.getOutputWriter().flush();
         } catch (VirtualUserTableManagementException e) {
-            helper.getAvalonLogger().error("Error on adding mapping: " + e);
+            helper.getLogger().error("Error on adding mapping: " + e);
             helper.getOutputWriter().println("Error on adding mapping: " + e);
             helper.getOutputWriter().flush();
         } catch (IllegalArgumentException e) {
-            helper.getAvalonLogger().error("Error on adding mapping: " + e);
+            helper.getLogger().error("Error on adding mapping: " + e);
             helper.getOutputWriter().println("Error on adding mapping: " + e);
             helper.getOutputWriter().flush();
         }
@@ -1516,11 +1516,11 @@
             helper.getOutputWriter().println("Removing mapping successful: " + 
mappingAction(args,REMOVE_MAPPING_ACTION));
             helper.getOutputWriter().flush();
         } catch (VirtualUserTableManagementException e) {
-            helper.getAvalonLogger().error("Error on  removing mapping: " + e);
+            helper.getLogger().error("Error on  removing mapping: " + e);
             helper.getOutputWriter().println("Error on removing mapping: " + 
e);
             helper.getOutputWriter().flush();
         } catch (IllegalArgumentException e) {
-            helper.getAvalonLogger().error("Error on removing mapping: " + e);
+            helper.getLogger().error("Error on removing mapping: " + e);
             helper.getOutputWriter().println("Error on removing mapping: " + 
e);
             helper.getOutputWriter().flush();
         }
@@ -1576,11 +1576,11 @@
                 helper.getOutputWriter().flush();
             }
         } catch (VirtualUserTableManagementException e) {
-            helper.getAvalonLogger().error("Error on listing mapping: " + e);
+            helper.getLogger().error("Error on listing mapping: " + e);
             helper.getOutputWriter().println("Error on listing mapping: " + e);
             helper.getOutputWriter().flush();
         } catch (IllegalArgumentException e) {
-            helper.getAvalonLogger().error("Error on listing mapping: " + e);
+            helper.getLogger().error("Error on listing mapping: " + e);
             helper.getOutputWriter().println("Error on listing mapping: " + e);
             helper.getOutputWriter().flush();
         }
@@ -1621,11 +1621,11 @@
                 helper.getOutputWriter().flush();
             }
         } catch (VirtualUserTableManagementException e) {
-            helper.getAvalonLogger().error("Error on listing all mapping: " + 
e);
+            helper.getLogger().error("Error on listing all mapping: " + e);
             helper.getOutputWriter().println("Error on listing all mapping: " 
+ e);
             helper.getOutputWriter().flush();
         } catch (IllegalArgumentException e) {
-            helper.getAvalonLogger().error("Error on listing all mapping: " + 
e);
+            helper.getLogger().error("Error on listing all mapping: " + e);
             helper.getOutputWriter().println("Error on listing all mapping: " 
+ e);
             helper.getOutputWriter().flush();
         }
@@ -1708,7 +1708,7 @@
                 helper.getOutputWriter().flush();
             }
         } catch (DomainListManagementException e) {
-            helper.getAvalonLogger().error("Error on adding domain: " + e);
+            helper.getLogger().error("Error on adding domain: " + e);
             helper.getOutputWriter().println("Error on adding domain: " + e);
             helper.getOutputWriter().flush();
         }
@@ -1731,7 +1731,7 @@
                 helper.getOutputWriter().flush();
             }
         } catch (DomainListManagementException e) {
-            helper.getAvalonLogger().error("Error on removing domain: " + e);
+            helper.getLogger().error("Error on removing domain: " + e);
             helper.getOutputWriter().println("Error on removing domain: " + e);
             helper.getOutputWriter().flush();
         }

Modified: 
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandler.java?rev=815477&r1=815476&r2=815477&view=diff
==============================================================================
--- 
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandler.java
 (original)
+++ 
james/server/trunk/smtpserver-function/src/main/java/org/apache/james/smtpserver/SMTPHandler.java
 Tue Sep 15 20:43:35 2009
@@ -179,7 +179,7 @@
           
         }
         helper.getWatchdog().stop();
-        helper.getAvalonLogger().debug("Closing socket.");
+        helper.getLogger().debug("Closing socket.");
     }
 
     /**



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to