Coverage report

  %line %branch
com.ozacc.mail.fetch.impl.FetchMailImpl
36% 
100% 

 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.