james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b...@apache.org
Subject svn commit: r382444 - in /james/server/trunk/src: java/org/apache/james/ java/org/apache/james/core/ java/org/apache/james/fetchmail/ java/org/apache/james/mailrepository/ java/org/apache/james/pop3server/ java/org/apache/james/remotemanager/ java/org/...
Date Thu, 02 Mar 2006 16:56:37 GMT
Author: bago
Date: Thu Mar  2 08:56:32 2006
New Revision: 382444

URL: http://svn.apache.org/viewcvs?rev=382444&view=rev
Log:
Add GenericMailet.getInitParameter(name,default) (JAMES-438).
Also refactored bundled Mailets to use this new method.
Added ROLE to default james services and replaced lookup("hardcodedstring") with lookup (Service.ROLE) in the whole codebase to improve code/dependency browsing.
Fixed newline issue in RemoteManagerTest (to be verified)

Modified:
    james/server/trunk/src/java/org/apache/james/James.java
    james/server/trunk/src/java/org/apache/james/core/LocalUsersRepository.java
    james/server/trunk/src/java/org/apache/james/fetchmail/FetchMail.java
    james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java
    james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
    james/server/trunk/src/java/org/apache/james/mailrepository/MailStoreSpoolRepository.java
    james/server/trunk/src/java/org/apache/james/pop3server/POP3Server.java
    james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java
    james/server/trunk/src/java/org/apache/james/services/MailRepository.java
    james/server/trunk/src/java/org/apache/james/services/MailetLoader.java
    james/server/trunk/src/java/org/apache/james/services/MatcherLoader.java
    james/server/trunk/src/java/org/apache/james/services/SpoolRepository.java
    james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java
    james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractNotify.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/AvalonListserv.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/AvalonListservManager.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/BayesianAnalysis.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservManager.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservProcessor.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/Forward.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/FromRepository.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/NotifySender.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/Redirect.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/RemoveAllMailAttributes.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/Resend.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/ServerTime.java
    james/server/trunk/src/java/org/apache/james/transport/mailets/ToRepository.java
    james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java
    james/server/trunk/src/java/org/apache/mailet/GenericMailet.java
    james/server/trunk/src/test/org/apache/james/JamesTest.java
    james/server/trunk/src/test/org/apache/james/pop3server/POP3ServerTest.java
    james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTest.java
    james/server/trunk/src/test/org/apache/james/smtpserver/SMTPServerTest.java
    james/server/trunk/src/test/org/apache/james/test/mock/javaxmail/MockMimeMessage.java

