View Javadoc

1   package com.ozacc.mail;
2   
3   import java.io.File;
4   
5   import org.apache.velocity.VelocityContext;
6   
7   /***
8    * Velocityと連携して動的にメールデータを生成し、そのデータからMailインスタンスを生成するインターフェース。
9    * 
10   * @see com.ozacc.mail.impl.XMLVelocityMailBuilderImpl
11   * @see com.ozacc.mail.impl.JDomXMLMailBuilder
12   * 
13   * @since 1.0
14   * @author Tomohiro Otsuka
15   * @version $Id: VelocityMailBuilder.java,v 1.4.2.3 2005/01/21 16:51:20 otsuka Exp $
16   */
17  public interface VelocityMailBuilder extends MailBuilder {
18  
19  	/***
20  	 * 指定されたクラスパス上のファイルを読み込んでMailインスタンスを生成します。
21  	 * 指定されたVelocityContextを使って、XMLファイルの内容を動的に生成できます。
22  	 * 
23  	 * @param classPath メール内容を記述したファイルのパス
24  	 * @param context VelocityContext
25  	 * @return 生成されたMailインスタンス
26  	 * @throws MailBuildException Mailインスタンスの生成に失敗した場合
27  	 */
28  	Mail buildMail(String classPath, VelocityContext context) throws MailBuildException;
29  
30  	/***
31  	 * 指定されたファイルを読み込んでMailインスタンスを生成します。
32  	 * 指定されたVelocityContextを使って、XMLファイルの内容を動的に生成できます。
33  	 * 
34  	 * @param file メール内容を記述したファイル
35  	 * @param context VelocityContext
36  	 * @return 生成されたMailインスタンス
37  	 * @throws MailBuildException Mailインスタンスの生成に失敗した場合
38  	 */
39  	Mail buildMail(File file, VelocityContext context) throws MailBuildException;
40  
41  	/***
42  	 * メールデータキャッシュをクリアします。
43  	 * 
44  	 * @since 1.1.2
45  	 */
46  	void clearCache();
47  
48  	/***
49  	 * VelocityContextとマージする前のメールデータをキャッシュするかどうかを設定します。
50  	 * デフォルトはキャッシュしない設定です。
51  	 * <p>
52  	 * キャッシュのキーは、<code>buildMail()</code>メソッド引数のメールデータファイルのクラスパス或いはファイルパスです。
53  	 * キャッシュに有効期限はありません。
54  	 * また、メールデータファイルの内容が途中で更新されても、キャッシュされているメールデータは更新されませんので注意してください。
55  	 * <p>
56  	 * <code>false</code>を指定してこのメソッドを呼ぶとメールデータキャッシュはクリアされます。
57  	 * 
58  	 * @since 1.1.2
59  	 * @param cacheEnabled メールデータをキャッシュする場合は true
60  	 */
61  	void setCacheEnabled(boolean cacheEnabled);
62  
63  	/***
64  	 * VelocityContextとマージする前のメールデータをキャッシュする設定かどうか判定します。
65  	 * 
66  	 * @since 1.1.2
67  	 * @return メールデータをキャッシュする設定の場合は true
68  	 */
69  	boolean isCacheEnabled();
70  
71  }