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.5 2004/10/22 00:50:18 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 * 実装クラスのインスタンスに予めセットされたロケーションにあるXMLデータを読み込んで
43 * Mailインスタンスを生成します。
44 * 指定されたVelocityContextを使って、XMLファイルの内容を動的に生成できます。
45 *
46 * @param context VelocityContext
47 * @return 生成されたMailインスタンス
48 * @throws MailBuildException Mailインスタンスの生成に失敗した場合
49 */
50
51 /***
52 * メールデータキャッシュをクリアします。
53 *
54 * @since 1.1.2
55 */
56 void clearCache();
57
58 /***
59 * VelocityContextとマージする前のメールデータをキャッシュするかどうかを設定します。
60 * デフォルトはキャッシュしない設定です。
61 * <p>
62 * キャッシュのキーは、<code>buildMail()</code>メソッド引数のメールデータファイルのクラスパス或いはファイルパスです。
63 * キャッシュに有効期限はありません。
64 * また、メールデータファイルの内容が途中で更新されても、キャッシュされているメールデータは更新されませんので注意してください。
65 * <p>
66 * <code>false</code>を指定してこのメソッドを呼ぶとメールデータキャッシュはクリアされます。
67 *
68 * @since 1.1.2
69 * @param cacheEnabled メールデータをキャッシュする場合は true
70 */
71 void setCacheEnabled(boolean cacheEnabled);
72
73 /***
74 * VelocityContextとマージする前のメールデータをキャッシュする設定かどうか判定します。
75 *
76 * @since 1.1.2
77 * @return メールデータをキャッシュする設定の場合は true
78 */
79 boolean isCacheEnabled();
80
81 }