Modified: james/server/trunk/src/java/org/apache/james/James.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/James.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/James.java (original)
+++ james/server/trunk/src/java/org/apache/james/James.java Thu Mar  2 08:56:32 2006
@@ -216,7 +216,7 @@
         // TODO: This should retrieve a more specific named thread pool from
         // Context that is set up in server.xml
         try {
-            store = (Store) compMgr.lookup( "org.apache.avalon.cornerstone.services.store.Store" );
+            store = (Store) compMgr.lookup( Store.ROLE );
         } catch (Exception e) {
             if (getLogger().isWarnEnabled()) {
                 getLogger().warn("Can't get Store: " + e);
@@ -226,7 +226,7 @@
             getLogger().debug("Using Store: " + store.toString());
         }
         try {
-            spool = (SpoolRepository) compMgr.lookup( "org.apache.james.services.SpoolRepository" );
+            spool = (SpoolRepository) compMgr.lookup( SpoolRepository.ROLE );
         } catch (Exception e) {
             if (getLogger().isWarnEnabled()) {
                 getLogger().warn("Can't get spoolRepository: " + e);

Modified: james/server/trunk/src/java/org/apache/james/core/LocalUsersRepository.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/core/LocalUsersRepository.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/core/LocalUsersRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/core/LocalUsersRepository.java Thu Mar  2 08:56:32 2006
@@ -34,7 +34,7 @@
 
     public void service(ServiceManager serviceManager) throws ServiceException {
         usersStore =
-           (UsersStore) serviceManager.lookup("org.apache.james.services.UsersStore");
+           (UsersStore) serviceManager.lookup(UsersStore.ROLE);
     }
 
     public void initialize() throws Exception {

Modified: james/server/trunk/src/java/org/apache/james/fetchmail/FetchMail.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/fetchmail/FetchMail.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/fetchmail/FetchMail.java (original)
+++ james/server/trunk/src/java/org/apache/james/fetchmail/FetchMail.java Thu Mar  2 08:56:32 2006
@@ -596,7 +596,7 @@
         }
 
         UsersRepository usersRepository =
-            (UsersRepository) manager.lookup("org.apache.james.services.UsersRepository");
+            (UsersRepository) manager.lookup(UsersRepository.ROLE);
         setLocalUsers(usersRepository);
     }
 

Modified: james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/mailrepository/AvalonMailRepository.java Thu Mar  2 08:56:32 2006
@@ -80,8 +80,7 @@
      */
     public void service( final ServiceManager componentManager )
             throws ServiceException {
-        store = (Store)componentManager.
-        lookup( "org.apache.avalon.cornerstone.services.store.Store" );
+        store = (Store)componentManager.lookup( Store.ROLE );
     }
 
     /**

Modified: james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/mailrepository/JDBCMailRepository.java Thu Mar  2 08:56:32 2006
@@ -262,8 +262,7 @@
         }
         try {
             if (filestore != null) {
-                Store store = (Store)componentManager.
-                        lookup("org.apache.avalon.cornerstone.services.store.Store");
+                Store store = (Store)componentManager.lookup(Store.ROLE);
                 //prepare Configurations for stream repositories
                 DefaultConfiguration streamConfiguration
                     = new DefaultConfiguration( "repository",

Modified: james/server/trunk/src/java/org/apache/james/mailrepository/MailStoreSpoolRepository.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/mailrepository/MailStoreSpoolRepository.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/mailrepository/MailStoreSpoolRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/mailrepository/MailStoreSpoolRepository.java Thu Mar  2 08:56:32 2006
@@ -69,7 +69,7 @@
      * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
      */
     public void service(ServiceManager serviceManager) throws ServiceException {
-        mailStore = (Store) serviceManager.lookup("org.apache.avalon.cornerstone.services.store.Store");
+        mailStore = (Store) serviceManager.lookup(Store.ROLE);
     }
 
 

Modified: james/server/trunk/src/java/org/apache/james/pop3server/POP3Server.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/pop3server/POP3Server.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/pop3server/POP3Server.java (original)
+++ james/server/trunk/src/java/org/apache/james/pop3server/POP3Server.java Thu Mar  2 08:56:32 2006
@@ -89,10 +89,8 @@
     public void service( final ServiceManager componentManager )
         throws ServiceException {
         super.service(componentManager);
-        mailServer = (MailServer)componentManager.
-            lookup( "org.apache.james.services.MailServer" );
-        users = (UsersRepository)componentManager.
-            lookup( "org.apache.james.services.UsersRepository" );
+        mailServer = (MailServer)componentManager.lookup( MailServer.ROLE );
+        users = (UsersRepository)componentManager.lookup( UsersRepository.ROLE );
     }
 
     /**

Modified: james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java (original)
+++ james/server/trunk/src/java/org/apache/james/remotemanager/RemoteManager.java Thu Mar  2 08:56:32 2006
@@ -103,9 +103,9 @@
         throws ServiceException {
         super.service(componentManager);
         mailServer = (MailServer)componentManager.
-            lookup( "org.apache.james.services.MailServer" );
+            lookup( MailServer.ROLE );
         usersStore = (UsersStore)componentManager.
-            lookup( "org.apache.james.services.UsersStore" );
+            lookup( UsersStore.ROLE );
         users = (UsersRepository) componentManager.lookup(UsersRepository.ROLE);
         if (users == null) {
             throw new ServiceException("","The user repository could not be found.");

Modified: james/server/trunk/src/java/org/apache/james/services/MailRepository.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/services/MailRepository.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/services/MailRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/services/MailRepository.java Thu Mar  2 08:56:32 2006
@@ -31,6 +31,11 @@
 public interface MailRepository {
 
     /**
+     * The component role used by components implementing this service
+     */
+    String ROLE = "org.apache.james.services.MailRepository";
+    
+    /**
      * Define a MAIL repository. MAILS are stored in the specified
      * destination.
      */

Modified: james/server/trunk/src/java/org/apache/james/services/MailetLoader.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/services/MailetLoader.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/services/MailetLoader.java (original)
+++ james/server/trunk/src/java/org/apache/james/services/MailetLoader.java Thu Mar  2 08:56:32 2006
@@ -25,6 +25,11 @@
 public interface MailetLoader {
 
     /**
+     * The component role used by components implementing this service
+     */
+    String ROLE = "org.apache.james.services.MailetLoader";
+
+    /**
      * Get a new Mailet with the specified name acting
      * in the specified context.
      *

Modified: james/server/trunk/src/java/org/apache/james/services/MatcherLoader.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/services/MatcherLoader.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/services/MatcherLoader.java (original)
+++ james/server/trunk/src/java/org/apache/james/services/MatcherLoader.java Thu Mar  2 08:56:32 2006
@@ -24,6 +24,11 @@
 public interface MatcherLoader {
 
     /**
+     * The component role used by components implementing this service
+     */
+    String ROLE = "org.apache.james.services.MatcherLoader";
+
+    /**
      * Get a new Matcher with the specified name acting
      * in the specified context.
      *

Modified: james/server/trunk/src/java/org/apache/james/services/SpoolRepository.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/services/SpoolRepository.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/services/SpoolRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/services/SpoolRepository.java Thu Mar  2 08:56:32 2006
@@ -30,6 +30,11 @@
     extends MailRepository {
 
     /**
+     * The component role used by components implementing this service
+     */
+    String ROLE = "org.apache.james.services.SpoolRepository";
+
+    /**
      * Implementations of AcceptFilter can be used to select which mails a SpoolRepository
      * implementation returns from its accept (AcceptFilter) method
      **/

Modified: james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java (original)
+++ james/server/trunk/src/java/org/apache/james/smtpserver/SMTPServer.java Thu Mar  2 08:56:32 2006
@@ -138,8 +138,8 @@
     public void service( final ServiceManager manager ) throws ServiceException {
         super.service( manager );
         mailetcontext = (MailetContext) manager.lookup("org.apache.mailet.MailetContext");
-        mailServer = (MailServer) manager.lookup("org.apache.james.services.MailServer");
-        users = (UsersRepository) manager.lookup("org.apache.james.services.UsersRepository");
+        mailServer = (MailServer) manager.lookup(MailServer.ROLE);
+        users = (UsersRepository) manager.lookup(UsersRepository.ROLE);
     }
 
     /**

Modified: james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/JamesSpoolManager.java Thu Mar  2 08:56:32 2006
@@ -132,12 +132,12 @@
     public void initialize() throws Exception {
 
         getLogger().info("JamesSpoolManager init...");
-        spool = (SpoolRepository) compMgr.lookup("org.apache.james.services.SpoolRepository");
+        spool = (SpoolRepository) compMgr.lookup(SpoolRepository.ROLE);
 
         MailetLoader mailetLoader
-        = (MailetLoader) compMgr.lookup("org.apache.james.services.MailetLoader");
+        = (MailetLoader) compMgr.lookup(MailetLoader.ROLE);
         MatcherLoader matchLoader
-        = (MatcherLoader) compMgr.lookup("org.apache.james.services.MatcherLoader");
+        = (MatcherLoader) compMgr.lookup(MatcherLoader.ROLE);
 
         //A processor is a Collection of
         processors = new HashMap();

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractNotify.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractNotify.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractNotify.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractNotify.java Thu Mar  2 08:56:32 2006
@@ -18,25 +18,14 @@
 package org.apache.james.transport.mailets;
 
 import org.apache.mailet.RFC2822Headers;
-import org.apache.mailet.GenericMailet;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
-import org.apache.mailet.MailetException;
 
-import javax.mail.Address;
-import javax.mail.Message;
 import javax.mail.MessagingException;
-import javax.mail.Session;
 import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
-import java.util.Date;
-import java.util.HashSet;
-import java.util.Set;
 import java.util.Collection;
 import java.util.Iterator;
 
@@ -88,33 +77,21 @@
      * @return the <CODE>passThrough</CODE> init parameter, or true if missing
      */
     protected boolean getPassThrough() throws MessagingException {
-        if(getInitParameter("passThrough") == null) {
-            return true;
-        } else {
-            return new Boolean(getInitParameter("passThrough")).booleanValue();
-        }
+        return new Boolean(getInitParameter("passThrough","true")).booleanValue();
     }
 
     /**
      * @return the <CODE>inline</CODE> init parameter, or <CODE>NONE</CODE> if missing
      */
     protected int getInLineType() throws MessagingException {
-        if(getInitParameter("inline") == null) {
-            return NONE;
-        } else {
-            return getTypeCode(getInitParameter("inline"));
-        }
+        return getTypeCode(getInitParameter("inline","none"));
     }
 
     /**
      * @return the <CODE>attachment</CODE> init parameter, or <CODE>MESSAGE</CODE> if missing
      */
     protected int getAttachmentType() throws MessagingException {
-        if(getInitParameter("attachment") == null) {
-            return MESSAGE;
-        } else {
-            return getTypeCode(getInitParameter("attachment"));
-        }
+        return getTypeCode(getInitParameter("attachment","message"));
     }
 
     /**
@@ -123,15 +100,9 @@
      * or a default string if both are missing
      */
     protected String getMessage() {
-        if(getInitParameter("notice") == null) {
-            if(getInitParameter("message") == null) {
-                return "We were unable to deliver the attached message because of an error in the mail server.";
-            } else {
-                return getInitParameter("message");
-            }
-        } else {
-            return getInitParameter("notice");
-        }
+        return getInitParameter("notice",
+                getInitParameter("message",
+                "We were unable to deliver the attached message because of an error in the mail server."));
     }
 
     /**
@@ -235,13 +206,10 @@
      * and <CODE>SpecialAddress.UNALTERED</CODE>
      */
     protected MailAddress getSender() throws MessagingException {
-        String addressString = getInitParameter("sendingAddress");
+        String addressString = getInitParameter("sendingAddress",getInitParameter("sender"));
         
         if (addressString == null) {
-            addressString = getInitParameter("sender");
-            if (addressString == null) {
-                return getMailetContext().getPostmaster();
-            }
+            return getMailetContext().getPostmaster();
         }
         
         MailAddress specialAddress = getSpecialAddress(addressString,
@@ -268,11 +236,7 @@
      * @return the <CODE>prefix</CODE> init parameter or "Re:" if missing
      */
     protected String getSubjectPrefix() {
-        if(getInitParameter("prefix") == null) {
-            return "Re:";
-        } else {
-            return getInitParameter("prefix");
-        }
+        return getInitParameter("prefix","Re:");
     }
 
     /**

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/AbstractRedirect.java Thu Mar  2 08:56:32 2006
@@ -266,8 +266,7 @@
      * @return {@link #getPassThrough()}
      */
     protected boolean getPassThrough(Mail originalMail) throws MessagingException {
-        boolean passThrough = (isStatic()) ? this.passThrough : getPassThrough();
-        return passThrough;
+        return (isStatic()) ? this.passThrough : getPassThrough();
     }
 
     /**
@@ -289,8 +288,7 @@
      * @return {@link #getFakeDomainCheck()}
      */
     protected boolean getFakeDomainCheck(Mail originalMail) throws MessagingException {
-        boolean fakeDomainCheck = (isStatic()) ? this.fakeDomainCheck : getFakeDomainCheck();
-        return fakeDomainCheck;
+        return (isStatic()) ? this.fakeDomainCheck : getFakeDomainCheck();
     }
 
     /**
@@ -309,11 +307,7 @@
      * @return the <CODE>inline</CODE> init parameter, or <CODE>UNALTERED</CODE> if missing
      */
     protected int getInLineType() throws MessagingException {
-        if(getInitParameter("inline") == null) {
-            return UNALTERED;
-        } else {
-            return getTypeCode(getInitParameter("inline"));
-        }
+        return getTypeCode(getInitParameter("inline","unaltered"));
     }
     
     /**
@@ -324,8 +318,7 @@
      * @return {@link #getInLineType()}
      */
     protected int getInLineType(Mail originalMail) throws MessagingException {
-        int inLineType = (isStatic()) ? this.inLineType : getInLineType();
-        return inLineType;
+        return (isStatic()) ? this.inLineType : getInLineType();
     }
 
     /** Gets the <CODE>attachment</CODE> property.
@@ -343,11 +336,7 @@
      * @return the <CODE>attachment</CODE> init parameter, or <CODE>NONE</CODE> if missing
      */
     protected int getAttachmentType() throws MessagingException {
-        if(getInitParameter("attachment") == null) {
-            return NONE;
-        } else {
-            return getTypeCode(getInitParameter("attachment"));
-        }
+        return getTypeCode(getInitParameter("attachment","none"));
     }
 
     /**
@@ -358,8 +347,7 @@
      * @return {@link #getAttachmentType()}
      */
     protected int getAttachmentType(Mail originalMail) throws MessagingException {
-        int attachmentType = (isStatic()) ? this.attachmentType : getAttachmentType();
-        return attachmentType;
+        return (isStatic()) ? this.attachmentType : getAttachmentType();
     }
 
     /**
@@ -371,11 +359,7 @@
      * @return the <CODE>message</CODE> init parameter or an empty string if missing
      */
     protected String getMessage() throws MessagingException {
-        if(getInitParameter("message") == null) {
-            return "";
-        } else {
-            return getInitParameter("message");
-        }
+        return getInitParameter("message","");
     }
 
     /**
@@ -386,8 +370,7 @@
      * @return {@link #getMessage()}
      */
     protected String getMessage(Mail originalMail) throws MessagingException {
-        String messageText = (isStatic()) ? this.messageText : getMessage();
-        return messageText;
+        return (isStatic()) ? this.messageText : getMessage();
     }
 
     /**
@@ -575,10 +558,8 @@
      * or <CODE>null</CODE> if missing
      */
     protected MailAddress getReplyTo() throws MessagingException {
-        String addressString = getInitParameter("replyTo");
-        if (addressString == null) {
-            addressString = getInitParameter("replyto");
-        }
+        String addressString = getInitParameter("replyTo",getInitParameter("replyto"));
+
         if(addressString != null) {
             MailAddress specialAddress = getSpecialAddress(addressString,
                                             new String[] {"postmaster", "sender", "null", "unaltered"});
@@ -788,11 +769,7 @@
      * @return the <CODE>subject</CODE> init parameter or null if missing
      */
     protected String getSubject() throws MessagingException {
-        if(getInitParameter("subject") == null) {
-            return null;
-        } else {
-            return getInitParameter("subject");
-        }
+        return getInitParameter("subject");
     }
 
     /**
@@ -803,8 +780,7 @@
      * @return {@link #getSubject()}
      */
     protected String getSubject(Mail originalMail) throws MessagingException {
-        String subject = (isStatic()) ? this.subject : getSubject();
-        return subject;
+        return (isStatic()) ? this.subject : getSubject();
     }
 
     /**
@@ -815,11 +791,7 @@
      * @return the <CODE>prefix</CODE> init parameter or an empty string if missing
      */
     protected String getSubjectPrefix() throws MessagingException {
-        if(getInitParameter("prefix") == null) {
-            return null;
-        } else {
-            return getInitParameter("prefix");
-        }
+        return getInitParameter("prefix");
     }
 
     /**
@@ -830,8 +802,7 @@
      * @return {@link #getSubjectPrefix()}
      */
     protected String getSubjectPrefix(Mail originalMail) throws MessagingException {
-        String subjectPrefix = (isStatic()) ? this.subjectPrefix : getSubjectPrefix();
-        return subjectPrefix;
+        return (isStatic()) ? this.subjectPrefix : getSubjectPrefix();
     }
 
     /**
@@ -887,8 +858,7 @@
      * @return {@link #attachError()}
      */
     protected boolean attachError(Mail originalMail) throws MessagingException {
-        boolean attachError = (isStatic()) ? this.attachError : attachError();
-        return attachError;
+        return (isStatic()) ? this.attachError : attachError();
     }
 
     /**
@@ -912,8 +882,7 @@
      * @return {@link #isReply()}
      */
     protected boolean isReply(Mail originalMail) throws MessagingException {
-        boolean isReply = (isStatic()) ? this.isReply : isReply();
-        return isReply;
+        return (isStatic()) ? this.isReply : isReply();
     }
 
     /**
@@ -942,9 +911,9 @@
      * using getX(), if {@link #isStatic()} returns true.
      */
     public void init() throws MessagingException {
-        isDebug = (getInitParameter("debug") == null) ? false : new Boolean(getInitParameter("debug")).booleanValue();
+        isDebug = new Boolean(getInitParameter("debug","false")).booleanValue();
 
-        isStatic = (getInitParameter("static") == null) ? false : new Boolean(getInitParameter("static")).booleanValue();
+        isStatic = new Boolean(getInitParameter("static","false")).booleanValue();
 
         if (isDebug) {
             log("Initializing");

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/AvalonListserv.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/AvalonListserv.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/AvalonListserv.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/AvalonListserv.java Thu Mar  2 08:56:32 2006
@@ -125,7 +125,7 @@
 
         ServiceManager compMgr = (ServiceManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
         try {
-            UsersStore usersStore = (UsersStore)compMgr.lookup("org.apache.james.services.UsersStore");
+            UsersStore usersStore = (UsersStore)compMgr.lookup(UsersStore.ROLE);
             String repName = getInitParameter("repositoryName");
 
             members = (UsersRepository)usersStore.getRepository( repName );

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/AvalonListservManager.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/AvalonListservManager.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/AvalonListservManager.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/AvalonListservManager.java Thu Mar  2 08:56:32 2006
@@ -44,7 +44,7 @@
     public void init() {
         ServiceManager compMgr = (ServiceManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
         try {
-            UsersStore usersStore = (UsersStore) compMgr.lookup("org.apache.james.services.UsersStore");
+            UsersStore usersStore = (UsersStore) compMgr.lookup(UsersStore.ROLE);
             String repName = getInitParameter("repositoryName");
 
             members = (UsersRepository) usersStore.getRepository(repName);

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/BayesianAnalysis.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/BayesianAnalysis.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/BayesianAnalysis.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/BayesianAnalysis.java Thu Mar  2 08:56:32 2006
@@ -204,10 +204,7 @@
             throw new MessagingException("repositoryPath is null");
         }
         
-        headerName = getInitParameter("headerName");
-        if (headerName == null) {
-            headerName = HEADER_NAME;
-        }
+        headerName = getInitParameter("headerName",HEADER_NAME);
         
         ignoreLocalSender = Boolean.valueOf(getInitParameter("ignoreLocalSender")).booleanValue();
         

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/BayesianAnalysisFeeder.java Thu Mar  2 08:56:32 2006
@@ -319,20 +319,4 @@
         message.saveChanges();
     }
     
-    private String getInitParameter(String name, String toLog) {
-        String value = getInitParameter(name);
-        if (value != null) {
-            value = value.trim();
-            if (toLog == null) {
-                log(name + ": " + value);
-            }
-            else {
-                log(name + ": " + toLog);
-            }
-        }
-        else {
-            log(name + " is null");
-        }
-        return value;
-    }
 }

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservManager.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservManager.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservManager.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservManager.java Thu Mar  2 08:56:32 2006
@@ -330,7 +330,7 @@
     protected void initUsersRepository() {
         ServiceManager compMgr = (ServiceManager) getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
         try {
-            UsersStore usersStore = (UsersStore) compMgr.lookup("org.apache.james.services.UsersStore");
+            UsersStore usersStore = (UsersStore) compMgr.lookup(UsersStore.ROLE);
             String repName = getInitParameter("repositoryName");
 
             usersRepository = usersStore.getRepository(repName);

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservProcessor.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservProcessor.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservProcessor.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/CommandListservProcessor.java Thu Mar  2 08:56:32 2006
@@ -408,7 +408,7 @@
      */
     protected void initUsersRepository() throws Exception {
         ServiceManager compMgr = (ServiceManager) getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
-        UsersStore usersStore = (UsersStore) compMgr.lookup("org.apache.james.services.UsersStore");
+        UsersStore usersStore = (UsersStore) compMgr.lookup(UsersStore.ROLE);
         String repName = getInitParameter("repositoryName");
 
         usersRepository = usersStore.getRepository(repName);

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/DSNBounce.java Thu Mar  2 08:56:32 2006
@@ -99,8 +99,7 @@
 
     private static final String MACHINE_PATTERN = "[machine]";
 
-    private String messageString =
-        "Hi. This is the James mail server at [machine].\nI'm afraid I wasn't able to deliver your message to the following addresses.\nThis is a permanent error; I've given up. Sorry it didn't work out.  Below\nI include the list of recipients and the reason why I was unable to deliver\nyour message.\n";
+    private String messageString = null;
 
     /*
      * Static initializer.<p>
@@ -132,9 +131,7 @@
      */
     public void init() throws MessagingException {
         super.init();
-        if (getInitParameter("messageString") != null) {
-            messageString = getInitParameter("messageString");
-        }
+        messageString = getInitParameter("messageString","Hi. This is the James mail server at [machine].\nI'm afraid I wasn't able to deliver your message to the following addresses.\nThis is a permanent error; I've given up. Sorry it didn't work out.  Below\nI include the list of recipients and the reason why I was unable to deliver\nyour message.\n");
     }
 
     /**
@@ -636,11 +633,7 @@
      * @return the <CODE>attachment</CODE> init parameter, or <CODE>MESSAGE</CODE> if missing
      */
     protected int getAttachmentType() throws MessagingException {
-        if(getInitParameter("attachment") == null) {
-            return MESSAGE;
-        } else {
-            return getTypeCode(getInitParameter("attachment"));
-        }
+        return getTypeCode(getInitParameter("attachment","message"));
     }
 
 

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/Forward.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/Forward.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/Forward.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/Forward.java Thu Mar  2 08:56:32 2006
@@ -17,8 +17,6 @@
 
 package org.apache.james.transport.mailets;
 
-import org.apache.mailet.GenericMailet;
-import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 
 import javax.mail.MessagingException;
@@ -110,11 +108,7 @@
      */
     protected Collection getRecipients() throws MessagingException {
         Collection newRecipients = new HashSet();
-        boolean error = false;
-        String addressList = getInitParameter("forwardto");
-        if (addressList == null) {
-            addressList = getInitParameter("forwardTo");
-        }
+        String addressList = getInitParameter("forwardto",getInitParameter("forwardTo"));
         
         // if nothing was specified, throw an exception
         if (addressList == null) {

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/FromRepository.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/FromRepository.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/FromRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/FromRepository.java Thu Mar  2 08:56:32 2006
@@ -78,7 +78,7 @@
 
         ServiceManager compMgr = (ServiceManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
         try {
-            Store mailstore = (Store) compMgr.lookup("org.apache.avalon.cornerstone.services.store.Store");
+            Store mailstore = (Store) compMgr.lookup(Store.ROLE);
             DefaultConfiguration mailConf
                 = new DefaultConfiguration("repository", "generated:ToRepository");
             mailConf.setAttribute("destinationURL", repositoryPath);

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/JDBCVirtualUserTable.java Thu Mar  2 08:56:32 2006
@@ -26,7 +26,6 @@
 import org.apache.mailet.MailetException;
 
 import javax.mail.MessagingException;
-import javax.mail.internet.ParseException;
 
 import java.sql.Connection;
 import java.sql.DatabaseMetaData;
@@ -146,10 +145,7 @@
             }
 
             //Build the query
-            query = getInitParameter("sqlquery");
-            if (query == null) {
-                query = "select VirtualUserTable.target_address from VirtualUserTable, VirtualUserTable as VUTDomains where (VirtualUserTable.user like ? or VirtualUserTable.user like '\\%') and (VirtualUserTable.domain like ? or (VirtualUserTable.domain like '\\%' and VUTDomains.domain like ?)) order by concat(VirtualUserTable.user,'@',VirtualUserTable.domain) desc limit 1";
-            }
+            query = getInitParameter("sqlquery","select VirtualUserTable.target_address from VirtualUserTable, VirtualUserTable as VUTDomains where (VirtualUserTable.user like ? or VirtualUserTable.user like '\\%') and (VirtualUserTable.domain like ? or (VirtualUserTable.domain like '\\%' and VUTDomains.domain like ?)) order by concat(VirtualUserTable.user,'@',VirtualUserTable.domain) desc limit 1");
         } catch (MailetException me) {
             throw me;
         } catch (Exception e) {

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java Thu Mar  2 08:56:32 2006
@@ -17,27 +17,12 @@
 
 package org.apache.james.transport.mailets;
 
-import org.apache.mailet.GenericMailet;
-import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
-import org.apache.mailet.MailetException;
 
-import javax.mail.Address;
-import javax.mail.Message;
 import javax.mail.MessagingException;
-import javax.mail.Session;
 import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Date;
 import java.util.HashSet;
-import java.util.Set;
 import java.util.Collection;
-import java.util.Iterator;
 
 /**
  * <P>Sends a notification message to the Postmaster.</P>

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/NotifySender.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/NotifySender.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/NotifySender.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/NotifySender.java Thu Mar  2 08:56:32 2006
@@ -17,27 +17,12 @@
 
 package org.apache.james.transport.mailets;
 
-import org.apache.mailet.GenericMailet;
-import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
-import org.apache.mailet.MailetException;
 
-import javax.mail.Address;
-import javax.mail.Message;
 import javax.mail.MessagingException;
-import javax.mail.Session;
 import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Date;
 import java.util.HashSet;
-import java.util.Set;
 import java.util.Collection;
-import java.util.Iterator;
 
 /**
  * <P>Sends a notification message to the sender of a message.</P>

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/Redirect.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/Redirect.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/Redirect.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/Redirect.java Thu Mar  2 08:56:32 2006
@@ -17,29 +17,13 @@
 
 package org.apache.james.transport.mailets;
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
 import java.util.Collection;
-import java.util.Date;
-import java.util.Enumeration;
 import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.ArrayList;
 
 
-import javax.mail.Message;
 import javax.mail.MessagingException;
-import javax.mail.Session;
 import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-
-import org.apache.james.core.MailImpl;
 
-import org.apache.mailet.GenericMailet;
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 
@@ -330,11 +314,7 @@
      * @return the <CODE>inline</CODE> init parameter
      */
     protected int getInLineType() throws MessagingException {
-        if(getInitParameter("inline") == null) {
-            return BODY;
-        } else {
-            return getTypeCode(getInitParameter("inline"));
-        }
+        return getTypeCode(getInitParameter("inline","body"));
     }
 
     /**
@@ -348,9 +328,7 @@
      */
     protected Collection getRecipients() throws MessagingException {
         Collection newRecipients = new HashSet();
-        String addressList = (getInitParameter("recipients") == null)
-                                 ? getInitParameter("to")
-                                 : getInitParameter("recipients");
+        String addressList = getInitParameter("recipients",getInitParameter("to"));
                                  
         // if nothing was specified, return <CODE>null</CODE> meaning no change
         if (addressList == null) {
@@ -390,9 +368,7 @@
      */
     protected InternetAddress[] getTo() throws MessagingException {
         InternetAddress[] iaarray = null;
-        String addressList = (getInitParameter("to") == null)
-                                 ? getInitParameter("recipients")
-                                 : getInitParameter("to");
+        String addressList = getInitParameter("to",getInitParameter("recipients"));
 
         // if nothing was specified, return null meaning no change
         if (addressList == null) {

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/RemoteDelivery.java Thu Mar  2 08:56:32 2006
@@ -316,7 +316,7 @@
 
         try {
             // Instantiate the a MailRepository for outgoing mails
-            Store mailstore = (Store) compMgr.lookup("org.apache.avalon.cornerstone.services.store.Store");
+            Store mailstore = (Store) compMgr.lookup(Store.ROLE);
 
             DefaultConfiguration spoolConf
                 = new DefaultConfiguration("repository", "generated:RemoteDelivery.java");

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/RemoveAllMailAttributes.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/RemoveAllMailAttributes.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/RemoveAllMailAttributes.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/RemoveAllMailAttributes.java Thu Mar  2 08:56:32 2006
@@ -19,7 +19,6 @@
 
 import org.apache.mailet.GenericMailet;
 import org.apache.mailet.Mail;
-import org.apache.mailet.MailetException;
 import javax.mail.MessagingException;
 
 /**

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/Resend.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/Resend.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/Resend.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/Resend.java Thu Mar  2 08:56:32 2006
@@ -17,34 +17,6 @@
 
 package org.apache.james.transport.mailets;
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import java.util.Collection;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.StringTokenizer;
-import java.util.ArrayList;
-
-
-import javax.mail.Message;
-import javax.mail.MessagingException;
-import javax.mail.Session;
-import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeBodyPart;
-import javax.mail.internet.MimeMessage;
-import javax.mail.internet.MimeMultipart;
-
-import org.apache.james.core.MailImpl;
-
-import org.apache.mailet.GenericMailet;
-import org.apache.mailet.Mail;
-import org.apache.mailet.MailAddress;
-
-
 /**
  * <P>A mailet providing configurable redirection services.</P>
  * <P>Can produce listserver, forward and notify behaviour, with the original

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/ServerTime.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/ServerTime.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/ServerTime.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/ServerTime.java Thu Mar  2 08:56:32 2006
@@ -21,11 +21,7 @@
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 
-import javax.mail.Address;
-import javax.mail.internet.InternetAddress;
 import javax.mail.internet.MimeMessage;
-import java.util.HashSet;
-import java.util.Set;
 
 /**
  * Returns the current time for the mail server.  Sample configuration:

Modified: james/server/trunk/src/java/org/apache/james/transport/mailets/ToRepository.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/transport/mailets/ToRepository.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/transport/mailets/ToRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/transport/mailets/ToRepository.java Thu Mar  2 08:56:32 2006
@@ -65,12 +65,12 @@
 
         ServiceManager compMgr = (ServiceManager)getMailetContext().getAttribute(Constants.AVALON_COMPONENT_MANAGER);
         try {
-            Store mailstore = (Store) compMgr.lookup("org.apache.avalon.cornerstone.services.store.Store");
+            Store mailstore = (Store) compMgr.lookup(Store.ROLE);
             DefaultConfiguration mailConf
                 = new DefaultConfiguration("repository", "generated:ToRepository");
             mailConf.setAttribute("destinationURL", repositoryPath);
             mailConf.setAttribute("type", "MAIL");
-            mailConf.setAttribute("CACHEKEYS", getInitParameter("CACHEKEYS") == null ? "TRUE" : getInitParameter("CACHEKEYS"));
+            mailConf.setAttribute("CACHEKEYS", getInitParameter("CACHEKEYS","TRUE"));
             repository = (MailRepository) mailstore.select(mailConf);
         } catch (ServiceException cnfe) {
             log("Failed to retrieve Store component:" + cnfe.getMessage());

Modified: james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java (original)
+++ james/server/trunk/src/java/org/apache/james/userrepository/UsersFileRepository.java Thu Mar  2 08:56:32 2006
@@ -71,8 +71,7 @@
         throws ServiceException {
 
         try {
-            store = (Store)componentManager.
-                lookup( "org.apache.avalon.cornerstone.services.store.Store" );
+            store = (Store)componentManager.lookup( Store.ROLE );
         } catch (Exception e) {
             final String message = "Failed to retrieve Store component:" + e.getMessage();
             getLogger().error( message, e );

Modified: james/server/trunk/src/java/org/apache/mailet/GenericMailet.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/java/org/apache/mailet/GenericMailet.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/java/org/apache/mailet/GenericMailet.java (original)
+++ james/server/trunk/src/java/org/apache/mailet/GenericMailet.java Thu Mar  2 08:56:32 2006
@@ -57,6 +57,27 @@
     }
 
     /**
+     * Returns a String containing the value of the named initialization
+     * parameter, or defValue if the parameter does not exist.
+     * <p>
+     * This method is supplied for convenience. It gets the value of the
+     * named parameter from the mailet's MailetConfig object.
+     *
+     * @param name - a String specifying the name of the initialization parameter
+     * @param defValue - a String specifying the default value when the parameter
+     *                    is not present
+     * @return a String containing the value of the initalization parameter
+     */
+    public String getInitParameter(String name, String defValue) {
+        String res = config.getInitParameter(name);
+        if (res == null) {
+            return defValue;
+        } else {
+            return res;
+        }
+    }
+
+    /**
      * Returns the names of the mailet's initialization parameters as an
      * Iterator of String objects, or an empty Iterator if the mailet has no
      * initialization parameters.

Modified: james/server/trunk/src/test/org/apache/james/JamesTest.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/test/org/apache/james/JamesTest.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/JamesTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/JamesTest.java Thu Mar  2 08:56:32 2006
@@ -18,8 +18,11 @@
 
 package org.apache.james;
 
+import org.apache.avalon.cornerstone.services.store.Store;
 import org.apache.james.services.MailServer;
 import org.apache.james.services.MailServerTestAllImplementations;
+import org.apache.james.services.UsersRepository;
+import org.apache.james.services.UsersStore;
 import org.apache.james.test.mock.avalon.MockContext;
 import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.james.test.mock.avalon.MockServiceManager;
@@ -54,11 +57,11 @@
     private MockServiceManager setUpServiceManager() {
         MockServiceManager serviceManager = new MockServiceManager();
         MockUsersRepository mockUsersRepository = new MockUsersRepository();
-        serviceManager.put("org.apache.james.services.UsersRepository", mockUsersRepository);
-        serviceManager.put("org.apache.james.services.UsersStore", new MockUsersStore(mockUsersRepository));
+        serviceManager.put(UsersRepository.ROLE, mockUsersRepository);
+        serviceManager.put(UsersStore.ROLE, new MockUsersStore(mockUsersRepository));
         MockStore mockStore = new MockStore();
         mockStore.add(EXISTING_USER_NAME, new MockMailRepository());
-        serviceManager.put("org.apache.avalon.cornerstone.services.store.Store", mockStore);
+        serviceManager.put(Store.ROLE, mockStore);
         return serviceManager;
     }
 

Modified: james/server/trunk/src/test/org/apache/james/pop3server/POP3ServerTest.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/test/org/apache/james/pop3server/POP3ServerTest.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/pop3server/POP3ServerTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/pop3server/POP3ServerTest.java Thu Mar  2 08:56:32 2006
@@ -22,6 +22,8 @@
 import org.apache.james.core.MimeMessageInputStreamSource;
 import org.apache.james.core.MimeMessageWrapper;
 import org.apache.james.services.JamesConnectionManager;
+import org.apache.james.services.MailServer;
+import org.apache.james.services.UsersRepository;
 import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.james.test.mock.avalon.MockServiceManager;
 import org.apache.james.test.mock.avalon.MockSocketManager;
@@ -89,8 +91,8 @@
         serviceManager.put(JamesConnectionManager.ROLE, connectionManager);
         m_mailServer = new MockMailServer();
         serviceManager
-                .put("org.apache.james.services.MailServer", m_mailServer);
-        serviceManager.put("org.apache.james.services.UsersRepository",
+                .put(MailServer.ROLE, m_mailServer);
+        serviceManager.put(UsersRepository.ROLE,
                 m_usersRepository);
         serviceManager.put(SocketManager.ROLE, new MockSocketManager(
                 m_pop3ListenerPort));
@@ -350,17 +352,16 @@
         assertEquals("second connection taken", 1, pop3Protocol2.getState());
 
         // open two accounts
-        int res = 0;
         try {
             pop3Protocol1.userPass("foo1", "bar1".toCharArray());
         } catch (POP3Exception e) {
-            res = e.getResponse().getType();
+            e.getResponse().getType();
         }
 
         try {
             pop3Protocol2.userPass("foo2", "bar2".toCharArray());
         } catch (POP3Exception e) {
-            res = e.getResponse().getType();
+            e.getResponse().getType();
         }
 
         ScanListEntry[] entries = null;
@@ -368,14 +369,14 @@
             entries = pop3Protocol1.list();
             assertEquals("foo1 has mails", 2, entries.length);
         } catch (POP3Exception e) {
-            res = e.getResponse().getType();
+            e.getResponse().getType();
         }
 
         try {
             entries = pop3Protocol2.list();
             assertEquals("foo2 has no mails", 0, entries.length);
         } catch (POP3Exception e) {
-            res = e.getResponse().getType();
+            e.getResponse().getType();
         }
 
         // put both to rest

Modified: james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTest.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTest.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/remotemanager/RemoteManagerTest.java Thu Mar  2 08:56:32 2006
@@ -23,6 +23,9 @@
 import org.apache.avalon.cornerstone.services.threads.ThreadManager;
 import org.apache.commons.net.telnet.TelnetClient;
 import org.apache.james.services.JamesConnectionManager;
+import org.apache.james.services.MailServer;
+import org.apache.james.services.UsersRepository;
+import org.apache.james.services.UsersStore;
 import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.james.test.mock.avalon.MockServiceManager;
 import org.apache.james.test.mock.avalon.MockSocketManager;
@@ -115,13 +118,13 @@
             fail("reading remote manager answer failed");
         }
 
-        allAnswerLines.addAll(Arrays.asList(stringBuffer.toString().split("\n")));
+        allAnswerLines.addAll(Arrays.asList(stringBuffer.toString().split("\r\n")));
         if ("".equals(getLastLine(allAnswerLines))) allAnswerLines.remove(allAnswerLines.size()-1);
         return allAnswerLines;
     }
 
     protected void sendCommand(String command) throws IOException {
-        m_writer.write(command + "\n");
+        m_writer.write(command + "\r\n");
         m_writer.flush();
     }
 
@@ -139,10 +142,10 @@
         connectionManager.enableLogging(new MockLogger());
         serviceManager.put(JamesConnectionManager.ROLE, connectionManager);
         MockMailServer mailServer = new MockMailServer();
-        serviceManager.put("org.apache.james.services.MailServer", mailServer);
+        serviceManager.put(MailServer.ROLE, mailServer);
         m_mockUsersRepository = mailServer.getUsersRepository();
-        serviceManager.put("org.apache.james.services.UsersRepository", m_mockUsersRepository);
-        serviceManager.put("org.apache.james.services.UsersStore", new MockUsersStore(m_mockUsersRepository));
+        serviceManager.put(UsersRepository.ROLE, m_mockUsersRepository);
+        serviceManager.put(UsersStore.ROLE, new MockUsersStore(m_mockUsersRepository));
         serviceManager.put(SocketManager.ROLE, new MockSocketManager(m_remoteManagerListenerPort));
         serviceManager.put(ThreadManager.ROLE, new MockThreadManager());
         return serviceManager;
@@ -266,7 +269,7 @@
         } catch (InterruptedException e) {
             ; // ignore
         }
-        List answers = readAnswer();
+        readAnswer();
 
         sendCommand("help");
         try {

Modified: james/server/trunk/src/test/org/apache/james/smtpserver/SMTPServerTest.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/test/org/apache/james/smtpserver/SMTPServerTest.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/smtpserver/SMTPServerTest.java (original)
+++ james/server/trunk/src/test/org/apache/james/smtpserver/SMTPServerTest.java Thu Mar  2 08:56:32 2006
@@ -19,6 +19,8 @@
 import org.apache.avalon.cornerstone.services.sockets.SocketManager;
 import org.apache.avalon.cornerstone.services.threads.ThreadManager;
 import org.apache.james.services.JamesConnectionManager;
+import org.apache.james.services.MailServer;
+import org.apache.james.services.UsersRepository;
 import org.apache.james.test.mock.avalon.MockLogger;
 import org.apache.james.test.mock.avalon.MockServiceManager;
 import org.apache.james.test.mock.avalon.MockSocketManager;
@@ -102,8 +104,8 @@
         serviceManager.put(JamesConnectionManager.ROLE, connectionManager);
         serviceManager.put("org.apache.mailet.MailetContext", new MockMailContext());
         m_mailServer = new MockMailServer();
-        serviceManager.put("org.apache.james.services.MailServer", m_mailServer);
-        serviceManager.put("org.apache.james.services.UsersRepository", m_usersRepository);
+        serviceManager.put(MailServer.ROLE, m_mailServer);
+        serviceManager.put(UsersRepository.ROLE, m_usersRepository);
         serviceManager.put(SocketManager.ROLE, new MockSocketManager(m_smtpListenerPort));
         serviceManager.put(ThreadManager.ROLE, new MockThreadManager());
         return serviceManager;

Modified: james/server/trunk/src/test/org/apache/james/test/mock/javaxmail/MockMimeMessage.java
URL: http://svn.apache.org/viewcvs/james/server/trunk/src/test/org/apache/james/test/mock/javaxmail/MockMimeMessage.java?rev=382444&r1=382443&r2=382444&view=diff
==============================================================================
--- james/server/trunk/src/test/org/apache/james/test/mock/javaxmail/MockMimeMessage.java (original)
+++ james/server/trunk/src/test/org/apache/james/test/mock/javaxmail/MockMimeMessage.java Thu Mar  2 08:56:32 2006
@@ -304,7 +304,7 @@
 
     public String getHeader(String name, String delimiter) throws MessagingException {
         String[] header = getHeader(name);
-        if (header.length == 0) return null;
+        if (header == null || header.length == 0) return null;
         return header[0];
     }
 
@@ -385,14 +385,14 @@
     }
 
     public Enumeration getNonMatchingHeaderLines(String[] names) throws MessagingException {
-        List existingHeaders = Arrays.asList(names);
+        List existingHeaders = names != null ? Arrays.asList(names) : null;
 
         ArrayList nonMatchingHeaders = new ArrayList();
         
         Iterator iterator = m_contentHeaders.keySet().iterator();
         while (iterator.hasNext()) {
             String name = (String) iterator.next();
-            if (existingHeaders.contains(name)) continue;
+            if (existingHeaders!=null && existingHeaders.contains(name)) continue;
             String value = getHeader(name, null);
             if (value == null) continue;
             nonMatchingHeaders.add(name + ":" + value);



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message