vincenzo    2003/06/27 07:34:38

  Modified:    src/java/org/apache/james/transport/mailets Tag:
                        branch_2_1_fcs AbstractNotify.java
                        AbstractRedirect.java Bounce.java Forward.java
                        NotifyPostmaster.java NotifySender.java
                        Redirect.java
  Added:       src/java/org/apache/james/transport/mailets Tag:
                        branch_2_1_fcs Resend.java
  Log:
  1) Moved all default init parameters management up to AbstractRedirect, and changed 
consequently all the subclasses.
  2) Added new Resend mailet that can replace Redirect having a consistent default 
behaviour and adds support for new <subject> parameter.
  3) Added support of <replyTo>null</replyTo> that deletes the "ReplyTo:" header from 
the resent message.
  4) Javadoc changed accordingly and further cleaned.
  5) During initialization all the classes check that only the allowed init parameters 
are used, throwing an exception if any unknown are found.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.7   +44 -17    
jakarta-james/src/java/org/apache/james/transport/mailets/AbstractNotify.java
  
  Index: AbstractNotify.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/AbstractNotify.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- AbstractNotify.java       25 Jun 2003 22:02:31 -0000      1.1.2.6
  +++ AbstractNotify.java       27 Jun 2003 14:34:37 -0000      1.1.2.7
  @@ -102,18 +102,19 @@
    * <P>Sample configuration common to all notification mailet subclasses:</P>
    * <PRE><CODE>
    * &lt;mailet match="All" class="<I>a notification mailet</I>">
  - *   &lt;sendingAddress&gt;<I>an address or postmaster or sender or unaltered, 
default=postmaster</I>&lt;/sendingAddress&gt;
  - *   &lt;attachStackTrace&gt;<I>true or false, 
default=false</I>&lt;/attachStackTrace&gt;
  - *   &lt;notice&gt;<I>notice attached to the message (optional)</I>&lt;/notice&gt;
  + *   &lt;sender&gt;<I>an address or postmaster or sender or unaltered, 
default=postmaster</I>&lt;/sender&gt;
  + *   &lt;attachError&gt;<I>true or false, default=false</I>&lt;/attachError&gt;
  + *   &lt;message&gt;<I>notice attached to the original message text 
(optional)</I>&lt;/message&gt;
    *   &lt;prefix&gt;<I>optional subject prefix prepended to the original 
message</I>&lt;/prefix&gt;
    *   &lt;inline&gt;<I>see [EMAIL PROTECTED] Redirect}, 
default=none</I>&lt;/inline&gt;
    *   &lt;attachment&gt;<I>see [EMAIL PROTECTED] Redirect}, 
default=message</I>&lt;/attachment&gt;
    *   &lt;passThrough&gt;<I>true or false, default=true</I>&lt;/passThrough&gt;
    *   &lt;fakeDomainCheck&gt;<I>true or false, 
default=true</I>&lt;/fakeDomainCheck&gt;
  + *   &lt;debug&gt;<I>true or false, default=false</I>&lt;/debug&gt;
    * &lt;/mailet&gt;
    * </CODE></PRE>
  - * <I>message</I> and <I>attachError</I> can be used instead of
  - * <I>notice and </I> and <I>attachStackTrace</I>.
  + * <P><I>notice</I>, <I>senderAddress</I> and <I>attachStackTrace</I> can be used 
instead of
  + * <I><I>message</I>, <I>sender</I> and <I>attachError</I>; such names are kept for 
backward compatibility.</P>
    *
    * @version CVS $Revision$ $Date$
    * @since 2.2.0
  @@ -158,7 +159,8 @@
       }
   
       /**
  -     * @return the <CODE>notice</CODE> init parameter, or the <CODE>message</CODE> 
init parameter if missing,
  +     * @return the <CODE>notice</CODE> init parameter,
  +     * or the <CODE>message</CODE> init parameter if missing,
        * or a default string if both are missing
        */
       protected String getMessage() {
  @@ -238,27 +240,52 @@
           return sout.toString();
       }
   
  +    // All subclasses of AbstractNotify are expected to establish their own 
recipients
  +    abstract protected Collection getRecipients() throws MessagingException;
  +
  +    /**
  +     * @return null
  +     */
  +    protected InternetAddress[] getTo() throws MessagingException {
  +        return null;
  +    }
  +
  +    /**
  +     * @return <CODE>SpecialAddress.NULL</CODE>, that will remove the "ReplyTo:" 
header
  +     */
  +    protected MailAddress getReplyTo() throws MessagingException {
  +        return SpecialAddress.NULL;
  +    }
  +
       /**
  -     * @return the value of the <CODE>sendingAddress</CODE> init parameter if not 
null,
  -     * the postmaster address otherwise
  +     * @return null
  +     */
  +    protected MailAddress getReturnPath() throws MessagingException {
  +        return null;
  +    }
  +
  +    /**
  +     * @return the value of the <CODE>sendingAddress</CODE> init parameter,
  +     * or the value of the <CODE>sender</CODE> init parameter if missing,
  +     * or the postmaster address if both are missing
        */
       protected MailAddress getSender() throws MessagingException {
           if (getInitParameter("sendingAddress") == null) {
  -            return getMailetContext().getPostmaster();
  +            if (getInitParameter("sender") == null) {
  +                return getMailetContext().getPostmaster();
  +            } else {
  +                return new MailAddress(getInitParameter("sender"));
  +            }
           } else {
               return new MailAddress(getInitParameter("sendingAddress"));
           }
       }
   
       /**
  -     * @return the <CODE>prefix</CODE> init parameter or an empty string if missing
  +     * @return null
        */
  -    protected String getSubjectPrefix() throws MessagingException {
  -        if(getInitParameter("prefix") == null) {
  -            return "";
  -        } else {
  -            return getInitParameter("prefix");
  -        }
  +    protected String getSubject() throws MessagingException {
  +        return null;
       }
   
       /**
  
  
  
  1.1.2.13  +261 -33   
jakarta-james/src/java/org/apache/james/transport/mailets/AbstractRedirect.java
  
  Index: AbstractRedirect.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/AbstractRedirect.java,v
  retrieving revision 1.1.2.12
  retrieving revision 1.1.2.13
  diff -u -r1.1.2.12 -r1.1.2.13
  --- AbstractRedirect.java     25 Jun 2003 22:02:31 -0000      1.1.2.12
  +++ AbstractRedirect.java     27 Jun 2003 14:34:37 -0000      1.1.2.13
  @@ -103,7 +103,8 @@
    * <LI>getReplyTo(), where replies to this message will be sent</LI>
    * <LI>getReturnPath(), what to set the Return-Path to</LI>
    * <LI>getSender(), who the mail is from</LI>
  - * <LI>getSubjectPrefix(), a prefix to be added to the message subject</LI>
  + * <LI>getSubject(), a string to replace the message subject</LI>
  + * <LI>getSubjectPrefix(), a prefix to be added to the message subject, possibly 
already replaced by a new subject</LI>
    * <LI>getTo(), a list of people to whom the mail is *apparently* sent</LI>
    * <LI>isReply(), should this mailet set the IN_REPLY_TO header to the id of the 
current message</LI>
    * <LI>getPassThrough(), should this mailet allow the original message to continue 
processing or GHOST it.</LI>
  @@ -168,7 +169,16 @@
    */
   
   public abstract class AbstractRedirect extends GenericMailet {
  -
  +    
  +    /**
  +     * Gets the expected init parameters.
  +     *
  +     * @return null meaning no check
  +     */
  +    protected  String[] getAllowedInitParameters() {
  +        return null;
  +    }
  +    
       /**
        * Controls certain log messages.
        */
  @@ -241,6 +251,7 @@
       private MailAddress replyTo;
       private MailAddress returnPath;
       private MailAddress sender;
  +    private String subject;
       private String subjectPrefix;
       private InternetAddress[] apparentlyTo;
       private boolean attachError = false;
  @@ -338,12 +349,16 @@
        * </ul>
        * Is a "getX()" method.
        *
  -     * @return UNALTERED
  +     * @return the <CODE>inline</CODE> init parameter, or <CODE>UNALTERED</CODE> if 
missing
        */
       protected int getInLineType() throws MessagingException {
  -        return UNALTERED;
  +        if(getInitParameter("inline") == null) {
  +            return UNALTERED;
  +        } else {
  +            return getTypeCode(getInitParameter("inline"));
  +        }
       }
  -
  +    
       /**
        * Gets the <CODE>inline</CODE> property,
        * built dynamically using the original Mail object.
  @@ -368,10 +383,14 @@
        * </ul>
        * Is a "getX()" method.
        *
  -     * @return NONE
  +     * @return the <CODE>attachment</CODE> init parameter, or <CODE>NONE</CODE> if 
missing
        */
       protected int getAttachmentType() throws MessagingException {
  -        return NONE;
  +        if(getInitParameter("attachment") == null) {
  +            return NONE;
  +        } else {
  +            return getTypeCode(getInitParameter("attachment"));
  +        }
       }
   
       /**
  @@ -392,10 +411,14 @@
        * to build the new message.
        * Is a "getX()" method.
        *
  -     * @return ""
  +     * @return the <CODE>message</CODE> init parameter or an empty string if missing
        */
       protected String getMessage() throws MessagingException {
  -        return "";
  +        if(getInitParameter("message") == null) {
  +            return "";
  +        } else {
  +            return getInitParameter("message");
  +        }
       }
   
       /**
  @@ -416,10 +439,38 @@
        * or null if no change is requested.
        * Is a "getX()" method.
        *
  -     * @return null
  +     * @return the <CODE>recipients</CODE> init parameter
  +     * or the postmaster address
  +     * or <CODE>SpecialAddress.SENDER</CODE>
  +     * or <CODE>SpecialAddress.RETURN_PATH</CODE>
  +     * or <CODE>SpecialAddress.UNALTERED</CODE>
  +     * or <CODE>null</CODE> if missing
        */
       protected Collection getRecipients() throws MessagingException {
  -        return null;
  +        Collection newRecipients = new HashSet();
  +        String addressList = getInitParameter("recipients");
  +        
  +        // if nothing was specified, return <CODE>null</CODE> meaning no change
  +        if (addressList == null) {
  +            return null;
  +        }
  +
  +        MailAddress specialAddress = getSpecialAddress(addressList,
  +                                        new String[] {"postmaster", "sender", 
"returnPath", "unaltered"});
  +        if (specialAddress != null) {
  +            newRecipients.add(specialAddress);
  +            return newRecipients;
  +        }
  +
  +        StringTokenizer st = new StringTokenizer(addressList, ",", false);
  +        while(st.hasMoreTokens()) {
  +            try {
  +                newRecipients.add(new MailAddress(st.nextToken()));
  +            } catch(Exception e) {
  +                log("add recipient failed in getRecipients");
  +            }
  +        }
  +        return newRecipients;
       }
   
       /**
  @@ -476,10 +527,41 @@
        * or null if no change is requested.
        * Is a "getX()" method.
        *
  -     * @return null
  +     * @return the <CODE>to</CODE> init parameter
  +     * or the postmaster address
  +     * or <CODE>SpecialAddress.SENDER</CODE>
  +     * or <CODE>SpecialAddress.RETURN_PATH</CODE>
  +     * or <CODE>SpecialAddress.UNALTERED</CODE>
  +     * or <CODE>null</CODE> if missing
        */
       protected InternetAddress[] getTo() throws MessagingException {
  -        return null;
  +        String addressList = getInitParameter("to");
  +        // if nothing was specified, return null meaning no change
  +        if (addressList == null) {
  +            return null;
  +        }
  +
  +        MailAddress specialAddress = getSpecialAddress(addressList,
  +                                        new String[] {"postmaster", "sender", 
"returnPath", "unaltered"});
  +        if (specialAddress != null) {
  +            InternetAddress[] iaarray = new InternetAddress[1];
  +            iaarray[0] = specialAddress.toInternetAddress();
  +            return iaarray;
  +        }
  +
  +        StringTokenizer rec       = new StringTokenizer(addressList, ",");
  +        int tokensn               = rec.countTokens();
  +        InternetAddress[] iaarray = new InternetAddress[tokensn];
  +        String tokenx             = "";
  +        for(int i = 0; i < tokensn; ++i) {
  +            try {
  +                tokenx     = rec.nextToken();
  +                iaarray[i] = new InternetAddress(tokenx);
  +            } catch(Exception e) {
  +                log("Internet address exception in getTo()");
  +            }
  +        }
  +        return iaarray;
       }
   
       /**
  @@ -582,9 +664,29 @@
        * or null if no change is requested.
        * Is a "getX()" method.
        *
  -     * @return null
  +     * @return the <CODE>replyto</CODE> init parameter
  +     * or the postmaster address
  +     * or <CODE>SpecialAddress.SENDER</CODE>
  +     * or <CODE>SpecialAddress.UNALTERED</CODE>
  +     * or <CODE>SpecialAddress.NULL</CODE>
  +     * or <CODE>null</CODE> if missing
        */
       protected MailAddress getReplyTo() throws MessagingException {
  +        String addressString = getInitParameter("replyto");
  +        if(addressString != null) {
  +            MailAddress specialAddress = getSpecialAddress(addressString,
  +                                            new String[] {"postmaster", "sender", 
"null", "unaltered"});
  +            if (specialAddress != null) {
  +                return specialAddress;
  +            }
  +
  +            try {
  +                return new MailAddress(addressString);
  +            } catch(Exception e) {
  +                log("Parse error in getReplyTo: " + addressString);
  +            }
  +        }
  +
           return null;
       }
   
  @@ -611,6 +713,7 @@
        * <P>If the requested value is <CODE>SpecialAddress.SENDER</CODE> will use the 
original "From:" header;
        * if this header is empty will use the original "Sender:" header;
        * if this header is empty will use the original sender.
  +     * If the requested value is <CODE>SpecialAddress.NULL</CODE> will remove the 
"Reply-To:" header.
        * If the requested value is null does nothing.</P>
        * Is a "setX(Mail, Tx, Mail)" method.
        */
  @@ -626,8 +729,13 @@
               }
               
               // do the job
  -            InternetAddress[] iart = new InternetAddress[1];
  -            iart[0] = replyTo.toInternetAddress();
  +            InternetAddress[] iart = null;
  +            if (replyTo != SpecialAddress.NULL) {
  +                iart = new InternetAddress[1];
  +                iart[0] = replyTo.toInternetAddress();
  +            }
  +            
  +            // Note: if iart is null will remove the header
               newMail.getMessage().setReplyTo(iart);
               
               if (isDebug) {
  @@ -642,9 +750,29 @@
        * or null if no change is requested.
        * Is a "getX()" method.
        *
  -     * @return null
  +     * @return the <CODE>returnPath</CODE> init parameter 
  +     * or the postmaster address
  +     * or <CODE>SpecialAddress.SENDER</CODE>
  +     * or <CODE>SpecialAddress.NULL</CODE>
  +     * or <CODE>SpecialAddress.UNALTERED</CODE>
  +     * or <CODE>null</CODE> if missing
        */
       protected MailAddress getReturnPath() throws MessagingException {
  +        String addressString = getInitParameter("returnPath");
  +        if(addressString != null) {
  +            MailAddress specialAddress = getSpecialAddress(addressString,
  +                                            new String[] {"postmaster", "sender", 
"null", "unaltered"});
  +            if (specialAddress != null) {
  +                return specialAddress;
  +            }
  +
  +            try {
  +                return new MailAddress(addressString);
  +            } catch(Exception e) {
  +                log("Parse error in getReturnPath: " + addressString);
  +            }
  +        }
  +
           return null;
       }
   
  @@ -698,9 +826,28 @@
        * or null if no change is requested.
        * Is a "getX()" method.
        *
  -     * @return null
  +     * @return the <CODE>sender</CODE> init parameter
  +     * or the postmaster address
  +     * or <CODE>SpecialAddress.SENDER</CODE>
  +     * or <CODE>SpecialAddress.UNALTERED</CODE>
  +     * or <CODE>null</CODE> if missing
        */
       protected MailAddress getSender() throws MessagingException {
  +        String addressString = getInitParameter("sender");
  +        if(addressString != null) {
  +            MailAddress specialAddress = getSpecialAddress(addressString,
  +                                            new String[] {"postmaster", "sender", 
"unaltered"});
  +            if (specialAddress != null) {
  +                return specialAddress;
  +            }
  +
  +            try {
  +                return new MailAddress(addressString);
  +            } catch(Exception e) {
  +                log("Parse error in getSender: " + addressString);
  +            }
  +        }
  +
           return null;
       }
   
  @@ -798,14 +945,45 @@
       }
   
       /**
  +     * Gets the <CODE>subject</CODE> property.
  +     * Returns a string for the new message subject.
  +     * Is a "getX()" method.
  +     *
  +     * @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");
  +        }
  +    }
  +
  +    /**
  +     * Gets the <CODE>subject</CODE> property,
  +     * built dynamically using the original Mail object.
  +     * Is a "getX(Mail)" method.
  +     *
  +     * @return [EMAIL PROTECTED] #getSubject()}
  +     */
  +    protected String getSubject(Mail originalMail) throws MessagingException {
  +        String subject = (isStatic()) ? this.subject : getSubject();
  +        return subject;
  +    }
  +
  +    /**
        * Gets the <CODE>prefix</CODE> property.
        * Returns a prefix for the new message subject.
        * Is a "getX()" method.
        *
  -     * @return ""
  +     * @return the <CODE>prefix</CODE> init parameter or an empty string if missing
        */
       protected String getSubjectPrefix() throws MessagingException {
  -        return "";
  +        if(getInitParameter("prefix") == null) {
  +            return "";
  +        } else {
  +            return getInitParameter("prefix");
  +        }
       }
   
       /**
  @@ -825,7 +1003,10 @@
        * of <I>originalMail</I> to <I>subjectPrefix</I>.
        */
       protected void setSubjectPrefix(Mail newMail, String subjectPrefix, Mail 
originalMail) throws MessagingException {
  -        String subject = originalMail.getMessage().getSubject();
  +        String subject = getSubject(originalMail);
  +        if (subject == null) {
  +            subject = originalMail.getMessage().getSubject();
  +        }
           if (subject == null) {
               subject = "";
           }
  @@ -841,10 +1022,14 @@
        * of the new message, if getInlineType does not return "UNALTERED".
        * Is a "getX()" method.
        *
  -     * @return false
  +     * @return the <CODE>attachError</CODE> init parameter; false if missing
        */
       protected boolean attachError() throws MessagingException {
  -        return false;
  +        if(getInitParameter("attachError") == null) {
  +            return false;
  +        } else {
  +            return new Boolean(getInitParameter("attachError")).booleanValue();
  +        }
       }
   
       /**
  @@ -866,10 +1051,13 @@
        * message to the id of the original message.
        * Is a "getX()" method.
        *
  -     * @return false
  +     * @return the <CODE>isReply</CODE> init parameter; false if missing
        */
       protected boolean isReply() throws MessagingException {
  -        return false;
  +        if(getInitParameter("isReply") == null) {
  +            return false;
  +        }
  +        return new Boolean(getInitParameter("isReply")).booleanValue();
       }
   
       /**
  @@ -910,13 +1098,17 @@
        * using getX(), if [EMAIL PROTECTED] #isStatic()} returns true.
        */
       public void init() throws MessagingException {
  -        if (isDebug) {
  -            log("Redirect init");
  -        }
           isDebug = (getInitParameter("debug") == null) ? false : new 
Boolean(getInitParameter("debug")).booleanValue();
   
           isStatic = (getInitParameter("static") == null) ? false : new 
Boolean(getInitParameter("static")).booleanValue();
   
  +        if (isDebug) {
  +            log("Initializing");
  +        }
  +        
  +        // check that all init parameters have been declared in 
allowedInitParameters
  +        checkInitParameters(getAllowedInitParameters());
  +        
           if(isStatic()) {
               passThrough     = getPassThrough();
               fakeDomainCheck = getFakeDomainCheck();
  @@ -927,6 +1119,7 @@
               replyTo         = getReplyTo();
               returnPath      = getReturnPath();
               sender          = getSender();
  +            subject         = getSubject();
               subjectPrefix   = getSubjectPrefix();
               apparentlyTo    = getTo();
               attachError     = attachError();
  @@ -942,6 +1135,7 @@
                               .append(", returnPath=").append(returnPath)
                               .append(", message=").append(messageText)
                               .append(", 
recipients=").append(arrayToString(recipients == null ? null : recipients.toArray()))
  +                            .append(", subject=").append(subject)
                               .append(", subjectPrefix=").append(subjectPrefix)
                               .append(", 
apparentlyTo=").append(arrayToString(apparentlyTo))
                               .append(", attachError=").append(attachError)
  @@ -1459,10 +1653,7 @@
       }
   
       /**
  -     * <P>Checks if a sender domain of <I>mail</I> is valid.
  -     * It is valid if the sender is null or
  -     * [EMAIL PROTECTED] org.apache.mailet.MailetContext#getMailServers} returns 
true for
  -     * the sender host part.</P>
  +     * <P>Checks if a sender domain of <I>mail</I> is valid.</P>
        * <P>If we do not do this check, and someone uses a redirection mailet in a
        * processor initiated by SenderInFakeDomain, then a fake
        * sender domain will cause an infinite loop (the forwarded
  @@ -1471,10 +1662,47 @@
        * consequences of such a mis-configuration are severe enough
        * to warrant protecting against the infinite loop.</P>
        * <P>This check can be skipped if [EMAIL PROTECTED] #getFakeDomainCheck(Mail)} 
returns true.</P> 
  +     *
  +     * @param mail the mail object to check
  +     * @return true if the if the sender is null or
  +     * [EMAIL PROTECTED] org.apache.mailet.MailetContext#getMailServers} returns 
true for
  +     * the sender host part
        */
       protected final boolean senderDomainIsValid(Mail mail) throws 
MessagingException {
           if (getFakeDomainCheck(mail)) {
               return mail.getSender() == null || 
getMailetContext().getMailServers(mail.getSender().getHost()).size() != 0;
           } else return true;
       }
  +    
  +    /**
  +     * Checks if there are unallowed init parameters specified in the configuration 
file
  +     * against the String[] allowedInitParameters.
  +     */
  +    private void checkInitParameters(String[] allowedArray) throws 
MessagingException {
  +        // if null then no check is requested
  +        if (allowedArray == null) {
  +            return;
  +        }
  +        
  +        Collection allowed = new HashSet();
  +        Collection bad = new ArrayList();
  +        
  +        for (int i = 0; i < allowedArray.length; i++) {
  +            allowed.add(allowedArray[i]);
  +        }
  +        
  +        Iterator iterator = getInitParameterNames();
  +        while (iterator.hasNext()) {
  +            String parameter = (String) iterator.next();
  +            if (!allowed.contains(parameter)) {
  +                bad.add(parameter);
  +            }
  +        }
  +        
  +        if (bad.size() > 0) {
  +            throw new MessagingException("Unexpected init parameters found: "
  +                                         + arrayToString(bad.toArray()));
  +        }
  +    }
  +
   }
  
  
  
  1.1.2.7   +33 -11    
jakarta-james/src/java/org/apache/james/transport/mailets/Bounce.java
  
  Index: Bounce.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/Bounce.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- Bounce.java       25 Jun 2003 22:02:32 -0000      1.1.2.6
  +++ Bounce.java       27 Jun 2003 14:34:37 -0000      1.1.2.7
  @@ -103,21 +103,22 @@
    * <P>Sample configuration:</P>
    * <PRE><CODE>
    * &lt;mailet match="All" class="Bounce">
  - *   &lt;sendingAddress&gt;<I>an address or postmaster or sender or unaltered, 
default=postmaster</I>&lt;/sendingAddress&gt;
  - *   &lt;attachStackTrace&gt;<I>true or false, 
default=false</I>&lt;/attachStackTrace&gt;
  - *   &lt;notice&gt;<I>notice attached to the message (optional)</I>&lt;/notice&gt;
  + *   &lt;sender&gt;<I>an address or postmaster or sender or unaltered, 
default=postmaster</I>&lt;/sender&gt;
  + *   &lt;attachError&gt;<I>true or false, default=false</I>&lt;/attachError&gt;
  + *   &lt;message&gt;<I>notice attached to the original message text 
(optional)</I>&lt;/message&gt;
    *   &lt;prefix&gt;<I>optional subject prefix prepended to the original 
message</I>&lt;/prefix&gt;
  - *   &lt;inline&gt;<I>see [EMAIL PROTECTED] Redirect}, 
default=none</I>&lt;/inline&gt;
  - *   &lt;attachment&gt;<I>see [EMAIL PROTECTED] Redirect}, 
default=message</I>&lt;/attachment&gt;
  + *   &lt;inline&gt;<I>see [EMAIL PROTECTED] Resend}, default=none</I>&lt;/inline&gt;
  + *   &lt;attachment&gt;<I>see [EMAIL PROTECTED] Resend}, 
