| %line | %branch | |||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| com.ozacc.mail.fetch.impl.FetchMailImpl |
|
|
| 1 | package com.ozacc.mail.fetch.impl; |
|
| 2 | ||
| 3 | import com.ozacc.mail.MailException; |
|
| 4 | import com.ozacc.mail.fetch.FetchMail; |
|
| 5 | import com.ozacc.mail.fetch.ReceivedMail; |
|
| 6 | ||
| 7 | /** |
|
| 8 | * <code>FetchMail</code>¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Î¼ÂÁõ¥¯¥é¥¹¡£ |
|
| 9 | * <p> |
|
| 10 | * <code>FetchMailProImpl</code>¥¯¥é¥¹¤Ë½èÍ?¤ò°Ñ¾ù¤·¤Æ¤¤¤Þ¤¹¡£ |
|
| 11 | * |
|
| 12 | * @since 1.2 |
|
| 13 | * @see FetchMailProImpl |
|
| 14 | * |
|
| 15 | * @author Tomohiro Otsuka |
|
| 16 | * @version $Id: FetchMailImpl.java,v 1.1.2.6 2005/01/29 22:33:40 otsuka Exp $ |
|
| 17 | */ |
|
| 18 | public class FetchMailImpl implements FetchMail { |
|
| 19 | ||
| 20 | /** ¥Ç¥Õ¥©¥?¥È¤ÎSMTP¥µ¡¼¥Ð¡£¡Ölocalhost¡× */ |
|
| 21 | public static final String DEFAULT_HOST = "localhost"; |
|
| 22 | ||
| 23 | /** ¥Ç¥Õ¥©¥?¥È¤Î¥×¥úÁÈ¥³¥?¡£¡Öpop3¡× */ |
|
| 24 | public static final String DEFAULT_PROTOCOL = "pop3"; |
|
| 25 | ||
| 26 | /** |
|
| 27 | * ¥Ç¥Õ¥©¥?¥È¤Î¥Ý¡¼¥È¡£¡Ö-1¡×<br> |
|
| 28 | * -1¤Ï¥×¥úÁÈ¥³¥?¤Ë±?¤¸¤¿Å¬Àڤʥݡ¼¥È¤òÀßÄꤹ¤?ÆÃÊ̤ÊÃÍ¡£ |
|
| 29 | */ |
|
| 30 | public static final int DEFAULT_PORT = -1; |
|
| 31 | ||
| 32 | private static final String INBOX_NAME = "INBOX"; |
|
| 33 | ||
| 34 | 1 | private String host = DEFAULT_HOST; |
| 35 | ||
| 36 | 1 | private String protocol = DEFAULT_PROTOCOL; |
| 37 | ||
| 38 | 1 | private int port = DEFAULT_PORT; |
| 39 | ||
| 40 | private String username; |
|
| 41 | ||
| 42 | private String password; |
|
| 43 | ||
| 44 | /** |
|
| 45 | * ¥³¥ó¥¹¥È¥é¥¯¥¿¡£ |
|
| 46 | */ |
|
| 47 | 2 | public FetchMailImpl() {} |
| 48 | ||
| 49 | /** |
|
| 50 | * @see com.ozacc.mail.fetch.FetchMail#getMails() |
|
| 51 | */ |
|
| 52 | public ReceivedMail[] getMails() throws MailException { |
|
| 53 | 0 | return getMails(false); |
| 54 | } |
|
| 55 | ||
| 56 | /** |
|
| 57 | * @see com.ozacc.mail.fetch.FetchMail#getMails(boolean) |
|
| 58 | */ |
|
| 59 | public ReceivedMail[] getMails(boolean delete) throws MailException { |
|
| 60 | 0 | FetchMailProImpl fetchMailProImpl = createFetchMailProImpl(); |
| 61 | 0 | fetchMailProImpl.connect(); |
| 62 | try { |
|
| 63 | 0 | return fetchMailProImpl.getMails(delete); |
| 64 | 0 | } finally { |
| 65 | 0 | fetchMailProImpl.disconnect(); |
| 66 | 0 | } |
| 67 | } |
|
| 68 | ||
| 69 | /** |
|
| 70 | * ¥µ¡¼¥Ð¾ðÊó¤ò¥»¥Ã¥È¤·¤¿FetchMailProImpl¥¤¥ó¥¹¥¿¥ó¥¹¤òÀ¸À®¤·¤Þ¤¹¡£ |
|
| 71 | * |
|
| 72 | * @return ¥µ¡¼¥Ð¾ðÊó¤ò¥»¥Ã¥È¤·¤¿FetchMailProImpl¥¤¥ó¥¹¥¿¥ó¥¹ |
|
| 73 | */ |
|
| 74 | private FetchMailProImpl createFetchMailProImpl() { |
|
| 75 | 0 | FetchMailProImpl fmp = new FetchMailProImpl(); |
| 76 | 0 | fmp.setHost(host); |
| 77 | 0 | fmp.setPort(port); |
| 78 | 0 | fmp.setProtocol(protocol); |
| 79 | 0 | fmp.setUsername(username); |
| 80 | 0 | fmp.setPassword(password); |
| 81 | 0 | return fmp; |
| 82 | } |
|
| 83 | ||
| 84 | /** |
|
| 85 | * ¥á¡¼¥?¥µ¡¼¥Ð¤Î¥Û¥¹¥È̾¡¢¤Þ¤¿¤ÏIP¥¢¥É¥?¥¹¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£ |
|
| 86 | * ¥Ç¥Õ¥©¥?¥È¤Ï localhost ¤Ç¤¹¡£ |
|
| 87 | * |
|
| 88 | * @param host ¥á¡¼¥?¥µ¡¼¥Ð¤Î¥Û¥¹¥È̾¡¢¤Þ¤¿¤ÏIP¥¢¥É¥?¥¹ |
|
| 89 | */ |
|
| 90 | public void setHost(String host) { |
|
| 91 | 1 | this.host = host; |
| 92 | 1 | } |
| 93 | ||
| 94 | /** |
|
| 95 | * ¥á¡¼¥?¥µ¡¼¥Ð¤Îǧ¾Ú¥Ñ¥¹¥?¡¼¥É̾¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£ |
|
| 96 | * |
|
| 97 | * @param password ¥á¡¼¥?¥µ¡¼¥Ð¤Îǧ¾Ú¥Ñ¥¹¥?¡¼¥É |
|
| 98 | */ |
|
| 99 | public void setPassword(String password) { |
|
| 100 | 1 | this.password = password; |
| 101 | 1 | } |
| 102 | ||
| 103 | /** |
|
| 104 | * ¥á¡¼¥?¼õ¿®¤Ë»ÈÍѤ¹¤?¥Ý¡¼¥ÈÈÖ¹æ¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£ |
|
| 105 | * ¥×¥úÁÈ¥³¥?¤Ë±?¤¸¤¿¥Ý¡¼¥ÈÈֹ椬¼«Æ°Åª¤Ë»ÈÍѤµ¤?¤Þ¤¹¤Î¤Ç¡¢Ä̾?¤³¤³¤Ç¥Ý¡¼¥ÈÈÖ¹æ¤ò¥»¥Ã¥È¤¹¤?ɬÍפϤ¢¤ê¤Þ¤»¤ó¡£ |
|
| 106 | * |
|
| 107 | * @param port ¥Ý¡¼¥ÈÈÖ¹? |
|
| 108 | */ |
|
| 109 | public void setPort(int port) { |
|
| 110 | 0 | this.port = port; |
| 111 | 0 | } |
| 112 | ||
| 113 | /** |
|
| 114 | * ¥á¡¼¥?¼õ¿®¤Ë»ÈÍѤ¹¤?¥×¥úÁÈ¥³¥úÁ?¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£ |
|
| 115 | * ¸½ºß¥µ¥Ý¡¼¥È¤µ¤?¤Æ¤¤¤?¥×¥úÁÈ¥³¥?¤Ï¡¢¡Öpop3¡×¤È¡Öimap¡×¤ÎÆó¤Ä¤Ç¤¹¡£ |
|
| 116 | * ¥Ç¥Õ¥©¥?¥È¤Ï¡Öpop3¡×¤Ç¤¹¡£ |
|
| 117 | * <p> |
|
| 118 | * POP3¥µ¡¼¥Ð¤Ø¤Îǧ¾Ú¤òAPOP¤Ç¹Ô¤¤¤¿¤¤¾?¹ç¤Ï¡¢¥×¥úÁÈ¥³¥?̾¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¤¬¡¢ |
|
| 119 | * ¡Öapop¡×¤ò»ØÄꤷ¤Æ¤¯¤À¤µ¤¤¡£APOPǧ¾Ú¤ò»ÈÍѤ¹¤?¤Ë¤Ï¡¢JavaMail 1.3.2°Ê¹ß¤¬É¬ÍפǤ¹¡£ |
|
| 120 | * |
|
| 121 | * @param protocol ¥×¥úÁÈ¥³¥? |
|
| 122 | */ |
|
| 123 | public void setProtocol(String protocol) { |
|
| 124 | 1 | this.protocol = protocol; |
| 125 | 1 | } |
| 126 | ||
| 127 | /** |
|
| 128 | * ¥á¡¼¥?¥µ¡¼¥Ð¤Îǧ¾Ú¥æ¡¼¥¶Ì¾¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£ |
|
| 129 | * |
|
| 130 | * @param username ¥á¡¼¥?¥µ¡¼¥Ð¤Îǧ¾Ú¥æ¡¼¥¶Ì¾ |
|
| 131 | */ |
|
| 132 | public void setUsername(String username) { |
|
| 133 | 1 | this.username = username; |
| 134 | 1 | } |
| 135 | ||
| 136 | /** |
|
| 137 | * ¥á¡¼¥?¥µ¡¼¥Ð¤Î¥Û¥¹¥È̾¡¢¤Þ¤¿¤ÏIP¥¢¥É¥?¥¹¤òÊÖ¤·¤Þ¤¹¡£ |
|
| 138 | * |
|
| 139 | * @return ¥á¡¼¥?¥µ¡¼¥Ð¤Î¥Û¥¹¥È̾¡¢¤Þ¤¿¤ÏIP¥¢¥É¥?¥¹ |
|
| 140 | */ |
|
| 141 | public String getHost() { |
|
| 142 | 0 | return host; |
| 143 | } |
|
| 144 | ||
| 145 | /** |
|
| 146 | * ¥á¡¼¥?¥µ¡¼¥Ð¤Îǧ¾Ú¥Ñ¥¹¥?¡¼¥É¤òÊÖ¤·¤Þ¤¹¡£ |
|
| 147 | * |
|
| 148 | * @return ¥á¡¼¥?¥µ¡¼¥Ð¤Îǧ¾Ú¥Ñ¥¹¥?¡¼¥É |
|
| 149 | */ |
|
| 150 | public String getPassword() { |
|
| 151 | 0 | return password; |
| 152 | } |
|
| 153 | ||
| 154 | /** |
|
| 155 | * @return ¥Ý¡¼¥ÈÈÖ¹? |
|
| 156 | */ |
|
| 157 | public int getPort() { |
|
| 158 | 0 | return port; |
| 159 | } |
|
| 160 | ||
| 161 | /** |
|
| 162 | * ¥á¡¼¥?¼õ¿®¤Ë»ÈÍѤ¹¤?¥×¥úÁÈ¥³¥úÁ?¤ò¥»¥Ã¥È¤·¤Þ¤¹¡£ |
|
| 163 | * |
|
| 164 | * @return ¥×¥úÁÈ¥³¥? |
|
| 165 | */ |
|
| 166 | public String getProtocol() { |
|
| 167 | 0 | return protocol; |
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * ¥á¡¼¥?¥µ¡¼¥Ð¤Îǧ¾Ú¥æ¡¼¥¶Ì¾¤òÊÖ¤·¤Þ¤¹¡£ |
|
| 172 | * |
|
| 173 | * @return ¥á¡¼¥?¥µ¡¼¥Ð¤Îǧ¾Ú¥æ¡¼¥¶Ì¾ |
|
| 174 | */ |
|
| 175 | public String getUsername() { |
|
| 176 | 0 | return username; |
| 177 | } |
|
| 178 | } |
| This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |