View Javadoc

    1   package com.ozacc.mail.mailet;
    2
    3   import java.util.ArrayList;
    4   import java.util.Iterator;
    5   import java.util.List;
    6
    7   import com.ozacc.mail.fetch.ReceivedMail;
    8
    9   /***
    10   *
    11   * @author Tomohiro Otsuka
    12   * @version $Id: MailetWrapper.java,v 1.1.2.1 2005/01/18 07:22:01 otsuka Exp $
    13   */
    14  public class MailetWrapper {
    15
    16  	private Mailet mailet;
    17
    18  	private List matcherList;
    19
    20  	/***
    21  	 * コンストラクタ。
    22  	 */
    23  	public MailetWrapper() {
    24  		matcherList = new ArrayList();
    25  	}
    26
    27  	/***
    28  	 * コンストラクタ。
    29  	 *
    30  	 * @param mailet
    31  	 * @param matcherList
    32  	 */
    33  	public MailetWrapper(Mailet mailet, List matcherList) {
    34  		this();
    35  		this.mailet = mailet;
    36  		this.matcherList = matcherList;
    37  	}
    38
    39  	/***
    40  	 *
    41  	 * @param mail
    42  	 */
    43  	public void execute(ReceivedMail mail) {
    44  		for (Iterator itr = matcherList.iterator(); itr.hasNext();) {
    45  			Matcher m = (Matcher)itr.next();
    46  			if (!m.match(mail)) {
    47  				return;
    48  			}
    49  		}
    50  		mailet.service(mail);
    51  	}
    52
    53  	/***
    54  	 * @return Returns the mailet.
    55  	 */
    56  	public Mailet getMailet() {
    57  		return mailet;
    58  	}
    59
    60  	/***
    61  	 * @param mailet The mailet to set.
    62  	 */
    63  	public void setMailet(Mailet mailet) {
    64  		this.mailet = mailet;
    65  	}
    66
    67  	/***
    68  	 * @return Returns the matcherList.
    69  	 */
    70  	public List getMatcherList() {
    71  		return matcherList;
    72  	}
    73
    74  	/***
    75  	 * @param matcherList The matcherList to set.
    76  	 */
    77  	public void setMatcherList(List matcherList) {
    78  		this.matcherList = matcherList;
    79  	}
    80  }