default=message</I>&lt;/attachment&gt;
    *   &lt;passThrough&gt;<I>true or false, default=true</I>&lt;/passThrough&gt;
    *   &lt;fakeDomainCheck&gt;<I>true or false, 
default=true</I>&lt;/fakeDomainCheck&gt;
  + *   &lt;debug&gt;<I>true or false, default=false</I>&lt;/debug&gt;
    * &lt;/mailet&gt;
    * </CODE></PRE>
    *
  - * <P>The behaviour of this mailet is equivalent to using Redirect with the 
following
  + * <P>The behaviour of this mailet is equivalent to using Resend with the following
    * configuration:</P>
    * <PRE><CODE>
  - * &lt;mailet match="All" class="Redirect">
  + * &lt;mailet match="All" class="Resend">
    *   &lt;sender&gt;<I>an address or postmaster or sender or 
unaltered</I>&lt;/sender&gt;
    *   &lt;attachError&gt;<I>true or false</I>&lt;/attachError&gt;
    *   &lt;message&gt;<I><B>dynamically built</B></I>&lt;/message&gt;
  @@ -126,12 +127,14 @@
    *   &lt;fakeDomainCheck&gt;<I>true or false</I>&lt;/fakeDomainCheck&gt;
    *   &lt;recipients&gt;<B>sender</B>&lt;/recipients&gt;
    *   &lt;returnPath&gt;null&lt;/returnPath&gt;
  - *   &lt;inline&gt;see [EMAIL PROTECTED] Redirect}&lt;/inline&gt;
  - *   &lt;attachment&gt;see [EMAIL PROTECTED] Redirect}&lt;/attachment&gt;
  + *   &lt;inline&gt;see [EMAIL PROTECTED] Resend}&lt;/inline&gt;
  + *   &lt;attachment&gt;see [EMAIL PROTECTED] Resend}&lt;/attachment&gt;
    *   &lt;isReply&gt;true&lt;/isReply&gt;
  - *   &lt;static&gt;true&lt;/static&gt;
  + *   &lt;debug&gt;<I>true or false</I>&lt;/debug&gt;
    * &lt;/mailet&gt;
    * </CODE></PRE>
  + * <P><I>notice</I>, <I>senderAddress</I> and <I>attachStackTrace</I> can be used 
