| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| com.ozacc.mail.mailet.MailetRunner |
|
|
| 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.FetchMailPro; |
|
| 8 | import com.ozacc.mail.fetch.ReceivedMail; |
|
| 9 | ||
| 10 | /** |
|
| 11 | * ¥á¡¼¥?¤Î¼õ¿®¤ÈMailet¤Îµ¯Æ°¤ò¹Ô¤¦¥¯¥é¥¹¡£ |
|
| 12 | * |
|
| 13 | * @since 1.2 |
|
| 14 | * @author Tomohiro Otsuka |
|
| 15 | * @version $Id: MailetRunner.java,v 1.1.2.4 2005/01/29 23:13:27 otsuka Exp $ |
|
| 16 | */ |
|
| 17 | public class MailetRunner { |
|
| 18 | ||
| 19 | private List mailetWrapperList; |
|
| 20 | ||
| 21 | private FetchMailPro fetchMailPro; |
|
| 22 | ||
| 23 | /** |
|
| 24 | * ¥³¥ó¥¹¥È¥é¥¯¥¿¡£ |
|
| 25 | */ |
|
| 26 | 0 | public MailetRunner() { |
| 27 | 0 | mailetWrapperList = new ArrayList(); |
| 28 | 0 | } |
| 29 | ||
| 30 | /** |
|
| 31 | * ¥á¡¼¥?¼õ¿®¤ÈMailet¤Îµ¯Æ°¤ò¹Ô¤¤¤Þ¤¹¡£ |
|
| 32 | */ |
|
| 33 | public void run() { |
|
| 34 | 0 | fetchMailPro.connect(); |
| 35 | try { |
|
| 36 | 0 | int count = fetchMailPro.getMailCount(); |
| 37 | 0 | for (int i = 1; i <= count; i++) { |
| 38 | 0 | ReceivedMail mail = fetchMailPro.getMail(i); |
| 39 | 0 | processMail(mail); |
| 40 | } |
|
| 41 | 0 | } finally { |
| 42 | 0 | fetchMailPro.disconnect(); |
| 43 | 0 | } |
| 44 | 0 | } |
| 45 | ||
| 46 | /** |
|
| 47 | * »ØÄꤵ¤?¤¿¼õ¿®¥á¡¼¥?¤ËÂФ·¤ÆMailet¤òŬÍѤ·¤Þ¤¹¡£ |
|
| 48 | * |
|
| 49 | * @param mail MailetUnit¤ËÅϤ¹¼õ¿®¥á¡¼¥? |
|
| 50 | */ |
|
| 51 | private void processMail(ReceivedMail mail) { |
|
| 52 | 0 | for (Iterator itr = mailetWrapperList.iterator(); itr.hasNext();) { |
| 53 | 0 | MailetWrapper mailetWrapper = (MailetWrapper)itr.next(); |
| 54 | 0 | mailetWrapper.execute(mail); |
| 55 | } |
|
| 56 | 0 | } |
| 57 | ||
| 58 | /** |
|
| 59 | * ¥á¡¼¥?¤Î¼õ¿®¤Ë»ÈÍѤ¹¤?FetchMailPro¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î¼ÂÁõ¥¤¥ó¥¹¥¿¥ó¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£ |
|
| 60 | * |
|
| 61 | * @param fetchMailPro FetchMailPro¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î¼ÂÁõ¥¤¥ó¥¹¥¿¥ó¥¹ |
|
| 62 | */ |
|
| 63 | public void setFetchMailPro(FetchMailPro fetchMailPro) { |
|
| 64 | 0 | this.fetchMailPro = fetchMailPro; |
| 65 | 0 | } |
| 66 | ||
| 67 | /** |
|
| 68 | * ¼Â¹Ô¤¹¤?Mailet¤ÎMailetWrapper¥?¥¹¥È¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£ |
|
| 69 | * |
|
| 70 | * @param mailetWrapperList ¼Â¹Ô¤¹¤?Mailet¤ÎMailetWrapper¥?¥¹¥È |
|
| 71 | */ |
|
| 72 | public void setMailetWrapperList(List mailetWrapperList) { |
|
| 73 | 0 | this.mailetWrapperList = mailetWrapperList; |
| 74 | 0 | } |
| 75 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |