You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by da...@apache.org on 2003/01/07 12:06:39 UTC

cvs commit: jakarta-james/tests/src/java/org/apache/james/testing SMTPTest.java

danny       2003/01/07 03:06:39

  Modified:    src/java/org/apache/james/transport/mailets
                        AvalonListserv.java AvalonListservManager.java
                        GenericListserv.java NotifyPostmaster.java
                        NotifySender.java Redirect.java RemoteDelivery.java
                        ToRepository.java
               src/java/org/apache/james Constants.java James.java
               src/java/org/apache/james/core MailHeaders.java
                        MailImpl.java MimeMessageWrapper.java
               src/java/org/apache/james/transport/matchers
                        NESSpamCheck.java RelayLimit.java
               src/java/org/apache/james/nntpserver NNTPHandler.java
               src/java/org/apache/james/util RFC822Date.java
               tests/src/java/org/apache/james/testing SMTPTest.java
  Added:       src/java/org/apache/mailet MailetContextConstants.java
                        RFC2822Headers.java
               src/java/org/apache/mailet/dates RFC2980DateFormat.java
                        RFC822DateFormat.java RFC977DateFormat.java
                        SimplifiedDateFormat.java
                        SynchronizedDateFormat.java
  Removed:     src/java/org/apache/james/util RFC2822Headers.java
                        RFC2980DateFormat.java RFC822DateFormat.java
                        RFC977DateFormat.java SimplifiedDateFormat.java
                        SynchronizedDateFormat.java
  Log:
  MailetAPI refactorings, removing james dependance from standard mailets
  moved RFC compliant date classes into o.a.mailet.dates
  Moved constants refered to by MailetContext into o.a.mailet.MailetContextConstants
  Made o.a.jamesConstants an interface
  Moved RFC822Headers to o.a.mailet
  
  Revision  Changes    Path
  1.9       +7 -10     jakarta-james/src/java/org/apache/james/transport/mailets/AvalonListserv.java
  
  Index: AvalonListserv.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/AvalonListserv.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- AvalonListserv.java	6 Jan 2003 15:56:24 -0000	1.8
  +++ AvalonListserv.java	7 Jan 2003 11:06:34 -0000	1.9
  @@ -7,18 +7,15 @@
    */
   package org.apache.james.transport.mailets;
   
  -//import org.apache.avalon.framework.component.ComponentException;
  -//import org.apache.avalon.framework.component.ComponentManager;
  -import org.apache.james.Constants;
  -//import org.apache.james.services.UsersStore;
  -import org.apache.mailet.MailAddress;
  -import org.apache.mailet.UsersRepository;
  -
  -import javax.mail.MessagingException;
  -import javax.mail.internet.ParseException;
   import java.util.Collection;
   import java.util.Iterator;
   import java.util.Vector;
  +
  +import javax.mail.MessagingException;
  +import javax.mail.internet.ParseException;
  +
  +import org.apache.mailet.MailAddress;
  +import org.apache.mailet.UsersRepository;
   
   /**
    * MailingListServer capability.
  
  
  
  1.8       +1 -5      jakarta-james/src/java/org/apache/james/transport/mailets/AvalonListservManager.java
  
  Index: AvalonListservManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/AvalonListservManager.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- AvalonListservManager.java	6 Jan 2003 15:56:24 -0000	1.7
  +++ AvalonListservManager.java	7 Jan 2003 11:06:34 -0000	1.8
  @@ -7,12 +7,8 @@
    */
   package org.apache.james.transport.mailets;
   
  -//import org.apache.avalon.framework.component.ComponentException;
  -//import org.apache.avalon.framework.component.ComponentManager;
   import javax.mail.MessagingException;
   
  -import org.apache.james.Constants;
  -//import org.apache.james.services.UsersStore;
   import org.apache.mailet.MailAddress;
   import org.apache.mailet.UsersRepository;
   
  
  
  
  1.13      +9 -8      jakarta-james/src/java/org/apache/james/transport/mailets/GenericListserv.java
  
  Index: GenericListserv.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/GenericListserv.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- GenericListserv.java	26 Oct 2002 04:54:19 -0000	1.12
  +++ GenericListserv.java	7 Jan 2003 11:06:34 -0000	1.13
  @@ -7,18 +7,19 @@
    */
   package org.apache.james.transport.mailets;
   
  -import org.apache.james.util.RFC2822Headers;
  -import org.apache.mailet.GenericMailet;
  -import org.apache.mailet.Mail;
  -import org.apache.mailet.MailAddress;
  -import org.apache.mailet.MailetException;
  +import java.io.IOException;
  +import java.util.Collection;
  +import java.util.Vector;
   
   import javax.mail.MessagingException;
   import javax.mail.internet.MimeMessage;
   import javax.mail.internet.MimeMultipart;
  -import java.io.IOException;
  -import java.util.Collection;
  -import java.util.Vector;
  +
  +import org.apache.mailet.GenericMailet;
  +import org.apache.mailet.Mail;
  +import org.apache.mailet.MailAddress;
  +import org.apache.mailet.MailetException;
  +import org.apache.mailet.RFC2822Headers;
   
   /**
    * An abstract implementation of a listserv.  The underlying implementation must define
  
  
  
  1.10      +14 -14    jakarta-james/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java
  
  Index: NotifyPostmaster.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/NotifyPostmaster.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- NotifyPostmaster.java	29 Sep 2002 00:09:46 -0000	1.9
  +++ NotifyPostmaster.java	7 Jan 2003 11:06:34 -0000	1.10
  @@ -7,14 +7,14 @@
    */
   package org.apache.james.transport.mailets;
   
  -import org.apache.james.util.RFC2822Headers;
  -import org.apache.james.util.RFC822DateFormat;
  -import org.apache.mailet.GenericMailet;
  -import org.apache.mailet.Mail;
  -import org.apache.mailet.MailAddress;
  -import org.apache.mailet.MailetException;
  +import java.io.IOException;
  +import java.io.PrintWriter;
  +import java.io.StringWriter;
  +import java.util.Date;
  +import java.util.HashSet;
  +import java.util.Iterator;
  +import java.util.Set;
   
  -import javax.mail.Address;
   import javax.mail.Message;
   import javax.mail.MessagingException;
   import javax.mail.Session;
  @@ -22,13 +22,13 @@
   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.Iterator;
  -import java.util.Set;
  +
  +import org.apache.mailet.GenericMailet;
  +import org.apache.mailet.Mail;
  +import org.apache.mailet.MailAddress;
  +import org.apache.mailet.MailetException;
  +import org.apache.mailet.RFC2822Headers;
  +import org.apache.mailet.dates.RFC822DateFormat;
   
   /**
    * Sends an error message to the sender of a message (that's typically landed in
  
  
  
  1.11      +13 -13    jakarta-james/src/java/org/apache/james/transport/mailets/NotifySender.java
  
  Index: NotifySender.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/NotifySender.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- NotifySender.java	29 Sep 2002 00:09:46 -0000	1.10
  +++ NotifySender.java	7 Jan 2003 11:06:34 -0000	1.11
  @@ -7,14 +7,13 @@
    */
   package org.apache.james.transport.mailets;
   
  -import org.apache.james.util.RFC2822Headers;
  -import org.apache.james.util.RFC822DateFormat;
  -import org.apache.mailet.GenericMailet;
  -import org.apache.mailet.Mail;
  -import org.apache.mailet.MailAddress;
  -import org.apache.mailet.MailetException;
  +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 javax.mail.Address;
   import javax.mail.Message;
   import javax.mail.MessagingException;
   import javax.mail.Session;
  @@ -22,12 +21,13 @@
   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 org.apache.mailet.GenericMailet;
  +import org.apache.mailet.Mail;
  +import org.apache.mailet.MailAddress;
  +import org.apache.mailet.MailetException;
  +import org.apache.mailet.RFC2822Headers;
  +import org.apache.mailet.dates.RFC822DateFormat;
   
   /**
    * Sends an error message to the sender of a message (that's typically landed in
  
  
  
  1.19      +2 -7      jakarta-james/src/java/org/apache/james/transport/mailets/Redirect.java
  
  Index: Redirect.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/Redirect.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- Redirect.java	2 Dec 2002 22:03:21 -0000	1.18
  +++ Redirect.java	7 Jan 2003 11:06:34 -0000	1.19
  @@ -9,16 +9,12 @@
   
   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.Vector;
  -
   
   import javax.mail.Message;
   import javax.mail.MessagingException;
  @@ -28,12 +24,11 @@
   import javax.mail.internet.MimeMessage;
   import javax.mail.internet.MimeMultipart;
   
  -import org.apache.james.util.RFC2822Headers;
  -import org.apache.james.util.RFC822DateFormat;
  -
   import org.apache.mailet.GenericMailet;
   import org.apache.mailet.Mail;
   import org.apache.mailet.MailAddress;
  +import org.apache.mailet.RFC2822Headers;
  +import org.apache.mailet.dates.RFC822DateFormat;
   
   
   /**
  
  
  
  1.36      +12 -17    jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDelivery.java
  
  Index: RemoteDelivery.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/RemoteDelivery.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- RemoteDelivery.java	6 Jan 2003 17:08:48 -0000	1.35
  +++ RemoteDelivery.java	7 Jan 2003 11:06:34 -0000	1.36
  @@ -7,9 +7,6 @@
    */
   package org.apache.james.transport.mailets;
   
  -//import org.apache.avalon.framework.component.ComponentException;
  -//import org.apache.avalon.framework.component.ComponentManager;
  -//import org.apache.avalon.framework.configuration.DefaultConfiguration;
   import java.io.PrintWriter;
   import java.io.StringWriter;
   import java.net.ConnectException;
  @@ -37,11 +34,10 @@
   import javax.mail.internet.ParseException;
   
   import org.apache.james.Constants;
  -import org.apache.james.core.MailImpl;
  -import org.apache.james.services.MailServer;
   import org.apache.mailet.GenericMailet;
   import org.apache.mailet.Mail;
   import org.apache.mailet.MailAddress;
  +import org.apache.mailet.MailetContextConstants;
   import org.apache.mailet.SpoolRepository;
   
   /**
  @@ -85,7 +81,7 @@
       private String gatewayServer = null; // the server to send all email to
       private String gatewayPort = null;  //the port of the gateway server to send all email to
       private Collection deliveryThreads = new Vector();
  -    private MailServer mailServer;
  +    
       private volatile boolean destroyed = false; //Flag that the run method will check and end itself if set to true
   
       /**
  @@ -148,7 +144,7 @@
        * @param Session javax.mail.Session
        * @return boolean Whether the delivery was successful and the message can be deleted
        */
  -    private boolean deliver(MailImpl mail, Session session) {
  +    private boolean deliver(Mail mail, Session session) {
           try {
               if (isDebug) {
                   log("Attempting to deliver " + mail.getName());
  @@ -327,7 +323,7 @@
        * @param boolean permanent
        * @return boolean Whether the message failed fully and can be deleted
        */
  -    private boolean failMessage(MailImpl mail, MessagingException ex, boolean permanent) {
  +    private boolean failMessage(Mail mail, MessagingException ex, boolean permanent) {
           StringWriter sout = new StringWriter();
           PrintWriter out = new PrintWriter(sout, true);
           if (permanent) {
  @@ -378,7 +374,7 @@
           return true;
       }
   
  -    private void bounce(MailImpl mail, MessagingException ex) {
  +    private void bounce(Mail mail, MessagingException ex) {
           StringWriter sout = new StringWriter();
           PrintWriter out = new PrintWriter(sout, true);
           String machine = "[unknown]";
  @@ -446,9 +442,8 @@
        * @param mail org.apache.mailet.Mail
        * @return org.apache.mailet.MessageContainer
        */
  -    public void service(Mail genericmail) throws AddressException {
  -        MailImpl mail = (MailImpl)genericmail;
  -
  +    public void service(Mail mail) throws AddressException {
  +        
           // Do I want to give the internal key, or the message's Message ID
           if (isDebug) {
               log("Remotely delivering mail " + mail.getName());
  @@ -554,11 +549,11 @@
           //Sets timeout on going connections
           props.put("mail.smtp.timeout", smtpTimeout + "");
           //Set the hostname we'll use as this server
  -        if (getMailetContext().getAttribute(Constants.HELLO_NAME) != null) {
  -            props.put("mail.smtp.localhost", (String) getMailetContext().getAttribute(Constants.HELLO_NAME));
  +        if (getMailetContext().getAttribute(MailetContextConstants.HELLO_NAME) != null) {
  +            props.put("mail.smtp.localhost", (String) getMailetContext().getAttribute(MailetContextConstants.HELLO_NAME));
           }
           else {
  -            Collection servernames = (Collection) getMailetContext().getAttribute(Constants.SERVER_NAMES);
  +            Collection servernames = (Collection) getMailetContext().getAttribute(MailetContextConstants.SERVER_NAMES);
               if ((servernames != null) && (servernames.size() > 0)) {
                   props.put("mail.smtp.localhost", (String) servernames.iterator().next());
               }
  @@ -582,7 +577,7 @@
                                           .append(key);
                               log(logMessageBuffer.toString());
                           }
  -                        MailImpl mail = outgoing.retrieve(key);
  +                        Mail mail = outgoing.retrieve(key);
                           // Retrieve can return null if the mail is no longer on the outgoing spool.
                           // In this case we simply continue to the next key
                           if (mail == null) {
  
  
  
  1.10      +1 -6      jakarta-james/src/java/org/apache/james/transport/mailets/ToRepository.java
  
  Index: ToRepository.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/ToRepository.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- ToRepository.java	6 Jan 2003 12:41:01 -0000	1.9
  +++ ToRepository.java	7 Jan 2003 11:06:34 -0000	1.10
  @@ -7,14 +7,9 @@
    */
   package org.apache.james.transport.mailets;
   
  -//import org.apache.avalon.framework.component.ComponentException;
  -//import org.apache.avalon.framework.component.ComponentManager;
  -//import org.apache.avalon.framework.configuration.DefaultConfiguration;
   import javax.mail.MessagingException;
   
  -import org.apache.james.Constants;
   import org.apache.james.core.MailImpl;
  -import org.apache.james.services.MailStore;
   import org.apache.mailet.GenericMailet;
   import org.apache.mailet.Mail;
   import org.apache.mailet.MailRepository;
  
  
  
  1.8       +4 -20     jakarta-james/src/java/org/apache/james/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/Constants.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Constants.java	14 Sep 2002 09:00:56 -0000	1.7
  +++ Constants.java	7 Jan 2003 11:06:35 -0000	1.8
  @@ -7,6 +7,8 @@
    */
   package org.apache.james;
   
  +import org.apache.mailet.MailetContextConstants;
  +
   /**
    * Assorted Constants for use in all James blocks
    * The Software Version, Software Name and Build Date are set by ant during
  @@ -16,7 +18,7 @@
    *
    * @version This is $Revision$
    */
  -public class Constants {
  +public interface Constants extends MailetContextConstants{
   
       /**
        * The version of James.
  @@ -27,24 +29,6 @@
        * The name of the software (i.e. James).
        */
       public static final String SOFTWARE_NAME = "@@NAME@@";
  -
  -    /**
  -     * Context key used to store the list of mail domains being
  -     * serviced by this James instance in the context.
  -     */
  -    public static final String SERVER_NAMES = "SERVER_NAMES";
  -
  -    /**
  -     * Context key used to store the Mailet/SMTP "hello name" for this
  -     * James instance in the context.
  -     */
  -    public static final String HELLO_NAME = "HELLO_NAME";
  -
  -    /**
  -     * Context key used to store the postmaster address for
  -     * this James instance in the context.
  -     */
  -    public static final String POSTMASTER = "POSTMASTER";
   
       /**
        * Key used to store the component manager for
  
  
  
  1.39      +5 -3      jakarta-james/src/java/org/apache/james/James.java
  
  Index: James.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/James.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- James.java	6 Jan 2003 17:08:41 -0000	1.38
  +++ James.java	7 Jan 2003 11:06:35 -0000	1.39
  @@ -54,14 +54,14 @@
   import org.apache.james.services.MailStore;
   import org.apache.james.services.UsersStore;
   import org.apache.james.userrepository.DefaultJamesUser;
  -import org.apache.james.util.RFC2822Headers;
  -import org.apache.james.util.RFC822DateFormat;
   import org.apache.mailet.Mail;
   import org.apache.mailet.MailAddress;
   import org.apache.mailet.MailRepository;
   import org.apache.mailet.MailetContext;
  +import org.apache.mailet.RFC2822Headers;
   import org.apache.mailet.SpoolRepository;
   import org.apache.mailet.UsersRepository;
  +import org.apache.mailet.dates.RFC822DateFormat;
   
   /**
    * Core class for JAMES. Provides three primary services:
  @@ -899,5 +899,7 @@
       public UsersRepository getUserRepository(String respositoryName) throws MessagingException {
           return usersStore.getRepository(respositoryName);
       }
  +
  +    
   
   }
  
  
  
  1.1                  jakarta-james/src/java/org/apache/mailet/MailetContextConstants.java
  
  Index: MailetContextConstants.java
  ===================================================================
  /**
   * Constants.java
   * 
   * Copyright (C) 07-Jan-2003 The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file. 
   *
   * Danny Angus
   */
  package org.apache.mailet;
  /**
   * @author <A href="mailto:danny@apache.org">Danny Angus</a>
   * 
   * $Id: MailetContextConstants.java,v 1.1 2003/01/07 11:06:35 danny Exp $
   */
  public interface MailetContextConstants {
      /**
       * Context key used to store the list of mail domains being
       * serviced by this James instance in the context.
       */
      public static final String SERVER_NAMES = "SERVER_NAMES";
  
  
      /**
       * Context key used to store the Mailet/SMTP "hello name" for this
       * James instance in the context.
       */
      public static final String HELLO_NAME = "HELLO_NAME";
  
  
      /**
       * Context key used to store the postmaster address for
       * this James instance in the context.
       */
      public static final String POSTMASTER = "POSTMASTER";
  
  
  }
  
  
  
  1.1                  jakarta-james/src/java/org/apache/mailet/RFC2822Headers.java
  
  Index: RFC2822Headers.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.mailet;
  
  /**
   * This utility class provides the set of header names explicitly defined in RFC 2822
   *
   * @author Peter M. Goldstein <fa...@alum.mit.edu>
   */
  public class RFC2822Headers  {
  
      // See Section 3.6.1 of RFC 2822
  
      /**
       * The name of the RFC 2822 header that stores the mail date.
       */
      public final static String DATE = "Date";
  
      // See Section 3.6.2 of RFC 2822
  
      /**
       * The name of the RFC 2822 header that stores the mail author(s).
       */
      public final static String FROM = "From";
  
      /**
       * The name of the RFC 2822 header that stores the actual mail transmission agent,
       * if this differs from the author of the message.
       */
      public final static String SENDER = "Sender";
  
      /**
       * The name of the RFC 2822 header that stores the reply-to address.
       */
      public final static String REPLY_TO = "Reply-To";
  
      // See Section 3.6.3 of RFC 2822
  
      /**
       * The name of the RFC 2822 header that stores the primary mail recipients.
       */
      public final static String TO = "To";
  
      /**
       * The name of the RFC 2822 header that stores the carbon copied mail recipients.
       */
      public final static String CC = "Cc";
  
      /**
       * The name of the RFC 2822 header that stores the blind carbon copied mail recipients.
       */
      public final static String BCC = "Bcc";
  
      // See Section 3.6.4 of RFC 2822
  
      /**
       * The name of the RFC 2822 header that stores the message id.
       */
      public final static String MESSAGE_ID = "Message-ID";
  
      /**
       * A common variation on the name of the RFC 2822 header that 
       * stores the message id.  This is needed for certain filters and
       * processing of incoming mail.
       */
      public final static String MESSAGE_ID_VARIATION = "Message-Id";
  
      /**
       * The name of the RFC 2822 header that stores the message id of the message
       * that to which this email is a reply.
       */
      public final static String IN_REPLY_TO = "In-Reply-To";
  
      /**
       * The name of the RFC 2822 header that is used to identify the thread to
       * which this message refers.
       */
      public final static String REFERENCES = "References";
  
      // See Section 3.6.5 of RFC 2822
  
      /**
       * The name of the RFC 2822 header that stores the subject.
       */
      public final static String SUBJECT = "Subject";
  
      /**
       * The name of the RFC 2822 header that stores human-readable comments.
       */
      public final static String COMMENTS = "Comments";
  
      /**
       * The name of the RFC 2822 header that stores human-readable keywords.
       */
      public final static String KEYWORDS = "Keywords";
  
      // See Section 3.6.6 of RFC 2822
  
      /**
       * The name of the RFC 2822 header that stores the date the message was resent.
       */
      public final static String RESENT_DATE = "Resent-Date";
  
      /**
       * The name of the RFC 2822 header that stores the originator of the resent message.
       */
      public final static String RESENT_FROM = "Resent-From";
  
      /**
       * The name of the RFC 2822 header that stores the transmission agent
       * of the resent message.
       */
      public final static String RESENT_SENDER = "Resent-Sender";
  
      /**
       * The name of the RFC 2822 header that stores the recipients
       * of the resent message.
       */
      public final static String RESENT_TO = "Resent-To";
  
      /**
       * The name of the RFC 2822 header that stores the carbon copied recipients
       * of the resent message.
       */
      public final static String RESENT_CC = "Resent-Cc";
  
      /**
       * The name of the RFC 2822 header that stores the blind carbon copied recipients
       * of the resent message.
       */
      public final static String RESENT_BCC = "Resent-Bcc";
  
      /**
       * The name of the RFC 2822 header that stores the message id
       * of the resent message.
       */
      public final static String RESENT_MESSAGE_ID = "Resent-Message-ID";
  
      // See Section 3.6.7 of RFC 2822
  
      /**
       * The name of the RFC 2822 headers that store the tracing data for the return path.
       */
      public final static String RETURN_PATH = "Return-Path";
  
      /**
       * The name of the RFC 2822 headers that store additional tracing data.
       */
      public final static String RECEIVED = "Received";
  
      // MIME headers
  
      /**
       * The name of the MIME header that stores the content type.
       */
      public final static String CONTENT_TYPE = "Content-Type";
  
      /**
       * Private constructor to prevent instantiation
       */
      private RFC2822Headers() {}
  
  }
  
  
  
  1.6       +1 -1      jakarta-james/src/java/org/apache/james/core/MailHeaders.java
  
  Index: MailHeaders.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/core/MailHeaders.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MailHeaders.java	6 Jan 2003 17:08:43 -0000	1.5
  +++ MailHeaders.java	7 Jan 2003 11:06:35 -0000	1.6
  @@ -17,7 +17,7 @@
   import javax.mail.MessagingException;
   import javax.mail.internet.InternetHeaders;
   
  -import org.apache.james.util.RFC2822Headers;
  +import org.apache.mailet.RFC2822Headers;
   
   /**
    * This interface defines a container for mail headers. Each header must use
  
  
  
  1.19      +1 -1      jakarta-james/src/java/org/apache/james/core/MailImpl.java
  
  Index: MailImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/core/MailImpl.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- MailImpl.java	6 Jan 2003 17:08:43 -0000	1.18
  +++ MailImpl.java	7 Jan 2003 11:06:35 -0000	1.19
  @@ -27,9 +27,9 @@
   import javax.mail.internet.ParseException;
   
   import org.apache.avalon.framework.activity.Disposable;
  -import org.apache.james.util.RFC2822Headers;
   import org.apache.mailet.Mail;
   import org.apache.mailet.MailAddress;
  +import org.apache.mailet.RFC2822Headers;
   
   /**
    * Wraps a MimeMessage adding routing information (from SMTP) and some simple
  
  
  
  1.19      +2 -2      jakarta-james/src/java/org/apache/james/core/MimeMessageWrapper.java
  
  Index: MimeMessageWrapper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/core/MimeMessageWrapper.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- MimeMessageWrapper.java	6 Jan 2003 17:08:43 -0000	1.18
  +++ MimeMessageWrapper.java	7 Jan 2003 11:06:35 -0000	1.19
  @@ -38,8 +38,8 @@
   
   import org.apache.avalon.framework.activity.Disposable;
   import org.apache.james.util.InternetPrintWriter;
  -import org.apache.james.util.RFC2822Headers;
  -import org.apache.james.util.RFC822DateFormat;
  +import org.apache.mailet.RFC2822Headers;
  +import org.apache.mailet.dates.RFC822DateFormat;
   
   
   /**
  
  
  
  1.5       +1 -1      jakarta-james/src/java/org/apache/james/transport/matchers/NESSpamCheck.java
  
  Index: NESSpamCheck.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/matchers/NESSpamCheck.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NESSpamCheck.java	6 Jan 2003 17:08:48 -0000	1.4
  +++ NESSpamCheck.java	7 Jan 2003 11:06:36 -0000	1.5
  @@ -12,9 +12,9 @@
   import javax.mail.MessagingException;
   import javax.mail.internet.MimeMessage;
   
  -import org.apache.james.util.RFC2822Headers;
   import org.apache.mailet.GenericMatcher;
   import org.apache.mailet.Mail;
  +import org.apache.mailet.RFC2822Headers;
   import org.apache.oro.text.regex.MalformedPatternException;
   import org.apache.oro.text.regex.Pattern;
   import org.apache.oro.text.regex.Perl5Compiler;
  
  
  
  1.4       +1 -1      jakarta-james/src/java/org/apache/james/transport/matchers/RelayLimit.java
  
  Index: RelayLimit.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/transport/matchers/RelayLimit.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RelayLimit.java	14 Sep 2002 06:22:37 -0000	1.3
  +++ RelayLimit.java	7 Jan 2003 11:06:36 -0000	1.4
  @@ -7,9 +7,9 @@
    */
   package org.apache.james.transport.matchers;
   
  -import org.apache.james.util.RFC2822Headers;
   import org.apache.mailet.GenericMatcher;
   import org.apache.mailet.Mail;
  +import org.apache.mailet.RFC2822Headers;
   
   import javax.mail.Header;
   import javax.mail.internet.MimeMessage;
  
  
  
  1.28      +3 -3      jakarta-james/src/java/org/apache/james/nntpserver/NNTPHandler.java
  
  Index: NNTPHandler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/nntpserver/NNTPHandler.java,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- NNTPHandler.java	6 Jan 2003 17:08:44 -0000	1.27
  +++ NNTPHandler.java	7 Jan 2003 11:06:36 -0000	1.28
  @@ -31,11 +31,11 @@
   import org.apache.james.nntpserver.repository.NNTPGroup;
   import org.apache.james.nntpserver.repository.NNTPLineReaderImpl;
   import org.apache.james.util.InternetPrintWriter;
  -import org.apache.james.util.RFC2980DateFormat;
  -import org.apache.james.util.RFC977DateFormat;
  -import org.apache.james.util.SimplifiedDateFormat;
   import org.apache.james.util.watchdog.Watchdog;
   import org.apache.james.util.watchdog.WatchdogTarget;
  +import org.apache.mailet.dates.RFC2980DateFormat;
  +import org.apache.mailet.dates.RFC977DateFormat;
  +import org.apache.mailet.dates.SimplifiedDateFormat;
   
   /**
    * The NNTP protocol is defined by RFC 977.
  
  
  
  1.6       +2 -0      jakarta-james/src/java/org/apache/james/util/RFC822Date.java
  
  Index: RFC822Date.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/src/java/org/apache/james/util/RFC822Date.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- RFC822Date.java	16 Aug 2002 21:06:32 -0000	1.5
  +++ RFC822Date.java	7 Jan 2003 11:06:38 -0000	1.6
  @@ -13,6 +13,8 @@
   import java.util.Locale;
   import java.util.TimeZone;
   
  +import org.apache.mailet.dates.RFC822DateFormat;
  +
   /**
    * A utility class to allow creation of RFC822 date strings from Dates 
    * and dates from RFC822 strings<br>
  
  
  
  1.1                  jakarta-james/src/java/org/apache/mailet/dates/RFC2980DateFormat.java
  
  Index: RFC2980DateFormat.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.mailet.dates;
  
  import java.util.Locale;
  
  /**
   * A thread-safe date formatting class to produce dates formatted in accord with the 
   * specifications of section 3.2 of RFC 2980.
   *
   * @author Peter M. Goldstein <fa...@alum.mit.edu>
   */
  public class RFC2980DateFormat extends SynchronizedDateFormat {
  
      /**
       * Constructor for RFC2980DateFormat
       */
      public RFC2980DateFormat() {
          super("yyyyMMddHHmmss", Locale.ENGLISH);
      }
  }
  
  
  
  1.1                  jakarta-james/src/java/org/apache/mailet/dates/RFC822DateFormat.java
  
  Index: RFC822DateFormat.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.mailet.dates;
  
  import java.util.Date;
  
  import javax.mail.internet.MailDateFormat;
  
  
  /**
   * A thread safe wrapper for the <code>javax.mail.internet.MailDateFormat</code> class.
   *
   * @author Serge Knystautas <se...@lokitech.com>
   * @author Peter M. Goldstein <fa...@alum.mit.edu>
   */
  public class RFC822DateFormat extends SynchronizedDateFormat {
      /**
       * A static instance of the RFC822DateFormat, used by toString
       */
      private static RFC822DateFormat instance; 
  
      static {
          instance = new RFC822DateFormat();
      }
  
      /**
       * This static method allows us to format RFC822 dates without
       * explicitly instantiating an RFC822DateFormat object.
       *
       * @return java.lang.String
       * @param d Date
       *
       * @deprecated This method is not necessary and is preserved for API
       *             backwards compatibility.  Users of this class should
       *             instantiate an instance and use it as they would any
       *             other DateFormat object.
       */
      public static String toString(Date d) {
          return instance.format(d);
      }
  
      /**
       * Constructor for RFC822DateFormat
       */
      public RFC822DateFormat() {
          super(new MailDateFormat());
      }
  }
  
  
  
  1.1                  jakarta-james/src/java/org/apache/mailet/dates/RFC977DateFormat.java
  
  Index: RFC977DateFormat.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.mailet.dates;
  
  import java.text.ParseException;
  import java.util.Date;
  import java.util.Locale;
  import java.util.TimeZone;
  
  /**
   * A thread-safe date formatting class to produce dates formatted in accord with the 
   * specifications of RFC 977.
   *
   * @author Peter M. Goldstein <fa...@alum.mit.edu>
   */
  public class RFC977DateFormat implements SimplifiedDateFormat {
  
      /**
       * Internal date formatter for long date formats
       */
      private final SynchronizedDateFormat internalLongDateFormat;
  
      /**
       * Internal date formatter for short date formats
       */
      private final SynchronizedDateFormat internalShortDateFormat;
  
      /**
       * Constructor for RFC977DateFormat
       */
      public RFC977DateFormat() {
          internalLongDateFormat = new SynchronizedDateFormat("yyyyMMdd HHmmss", Locale.ENGLISH);
          internalShortDateFormat = new SynchronizedDateFormat("yyMMdd HHmmss", Locale.ENGLISH);
      }
  
      /**
       * This method returns the long form of the RFC977 Date 
       *
       * @return java.lang.String
       * @param d Date
       */
      public String format(Date d) {
          return internalLongDateFormat.format(d);
      }
  
      /**
       * Parses text from the beginning of the given string to produce a date.
       * The method may not use the entire text of the given string.
       * <p>
       * This method is designed to be thread safe, so we wrap our delegated
       * parse method in an appropriate synchronized block.
       *
       * @param source A <code>String</code> whose beginning should be parsed.
       * @return A <code>Date</code> parsed from the string.
       * @throws ParseException if the beginning of the specified string
       *         cannot be parsed.
       */
      public Date parse(String source) throws ParseException {
          source = source.trim();
          if (source.indexOf(' ') == 6) {
              return internalShortDateFormat.parse(source);
          } else {
              return internalLongDateFormat.parse(source);
          }
      }
  
      /**
       * Sets the time zone of this SynchronizedDateFormat object.
       * @param zone the given new time zone.
       */
      public void setTimeZone(TimeZone zone) {
          synchronized(this) {
              internalShortDateFormat.setTimeZone(zone);
              internalLongDateFormat.setTimeZone(zone);
          }
      }
  
      /**
       * Gets the time zone.
       * @return the time zone associated with this SynchronizedDateFormat.
       */
      public TimeZone getTimeZone() {
          synchronized(this) {
              return internalShortDateFormat.getTimeZone();
          }
      }
  
      /**
       * Specify whether or not date/time parsing is to be lenient.  With
       * lenient parsing, the parser may use heuristics to interpret inputs that
       * do not precisely match this object's format.  With strict parsing,
       * inputs must match this object's format.
       * @param lenient when true, parsing is lenient
       * @see java.util.Calendar#setLenient
       */
      public void setLenient(boolean lenient)
      {
          synchronized(this) {
              internalShortDateFormat.setLenient(lenient);
              internalLongDateFormat.setLenient(lenient);
          }
      }
  
      /**
       * Tell whether date/time parsing is to be lenient.
       * @return whether this SynchronizedDateFormat is lenient.
       */
      public boolean isLenient()
      {
          synchronized(this) {
              return internalShortDateFormat.isLenient();
          }
      }
  
  
      /**
       * Overrides equals
       */
      public boolean equals(Object obj) {
          if (this == obj) {
              return true;
          }
          if (!(obj instanceof RFC977DateFormat)) {
              return false;
          }
          RFC977DateFormat theOtherRFC977DateFormat = (RFC977DateFormat)obj;
          synchronized (this) {
              return ((internalShortDateFormat.equals(theOtherRFC977DateFormat.internalShortDateFormat)) &&
                      (internalLongDateFormat.equals(theOtherRFC977DateFormat.internalLongDateFormat)));
          }
      }
  
      /**
       * Overrides hashCode
       */
      public int hashCode() {
          return (int)(internalLongDateFormat.hashCode() & internalShortDateFormat.hashCode());
      }
  
  }
  
  
  
  1.1                  jakarta-james/src/java/org/apache/mailet/dates/SimplifiedDateFormat.java
  
  Index: SimplifiedDateFormat.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.mailet.dates;
  
  import java.text.ParseException;
  import java.util.Date;
  import java.util.Locale;
  import java.util.TimeZone;
  
  /**
   * <p>This interface is designed to provide a simplified subset of the
   * methods provided by the <code>java.text.DateFormat</code> class.</p>
   *
   * <p>This interface is necessary because of the difficulty in writing
   * thread safe classes that inherit from <code>java.text.DateFormat</code>.
   * This difficulty leads us to approach the problem using composition
   * rather than inheritance.  In general classes that implement this
   * interface will delegate these calls to an internal DateFormat object.</p>
   *    
   * @author Peter M. Goldstein <fa...@alum.mit.edu>
   */
  public interface SimplifiedDateFormat {
  
      /**
       * Formats a Date into a date/time string.
       * @param date the time value to be formatted into a time string.
       * @return the formatted time string.
       */
      public String format(Date d);
  
      /**
       * Parses text from the beginning of the given string to produce a date.
       * The method may not use the entire text of the given string.
       *
       * @param source A <code>String</code> whose beginning should be parsed.
       * @return A <code>Date</code> parsed from the string.
       * @throws ParseException if the beginning of the specified string
       *         cannot be parsed.
       */
      public Date parse(String source) throws ParseException;
  
      /**
       * Sets the time zone of this SimplifiedDateFormat object.
       * @param zone the given new time zone.
       */
      public void setTimeZone(TimeZone zone);
  
      /**
       * Gets the time zone.
       * @return the time zone associated with this SimplifiedDateFormat.
       */
      public TimeZone getTimeZone();
  
      /**
       * Specify whether or not date/time parsing is to be lenient.  With
       * lenient parsing, the parser may use heuristics to interpret inputs that
       * do not precisely match this object's format.  With strict parsing,
       * inputs must match this object's format.
       * @param lenient when true, parsing is lenient
       * @see java.util.Calendar#setLenient
       */
      public void setLenient(boolean lenient);
  
      /**
       * Tell whether date/time parsing is to be lenient.
       * @return whether this SimplifiedDateFormat is lenient.
       */
      public boolean isLenient();
  }
  
  
  
  
  1.1                  jakarta-james/src/java/org/apache/mailet/dates/SynchronizedDateFormat.java
  
  Index: SynchronizedDateFormat.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.mailet.dates;
  
  import java.text.DateFormat;
  import java.text.ParseException;
  import java.text.SimpleDateFormat;
  import java.util.Date;
  import java.util.Locale;
  import java.util.TimeZone;
  
  
  /**
   * This class is designed to be a synchronized wrapper for a 
   * <code>java.text.DateFormat</code> subclass.  In general,
   * these subclasses (most notably the <code>java.text.SimpleDateFormat</code>
   * classes are not thread safe, so we need to synchronize on the 
   * internal DateFormat for all delegated calls.   
   *
   * @author Peter M. Goldstein <fa...@alum.mit.edu>
   */
  public class SynchronizedDateFormat implements SimplifiedDateFormat {
      private final DateFormat internalDateFormat;
  
      /**
       * Public constructor that mimics that of SimpleDateFormat.  See
       * java.text.SimpleDateFormat for more details.
       *
       * @param pattern the pattern that defines this DateFormat
       * @param locale the locale
       */
      public SynchronizedDateFormat(String pattern, Locale locale) {
          internalDateFormat = new SimpleDateFormat(pattern, locale);
      }
  
      /**
       * <p>Wrapper method to allow child classes to synchronize a preexisting
       * DateFormat.</p>
       *
       * <p>TODO: Investigate replacing this with a factory method.</p>
       *
       * @param the DateFormat to synchronize
       */
      protected SynchronizedDateFormat(DateFormat theDateFormat) {
          internalDateFormat = theDateFormat;
      }
  
      /**
       * SimpleDateFormat will handle most of this for us, but we
       * want to ensure thread safety, so we wrap the call in a
       * synchronized block.
       *
       * @return java.lang.String
       * @param d Date
       */
      public String format(Date d) {
          synchronized (internalDateFormat) {
             return internalDateFormat.format(d);
          }
      }
  
      /**
       * Parses text from the beginning of the given string to produce a date.
       * The method may not use the entire text of the given string.
       * <p>
       * This method is designed to be thread safe, so we wrap our delegated
       * parse method in an appropriate synchronized block.
       *
       * @param source A <code>String</code> whose beginning should be parsed.
       * @return A <code>Date</code> parsed from the string.
       * @throws ParseException if the beginning of the specified string
       *         cannot be parsed.
       */
      public Date parse(String source) throws ParseException {
          synchronized (internalDateFormat) {
              return internalDateFormat.parse(source);
          }
      }
  
      /**
       * Sets the time zone of this SynchronizedDateFormat object.
       * @param zone the given new time zone.
       */
      public void setTimeZone(TimeZone zone) {
          synchronized(internalDateFormat) {
              internalDateFormat.setTimeZone(zone);
          }
      }
  
      /**
       * Gets the time zone.
       * @return the time zone associated with this SynchronizedDateFormat.
       */
      public TimeZone getTimeZone() {
          synchronized(internalDateFormat) {
              return internalDateFormat.getTimeZone();
          }
      }
  
      /**
       * Specify whether or not date/time parsing is to be lenient.  With
       * lenient parsing, the parser may use heuristics to interpret inputs that
       * do not precisely match this object's format.  With strict parsing,
       * inputs must match this object's format.
       * @param lenient when true, parsing is lenient
       * @see java.util.Calendar#setLenient
       */
      public void setLenient(boolean lenient)
      {
          synchronized(internalDateFormat) {
              internalDateFormat.setLenient(lenient);
          }
      }
  
      /**
       * Tell whether date/time parsing is to be lenient.
       * @return whether this SynchronizedDateFormat is lenient.
       */
      public boolean isLenient()
      {
          synchronized(internalDateFormat) {
              return internalDateFormat.isLenient();
          }
      }
  
      /**
       * Overrides hashCode
       */
      public int hashCode() {
          synchronized(internalDateFormat) {
              return internalDateFormat.hashCode();
          }
      }
  
      /**
       * Overrides equals
       */
      public boolean equals(Object obj) {
          if (this == obj) {
              return true;
          }
          if (obj == null || getClass() != obj.getClass()) {
              return false;
          }
          synchronized(internalDateFormat) {
              return internalDateFormat.equals(obj);
          }
      }
  
  }
  
  
  
  1.2       +1 -1      jakarta-james/tests/src/java/org/apache/james/testing/SMTPTest.java
  
  Index: SMTPTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-james/tests/src/java/org/apache/james/testing/SMTPTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SMTPTest.java	15 Oct 2002 04:36:31 -0000	1.1
  +++ SMTPTest.java	7 Jan 2003 11:06:39 -0000	1.2
  @@ -17,7 +17,7 @@
   import org.apache.commons.net.SocketClient;
   import org.apache.commons.net.smtp.SMTP;
   import org.apache.commons.net.smtp.SMTPClient;
  -import org.apache.james.util.RFC822DateFormat;
  +import org.apache.mailet.dates.RFC822DateFormat;
   
   /**
    * Send email. Can be configured and extended to test specific SMTP
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>