instead of
  + * <I><I>message</I>, <I>sender</I> and <I>attachError</I>; such names are kept for 
backward compatibility.</P>
    *
    * @version CVS $Revision$ $Date$
    * @since 2.2.0
  @@ -147,6 +150,25 @@
           return "Bounce Mailet";
       }
   
  +    /** Gets the expected init parameters. */
  +    protected  String[] getAllowedInitParameters() {
  +        String[] allowedArray = {
  +//            "static",
  +            "debug",
  +            "passThrough",
  +            "fakeDomainCheck",
  +            "inline",
  +            "attachment",
  +            "message",
  +            "notice",
  +            "sendingAddress",
  +            "prefix",
  +            "attachError",
  +            "attachStackTrace"
  +        };
  +        return allowedArray;
  +    }
  +    
       /* ******************************************************************** */
       /* ****************** Begin of getX and setX methods ****************** */
       /* ******************************************************************** */
  
  
  
  1.6.4.8   +99 -6     
jakarta-james/src/java/org/apache/james/transport/mailets/Forward.java
  
  Index: Forward.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/Forward.java,v
  retrieving revision 1.6.4.7
  retrieving revision 1.6.4.8
  diff -u -r1.6.4.7 -r1.6.4.8
  --- Forward.java      25 Jun 2003 22:02:32 -0000      1.6.4.7
  +++ Forward.java      27 Jun 2003 14:34:37 -0000      1.6.4.8
  @@ -63,12 +63,15 @@
   import org.apache.mailet.MailAddress;
   
   import javax.mail.MessagingException;
  +import javax.mail.internet.InternetAddress;
   import java.util.Collection;
   import java.util.HashSet;
   import java.util.StringTokenizer;
   
   /**
  - * Replaces incoming recipients with those specified, and resends the message 
unaltered.
  + * <P>Replaces incoming recipients with those specified, and resends the message 
unaltered.</P>
  + * <P>Can be totally replaced by an equivalent usage of [EMAIL PROTECTED] Resend} 
(see below),
  + * simply replacing <I>&lt;forwardto&gt;</I> with <I>&lt;recipients&gt</I>.
    *
    * <P>Sample configuration:</P>
    * <PRE><CODE>
  @@ -76,17 +79,18 @@
    *   &lt;forwardto&gt;<I>comma delimited list of email 
addresses</I>&lt;/forwardto&gt;
    *   &lt;passThrough&gt;<I>true or false, default=false</I>&lt;/passThrough&gt;
    *   &lt;fakeDomainCheck&gt;<I>true or false, 
default=true</I>&lt;/fakeDomainCheck&gt;
  + *   &lt;debug&gt;<I>true or false, default=false</I>&lt;/debug&gt;
    * &lt;/mailet&gt;
    * </CODE></PRE>
    *
  - * <P>The behaviour of this mailet is equivalent to using Redirect with the 
following
  + * <P>The behaviour of this mailet is equivalent to using Resend with the following
    * configuration:</P>
    * <PRE><CODE>
  - * &lt;mailet match="All" class="Redirect">
  + * &lt;mailet match="All" class="Resend">
  + *   &lt;recipients&gt;comma delimited list of email addresses&lt;/recipients&gt;
    *   &lt;passThrough&gt;true or false&lt;/passThrough&gt;
    *   &lt;fakeDomainCheck&gt;<I>true or false</I>&lt;/fakeDomainCheck&gt;
  - *   &lt;recipients&gt;comma delimited list of email addresses&lt;/recipients&gt;
  - *   &lt;inline&gt;unaltered&lt;/inline&gt;
  + *   &lt;debug&gt;<I>true or false</I>&lt;/debug&gt;
    * &lt;/mailet&gt;
    * </CODE></PRE>
    *
  @@ -103,11 +107,44 @@
           return "Forward Mailet";
       }
   
  +    /** Gets the expected init parameters. */
  +    protected  String[] getAllowedInitParameters() {
  +        String[] allowedArray = {
  +//            "static",
  +            "debug",
  +            "passThrough",
  +            "fakeDomainCheck",
  +            "forwardto",
  +        };
  +        return allowedArray;
  +    }
  +
       /* ******************************************************************** */
       /* ****************** Begin of getX and setX methods ****************** */
       /* ******************************************************************** */
   
       /**
  +     * @return UNALTERED
  +     */
  +    protected int getInLineType() throws MessagingException {
  +        return UNALTERED;
  +    }
  +
  +    /**
  +     * @return NONE
  +     */
  +    protected int getAttachmentType() throws MessagingException {
  +        return NONE;
  +    }
  +
  +    /**
  +     * @return ""
  +     */
  +    protected String getMessage() throws MessagingException {
  +        return "";
  +    }
  +
  +    /**
        * @return the <CODE>recipients</CODE> init parameter or null if missing
        */
       protected Collection getRecipients() throws MessagingException {
  @@ -126,6 +163,62 @@
               }
           }
           return newRecipients;
  +    }
  +
  +    /**
  +     * @return null
  +     */
  +    protected InternetAddress[] getTo() throws MessagingException {
  +        return null;
  +    }
  +
  +    /**
  +     * @return null
  +     */
  +    protected MailAddress getReplyTo() throws MessagingException {
  +        return null;
  +    }
  +
  +    /**
  +     * @return null
  +     */
  +    protected MailAddress getReturnPath() throws MessagingException {
  +        return null;
  +    }
  +
  +    /**
  +     * @return null
  +     */
  +    protected MailAddress getSender() throws MessagingException {
  +        return null;
  +    }
  +
  +    /**
  +     * @return null
  +     */
  +    protected String getSubject() throws MessagingException {
  +        return null;
  +    }
  +
  +    /**
  +     * @return ""
  +     */
  +    protected String getSubjectPrefix() throws MessagingException {
  +        return "";
  +    }
  +
  +    /**
  +     * @return false
  +     */
  +    protected boolean attachError() throws MessagingException {
  +        return false;
  +    }
  +
  +    /**
  +     * @return false
  +     */
  +    protected boolean isReply() throws MessagingException {
  +        return false;
       }
   
       /* ******************************************************************** */
  
  
  
  1.9.4.9   +35 -11    
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.4.8
  retrieving revision 1.9.4.9
  diff -u -r1.9.4.8 -r1.9.4.9
  --- NotifyPostmaster.java     25 Jun 2003 22:02:32 -0000      1.9.4.8
  +++ NotifyPostmaster.java     27 Jun 2003 14:34:37 -0000      1.9.4.9
  @@ -98,22 +98,23 @@
    * <P>Sample configuration:</P>
    * <PRE><CODE>
    * &lt;mailet match="All" class="NotifyPostmaster">
  - *   &lt;sendingAddress&gt;<I>an address or postmaster or sender or unaltered, 
default=postmaster</I>&lt;/sendingAddress&gt;
  - *   &lt;attachStackTrace&gt;<I>true or false, 
default=false</I>&lt;/attachStackTrace&gt;
  - *   &lt;notice&gt;<I>notice attached to the message (optional)</I>&lt;/notice&gt;
  + *   &lt;sender&gt;<I>an address or postmaster or sender or unaltered, 
default=postmaster</I>&lt;/sender&gt;
  + *   &lt;attachError&gt;<I>true or false, default=false</I>&lt;/attachError&gt;
  + *   &lt;message&gt;<I>notice attached to the original message text 
(optional)</I>&lt;/message&gt;
    *   &lt;prefix&gt;<I>optional subject prefix prepended to the original message, 
default="Re:"</I>&lt;/prefix&gt;
  - *   &lt;inline&gt;<I>see [EMAIL PROTECTED] Redirect}, 
default=none</I>&lt;/inline&gt;
  - *   &lt;attachment&gt;<I>see [EMAIL PROTECTED] Redirect}, 
default=message</I>&lt;/attachment&gt;
  + *   &lt;inline&gt;<I>see [EMAIL PROTECTED] Resend}, default=none</I>&lt;/inline&gt;
  + *   &lt;attachment&gt;<I>see [EMAIL PROTECTED] Resend}, 
default=message</I>&lt;/attachment&gt;
    *   &lt;passThrough&gt;<I>true or false, default=true</I>&lt;/passThrough&gt;
    *   &lt;fakeDomainCheck&gt;<I>true or false, 
default=true</I>&lt;/fakeDomainCheck&gt;
    *   &lt;to&gt;<I>unaltered (optional, defaults to postmaster)</I>&lt;/to&gt;
  + *   &lt;debug&gt;<I>true or false, default=false</I>&lt;/debug&gt;
    * &lt;/mailet&gt;
    * </CODE></PRE>
    *
  - * <P>The behaviour of this mailet is equivalent to using Redirect with the 
following
  + * <P>The behaviour of this mailet is equivalent to using Resend with the following
    * configuration:</P>
    * <PRE><CODE>
  - * &lt;mailet match="All" class="Redirect">
  + * &lt;mailet match="All" class="Resend">
    *   &lt;sender&gt;<I>an address or postmaster or sender or 
unaltered</I>&lt;/sender&gt;
    *   &lt;attachError&gt;<I>true or false</I>&lt;/attachError&gt;
    *   &lt;message&gt;<I><B>dynamically built</B></I>&lt;/message&gt;
  @@ -122,12 +123,14 @@
    *   &lt;fakeDomainCheck&gt;<I>true or false</I>&lt;/fakeDomainCheck&gt;
    *   &lt;to&gt;<I><B>unaltered or postmaster</B></I>&lt;/to&gt;
    *   &lt;recipients&gt;<B>postmaster</B>&lt;/recipients&gt;
  - *   &lt;inline&gt;see [EMAIL PROTECTED] Redirect}&lt;/inline&gt;
  - *   &lt;attachment&gt;see [EMAIL PROTECTED] Redirect}&lt;/attachment&gt;
  + *   &lt;inline&gt;see [EMAIL PROTECTED] Resend}&lt;/inline&gt;
  + *   &lt;attachment&gt;see [EMAIL PROTECTED] Resend}&lt;/attachment&gt;
    *   &lt;isReply&gt;true&lt;/isReply&gt;
  - *   &lt;static&gt;true&lt;/static&gt;
  + *   &lt;debug&gt;<I>true or false</I>&lt;/debug&gt;
    * &lt;/mailet&gt;
    * </CODE></PRE>
  + * <P><I>notice</I>, <I>senderAddress</I> and <I>attachStackTrace</I> can be used 
instead of
  + * <I><I>message</I>, <I>sender</I> and <I>attachError</I>; such names are kept for 
backward compatibility.</P>
    *
    * @version CVS $Revision$ $Date$
    */
  @@ -141,6 +144,27 @@
       public String getMailetInfo() {
           return "NotifyPostmaster Mailet";
       }
  +
  +    /** Gets the expected init parameters. */
  +    protected  String[] getAllowedInitParameters() {
  +        String[] allowedArray = {
  +//            "static",
  +            "debug",
  +            "passThrough",
  +            "fakeDomainCheck",
  +            "inline",
  +            "attachment",
  +            "message",
  +            "notice",
  +            "sendingAddress",
  +            "prefix",
  +            "attachError",
  +            "attachStackTrace",
  +            "to"
  +        };
  +        return allowedArray;
  +    }
  +    
       /* ******************************************************************** */
       /* ****************** Begin of getX and setX methods ****************** */
       /* ******************************************************************** */
  
  
  
  1.10.4.10 +31 -9     
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.4.9
  retrieving revision 1.10.4.10
  diff -u -r1.10.4.9 -r1.10.4.10
  --- NotifySender.java 25 Jun 2003 22:02:32 -0000      1.10.4.9
  +++ NotifySender.java 27 Jun 2003 14:34:37 -0000      1.10.4.10
  @@ -98,22 +98,22 @@
    * <P>Sample configuration:</P>
    * <PRE><CODE>
    * &lt;mailet match="All" class="NotifySender">
  - *   &lt;sendingAddress&gt;<I>an address or postmaster or sender or unaltered, 
default=postmaster</I>&lt;/sendingAddress&gt;
  - *   &lt;attachStackTrace&gt;<I>true or false, 
default=false</I>&lt;/attachStackTrace&gt;
  - *   &lt;notice&gt;<I>notice attached to the message (optional)</I>&lt;/notice&gt;
  + *   &lt;sender&gt;<I>an address or postmaster or sender or unaltered, 
default=postmaster</I>&lt;/sender&gt;
  + *   &lt;attachError&gt;<I>true or false, default=false</I>&lt;/attachError&gt;
    *   &lt;prefix&gt;<I>optional subject prefix prepended to the original 
message</I>&lt;/prefix&gt;
  - *   &lt;inline&gt;<I>see [EMAIL PROTECTED] Redirect}, 
default=none</I>&lt;/inline&gt;
  - *   &lt;attachment&gt;<I>see [EMAIL PROTECTED] Redirect}, 
default=message</I>&lt;/attachment&gt;
  + *   &lt;inline&gt;<I>see [EMAIL PROTECTED] Resend}, default=none</I>&lt;/inline&gt;
  + *   &lt;attachment&gt;<I>see [EMAIL PROTECTED] Resend}, 
default=message</I>&lt;/attachment&gt;
    *   &lt;passThrough&gt;<I>true or false, default=true</I>&lt;/passThrough&gt;
    *   &lt;fakeDomainCheck&gt;<I>true or false, 
default=true</I>&lt;/fakeDomainCheck&gt;
    *   &lt;to&gt;<I>unaltered (optional, defaults to sender)</I>&lt;/to&gt;
  + *   &lt;debug&gt;<I>true or false, default=false</I>&lt;/debug&gt;
    * &lt;/mailet&gt;
    * </CODE></PRE>
    *
  - * <P>The behaviour of this mailet is equivalent to using Redirect with the 
following
  + * <P>The behaviour of this mailet is equivalent to using Resend with the following
    * configuration:</P>
    * <PRE><CODE>
  - * &lt;mailet match="All" class="Redirect">
  + * &lt;mailet match="All" class="Resend">
    *   &lt;sender&gt;<I>an address or postmaster or sender or 
unaltered</I>&lt;/sender&gt;
    *   &lt;attachError&gt;<I>true or false</I>&lt;/attachError&gt;
    *   &lt;message&gt;<I><B>dynamically built</B></I>&lt;/message&gt;
  @@ -125,9 +125,11 @@
    *   &lt;inline&gt;none&lt;/inline&gt;
    *   &lt;attachment&gt;message&lt;/attachment&gt;
    *   &lt;isReply&gt;true&lt;/isReply&gt;
  - *   &lt;static&gt;true&lt;/static&gt;
  + *   &lt;debug&gt;<I>true or false</I>&lt;/debug&gt;
    * &lt;/mailet&gt;
    * </CODE></PRE>
  + * <P><I>notice</I>, <I>senderAddress</I> and <I>attachStackTrace</I> can be used 
instead of
  + * <I><I>message</I>, <I>sender</I> and <I>attachError</I>; such names are kept for 
backward compatibility.</P>
    *
    * @version CVS $Revision$ $Date$
    */
  @@ -142,6 +144,26 @@
           return "NotifySender Mailet";
       }
   
  +    /** Gets the expected init parameters. */
  +    protected  String[] getAllowedInitParameters() {
  +        String[] allowedArray = {
  +//            "static",
  +            "debug",
  +            "passThrough",
  +            "fakeDomainCheck",
  +            "inline",
  +            "attachment",
  +            "message",
  +            "notice",
  +            "sendingAddress",
  +            "prefix",
  +            "attachError",
  +            "attachStackTrace",
  +            "to"
  +        };
  +        return allowedArray;
  +    }
  +    
       /* ******************************************************************** */
       /* ****************** Begin of getX and setX methods ****************** */
       /* ******************************************************************** */
  
  
  
  1.18.4.13 +85 -167   
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.4.12
  retrieving revision 1.18.4.13
  diff -u -r1.18.4.12 -r1.18.4.13
  --- Redirect.java     25 Jun 2003 22:02:32 -0000      1.18.4.12
  +++ Redirect.java     27 Jun 2003 14:34:37 -0000      1.18.4.13
  @@ -87,14 +87,19 @@
   
   
   /**
  - * <P>A mailet providing configurable redirection services.<BR>
  - * This mailet can produce listserver, forward and notify behaviour, with the 
original
  - * message intact, attached, appended or left out altogether.<BR>
  - * This built in functionality is controlled by the configuration as laid out below.
  + * <P>A mailet providing configurable redirection services.</P>
  + * <P>Can produce listserver, forward and notify behaviour, with the original
  + * message intact, attached, appended or left out altogether.</P>
  + * <P>It is kept only for compatibility, use instead [EMAIL PROTECTED] Resend}.
  + * It differs from <CODE>Resend</CODE> because (i) some defaults are different,
  + * notably for the following parameters: <I>&lt;recipients&gt;</I>, 
<I>&lt;to&gt;</I> and <I>&lt;inline&gt;</I>;
  + * (ii) because it allows the use of the <I>&lt;static&gt;</I> parameter;
  + * (iii) because it lacks the <I>&lt;subject&gt;</I> parameter.</P>
  + * <P>This built in functionality is controlled by the configuration as laid out 
below.
    * In the table please note that the parameters controlling message headers
    * accept the <B>&quot;unaltered&quot;</B> value, whose meaning is to keep the 
associated
    * header unchanged and, unless stated differently, corresponds to the assumed 
default
  - * if the parameter is missing. 
  + * if the parameter is missing.</P>
    * <P>The configuration parameters are:</P>
    * <TABLE width="75%" border="1" cellspacing="2" cellpadding="2">
    * <TR valign=top>
  @@ -105,7 +110,7 @@
    * if none of the lists is specified.<BR>
    * These addresses will only appear in the To: header if no &quot;to&quot; list is
    * supplied.<BR>
  - * It can include constants &quot;sender&quot;, &quot;postmaster&quot;, 
&quot;returnPath&quot; and &quot;unaltered&quot;
  + * It can include constants &quot;sender&quot;, &quot;postmaster&quot;, 
&quot;returnPath&quot; and &quot;unaltered&quot;.
    * </TD>
    * </TR>
    * <TR valign=top>
  @@ -116,7 +121,7 @@
    * list.<BR>
    * The recipients list will be used if this list is not supplied;
    * if none of the lists is specified it will be &quot;unaltered&quot;.<BR>
  - * It can include constants &quot;sender&quot;, &quot;postmaster&quot;, 
&quot;returnPath&quot; and &quot;unaltered&quot;
  + * It can include constants &quot;sender&quot;, &quot;postmaster&quot;, 
&quot;returnPath&quot; and &quot;unaltered&quot;.
    * </TD>
    * </TR>
    * <TR valign=top>
  @@ -132,7 +137,8 @@
    * <TR valign=top>
    * <TD width="20%">&lt;message&gt;</TD>
    * <TD width="80%">
  - * A text message to be the body of the email. Can be omitted.
  + * A text message to insert into the body of the email.<BR>
  + * Default: no message is inserted.
    * </TD>
    * </TR>
    * <TR valign=top>
  @@ -202,9 +208,10 @@
    * <TD width="20%">&lt;replyto&gt;</TD>
    * <TD width="80%">
    * A single email address to appear in the Reply-To: header.<BR>
  - * It can include constants &quot;sender&quot;, &quot;postmaster&quot; and 
&quot;unaltered&quot;;
  + * It can include constants &quot;sender&quot;, &quot;postmaster&quot; 
&quot;null&quot; and &quot;unaltered&quot;;
    * if &quot;sender&quot; is specified then it will follow a safe procedure from the 
  - * original From: header (see [EMAIL PROTECTED] AbstractRedirect#setReplyTo} and 
[EMAIL PROTECTED] AbstractRedirect#getReplyTo(Mail)}).<BR>
  + * original From: header (see [EMAIL PROTECTED] AbstractRedirect#setReplyTo} and 
[EMAIL PROTECTED] AbstractRedirect#getReplyTo(Mail)});
  + * if &quot;null&quot; is specified it will remove this header.<BR>
    * Default: &quot;unaltered&quot;.
    * </TD>
    * </TR>
  @@ -234,6 +241,14 @@
    * </TD>
    * </TR>
    * <TR valign=top>
  + * <TD width="20%">&lt;debug&gt;</TD>
  + * <TD width="80%">
  + * true or false.  If this is true it tells the mailet to write some debugging
  + * information to the mailet log.<BR>
  + * Default: false.
  + * </TD>
  + * </TR>
  + * <TR valign=top>
    * <TD width="20%">&lt;static&gt;</TD>
    * <TD width="80%">
    * true or false.  If this is true it tells the mailet that it can
  @@ -247,33 +262,37 @@
    * </TABLE>
    *
    * <P>Example:</P>
  - * <P> &lt;mailet match=&quot;[EMAIL PROTECTED]&quot; 
class=&quot;Redirect&quot;&gt;<BR>
  - * &lt;recipients&gt;[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL 
PROTECTED]&lt;/recipients&gt;<BR>
  - * &lt;to&gt;[EMAIL PROTECTED]&lt;/to&gt;<BR>
  - * &lt;sender&gt;[EMAIL PROTECTED]&lt;/sender&gt;<BR>
  - * &lt;message&gt;sent on from James&lt;/message&gt;<BR>
  - * &lt;inline&gt;unaltered&lt;/inline&gt;<BR>
  - * &lt;passThrough&gt;FALSE&lt;/passThrough&gt;<BR>
  - * &lt;replyto&gt;postmaster&lt;/replyto&gt;<BR>
  - * &lt;prefix xml:space="preserve"&gt;[test mailing] &lt;/prefix&gt;<BR>
  - * &lt;!-- note the xml:space="preserve" to preserve whitespace --&gt;<BR>
  - * &lt;static&gt;TRUE&lt;/static&gt;<BR>
  - * &lt;/mailet&gt;<BR>
  - * </P>
  + * <PRE><CODE>
  + *  &lt;mailet match=&quot;[EMAIL PROTECTED]&quot; class=&quot;Redirect&quot;&gt;
  + *    &lt;recipients&gt;[EMAIL PROTECTED], [EMAIL PROTECTED], [EMAIL 
PROTECTED]&lt;/recipients&gt;
  + *    &lt;to&gt;[EMAIL PROTECTED]&lt;/to&gt;
  + *    &lt;sender&gt;[EMAIL PROTECTED]&lt;/sender&gt;
  + *    &lt;message&gt;sent on from James&lt;/message&gt;
  + *    &lt;inline&gt;unaltered&lt;/inline&gt;
  + *    &lt;passThrough&gt;FALSE&lt;/passThrough&gt;
  + *    &lt;replyto&gt;postmaster&lt;/replyto&gt;
  + *    &lt;prefix xml:space="preserve"&gt;[test mailing] &lt;/prefix&gt;
  + *    &lt;!-- note the xml:space="preserve" to preserve whitespace --&gt;
  + *    &lt;static&gt;TRUE&lt;/static&gt;
  + * &lt;/mailet&gt;
  + * </CODE></PRE>
  + * 
    * <P>and:</P>
  - * <P> &lt;mailet match=&quot;All&quot; class=&quot;Redirect&quot;&gt;<BR>
  - * &lt;recipients&gt;[EMAIL PROTECTED]&lt;/recipients&gt;<BR>
  - * &lt;sender&gt;postmaster&lt;/sender&gt;<BR>
  - * &lt;message xml:space="preserve"&gt;Message marked as spam:<BR>
  - * &lt;/message&gt;<BR>
  - * &lt;inline&gt;heads&lt;/inline&gt;<BR>
  - * &lt;attachment&gt;message&lt;/attachment&gt;<BR>
  - * &lt;passThrough&gt;FALSE&lt;/passThrough&gt;<BR>
  - * &lt;attachError&gt;TRUE&lt;/attachError&gt;<BR>
  - * &lt;replyto&gt;postmaster&lt;/replyto&gt;<BR>
  - * &lt;prefix&gt;[spam notification]&lt;/prefix&gt;<BR>
  - * &lt;static&gt;TRUE&lt;/static&gt;<BR>
  - * &lt;/mailet&gt;</P>
  + *
  + * <PRE><CODE>
  + *  &lt;mailet match=&quot;All&quot; class=&quot;Redirect&quot;&gt;
  + *    &lt;recipients&gt;[EMAIL PROTECTED]&lt;/recipients&gt;
  + *    &lt;sender&gt;postmaster&lt;/sender&gt;
  + *    &lt;message xml:space="preserve"&gt;Message marked as spam:&lt;/message&gt;
  + *    &lt;inline&gt;heads&lt;/inline&gt;
  + *    &lt;attachment&gt;message&lt;/attachment&gt;
  + *    &lt;passThrough&gt;FALSE&lt;/passThrough&gt;
  + *    &lt;attachError&gt;TRUE&lt;/attachError&gt;
  + *    &lt;replyto&gt;postmaster&lt;/replyto&gt;
  + *    &lt;prefix&gt;[spam notification]&lt;/prefix&gt;
  + *    &lt;static&gt;TRUE&lt;/static&gt;
  + *  &lt;/mailet&gt;
  + * </CODE></PRE>
    *
    * @version CVS $Revision$ $Date$
    */
  @@ -289,6 +308,29 @@
           return "Redirect Mailet";
       }
   
  +    /** Gets the expected init parameters. */
  +    protected  String[] getAllowedInitParameters() {
  +        String[] allowedArray = {
  +            "static",
  +            "debug",
  +            "passThrough",
  +            "fakeDomainCheck",
  +            "inline",
  +            "attachment",
  +            "message",
  +            "recipients",
  +            "to",
  +            "replyto",
  +            "returnPath",
  +            "sender",
  +//            "subject",
  +            "prefix",
  +            "attachError",
  +            "isReply"
  +        };
  +        return allowedArray;
  +    }
  +
       /* ******************************************************************** */
       /* ****************** Begin of getX and setX methods ****************** */
       /* ******************************************************************** */
  @@ -312,34 +354,13 @@
       }
   
       /**
  -     * @return the <CODE>attachment</CODE> init parameter
  -     */
  -    protected int getAttachmentType() throws MessagingException {
  -        if(getInitParameter("attachment") == null) {
  -            return NONE;
  -        } else {
  -            return getTypeCode(getInitParameter("attachment"));
  -        }
  -    }
  -
  -    /**
  -     * @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 the <CODE>recipients</CODE> init parameter
        * or the postmaster address
        * or <CODE>SpecialAddress.SENDER</CODE>
        * or <CODE>SpecialAddress.RETURN_PATH</CODE>
        * or <CODE>SpecialAddress.UNALTERED</CODE>
  -     * or <CODE>null</CODE> if missing
  +     * or the <CODE>to</CODE> init parameter if missing
  +     * or <CODE>null</CODE> if also the latter is missing
        */
       protected Collection getRecipients() throws MessagingException {
           Collection newRecipients = new HashSet();
  @@ -375,7 +396,8 @@
        * or <CODE>SpecialAddress.SENDER</CODE>
        * or <CODE>SpecialAddress.RETURN_PATH</CODE>
        * or <CODE>SpecialAddress.UNALTERED</CODE>
  -     * or <CODE>null</CODE> if missing
  +     * or the <CODE>recipients</CODE> init parameter if missing
  +     * or <CODE>null</CODE> if also the latter is missing
        */
       protected InternetAddress[] getTo() throws MessagingException {
           String addressList = (getInitParameter("to") == null)
  @@ -410,114 +432,10 @@
       }
   
       /**
  -     * @return the <CODE>replyto</CODE> init parameter
  -     * or the postmaster address
  -     * or <CODE>SpecialAddress.SENDER</CODE>
  -     * or <CODE>SpecialAddress.UNALTERED</CODE>
  -     * or <CODE>null</CODE> if missing
  -     */
  -    protected MailAddress getReplyTo() throws MessagingException {
  -        String addressString = getInitParameter("replyto");
  -        if(addressString != null) {
  -            MailAddress specialAddress = getSpecialAddress(addressString,
  -                                            new String[] {"postmaster", "sender", 
"unaltered"});
  -            if (specialAddress != null) {
  -                return specialAddress;
  -            }
  -
  -            try {
  -                return new MailAddress(addressString);
  -            } catch(Exception e) {
  -                log("Parse error in getReplyTo: " + addressString);
  -            }
  -        }
  -
  -        return null;
  -    }
  -
  -    /**
  -     * @return the <CODE>returnPath</CODE> init parameter 
  -     * or the postmaster address
  -     * or <CODE>SpecialAddress.SENDER</CODE>
  -     * or <CODE>SpecialAddress.NULL</CODE>
  -     * or <CODE>SpecialAddress.UNALTERED</CODE>
  -     * or <CODE>null</CODE> if missing
  -     */
  -    protected MailAddress getReturnPath() throws MessagingException {
  -        String addressString = getInitParameter("returnPath");
  -        if(addressString != null) {
  -            MailAddress specialAddress = getSpecialAddress(addressString,
  -                                            new String[] {"postmaster", "sender", 
"null", "unaltered"});
  -            if (specialAddress != null) {
  -                return specialAddress;
  -            }
  -
  -            try {
  -                return new MailAddress(addressString);
  -            } catch(Exception e) {
  -                log("Parse error in getReturnPath: " + addressString);
  -            }
  -        }
  -
  -        return null;
  -    }
  -
  -    /**
  -     * @return the <CODE>sender</CODE> init parameter
  -     * or the postmaster address
  -     * or <CODE>SpecialAddress.SENDER</CODE>
  -     * or <CODE>SpecialAddress.UNALTERED</CODE>
  -     * or <CODE>null</CODE> if missing
  +     * @return null
        */
  -    protected MailAddress getSender() throws MessagingException {
  -        String addressString = getInitParameter("sender");
  -        if(addressString != null) {
  -            MailAddress specialAddress = getSpecialAddress(addressString,
  -                                            new String[] {"postmaster", "sender", 
"unaltered"});
  -            if (specialAddress != null) {
  -                return specialAddress;
  -            }
  -
  -            try {
  -                return new MailAddress(addressString);
  -            } catch(Exception e) {
  -                log("Parse error in getSender: " + addressString);
  -            }
  -        }
  -
  +    protected String getSubject() {
           return null;
  -    }
  -
  -    /**
  -     * @return the <CODE>prefix</CODE> init parameter or an empty string if missing
  -     */
  -    protected String getSubjectPrefix() throws MessagingException {
  -        if(getInitParameter("prefix") == null) {
  -            return "";
  -        } else {
  -            return getInitParameter("prefix");
  -        }
  -    }
  -
  -    /**
  -     * @return the <CODE>attachError</CODE> init parameter; false if missing
  -     */
  -    protected boolean attachError() throws MessagingException {
  -        if(getInitParameter("attachError") == null) {
  -            return false;
  -        } else {
  -            return new Boolean(getInitParameter("attachError")).booleanValue();
  -        }
  -    }
  -
  -    /**
  -     * @return the <CODE>isReply</CODE> init parameter; false if missing
  -     */
  -    protected boolean isReply() throws MessagingException {
  -        if(getInitParameter("isReply") == null) {
  -            return false;
  -        }
  -        return new Boolean(getInitParameter("isReply")).booleanValue();
       }
   
       /* ******************************************************************** */
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.1   +0 -0      
jakarta-james/src/java/org/apache/james/transport/mailets/Resend.java
  
  Index: Resend.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-james/src/java/org/apache/james/transport/mailets/Resend.java,v
  retrieving revision 1.1
  retrieving revision 1.1.2.1
  diff -u -r1.1 -r1.1.2.1
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to