com.ozacc.mail.impl
クラス JDomXMLMailBuilder

java.lang.Object
  上位を拡張 com.ozacc.mail.impl.JDomXMLMailBuilder
すべての実装されたインタフェース:
MailBuilder, MultipleMailBuilder, VelocityMailBuilder, VelocityMultipleMailBuilder

public class JDomXMLMailBuilder
extends Object
implements MultipleMailBuilder, VelocityMultipleMailBuilder

JDOMを利用してXMLファイルからMailインスタンスを生成するクラス。

ソースXMLを読み込む際に、DTDバリデーションが実行されますので妥当なXMLデータ(Valid XML Document)でなければいけません。

導入されたバージョン:
1.0
バージョン:
$Id: JDomXMLMailBuilder.java,v 1.10.2.5 2005/02/01 20:37:49 otsuka Exp $
作成者:
Tomohiro Otsuka

フィールドの概要
protected  Map templateCache
           
protected  org.apache.velocity.runtime.log.LogSystem velocityLogSystem
           
 
コンストラクタの概要
JDomXMLMailBuilder()
          コンストラクタ。
 
メソッドの概要
protected  Mail build(Element mailElement)
          XMLのmailルートエレメントからMailインスタンスを生成します。
protected  Mail build(String templateText, org.apache.velocity.VelocityContext context)
          VelocityContextとXMLテンプレートをマージさせ、Mailインスタンスを生成します。
 Mail buildMail(File file)
          指定されたXMLファイルからMailインスタンスを生成します。
 Mail buildMail(File file, String mailId)
          指定されたファイルを読み込み、mailIdが示すデータからMailインスタンスを生成します。
 Mail buildMail(File file, org.apache.velocity.VelocityContext context)
          指定されたXMLファイルからMailインスタンスを生成します。
 Mail buildMail(File file, org.apache.velocity.VelocityContext context, String mailId)
          指定されたファイルを読み込み、mailIdが示すデータからMailインスタンスを生成します。
 Mail buildMail(String classPath)
          指定されたクラスパス上のXMLファイルからMailインスタンスを生成します。
 Mail buildMail(String classPath, String mailId)
          指定されたクラスパス上のファイルを読み込み、mailIdが示すデータからMailインスタンスを生成します。
 Mail buildMail(String classPath, org.apache.velocity.VelocityContext context)
          指定されたクラスパス上のXMLファイルからMailインスタンスを生成します。
 Mail buildMail(String classPath, org.apache.velocity.VelocityContext context, String mailId)
          指定されたクラスパス上のファイルを読み込み、mailIdが示すデータからMailインスタンスを生成します。
 void clearCache()
          メールデータキャッシュをクリアします。
protected  Document getDocumentFromClassPath(String classPath)
          指定されたクラスパス上のファイルを読み込んで、XMLドキュメントを生成します。
protected  Document getDocumentFromFile(File file)
          指定されたファイルを読み込んで、XMLドキュメントを生成します。
protected  String getTemplateCache(String key)
           
protected  boolean hasTemplateCache(String key)
           
 boolean isCacheEnabled()
          VelocityContextとマージする前のメールデータをキャッシュする設定かどうか判定します。
protected  void putTemplateCache(String key, String templateXmlText)
           
protected  void setBody(Element root, Mail mail)
           
 void setCacheEnabled(boolean cacheEnabled)
          VelocityContextとマージする前のメールデータをキャッシュするかどうかを設定します。
protected  void setFrom(Element root, Mail mail)
           
protected  void setHtml(Element root, Mail mail)
           
protected  void setRecipients(Element root, Mail mail)
           
protected  void setReplyTo(Element root, Mail mail)
           
protected  void setReturnPath(Element root, Mail mail)
           
protected  void setSubject(Element root, Mail mail)
           
 
クラス java.lang.Object から継承されたメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

velocityLogSystem

protected org.apache.velocity.runtime.log.LogSystem velocityLogSystem

templateCache

protected Map templateCache
コンストラクタの詳細

JDomXMLMailBuilder

public JDomXMLMailBuilder()
コンストラクタ。

メソッドの詳細

buildMail

public Mail buildMail(String classPath)
               throws MailBuildException
指定されたクラスパス上のXMLファイルからMailインスタンスを生成します。

定義:
インタフェース MailBuilder 内の buildMail
パラメータ:
classPath - メール内容を記述したXMLファイルのパス
戻り値:
生成されたMailインスタンス
例外:
MailBuildException - Mailインスタンスの生成に失敗した場合

buildMail

public Mail buildMail(String classPath,
                      org.apache.velocity.VelocityContext context)
               throws MailBuildException
指定されたクラスパス上のXMLファイルからMailインスタンスを生成します。 指定されたVelocityContextを使って、XMLファイルの内容を動的に生成できます。

定義:
インタフェース VelocityMailBuilder 内の buildMail
パラメータ:
classPath - メール内容を記述したXMLファイルのパス
context - VelocityContext
戻り値:
生成されたMailインスタンス
例外:
MailBuildException - Mailインスタンスの生成に失敗した場合

buildMail

public Mail buildMail(File file)
               throws MailBuildException
指定されたXMLファイルからMailインスタンスを生成します。

定義:
インタフェース MailBuilder 内の buildMail
パラメータ:
file - メール内容を記述したXMLファイル
戻り値:
生成されたMailインスタンス
例外:
MailBuildException - Mailインスタンスの生成に失敗した場合

buildMail

public Mail buildMail(File file,
                      org.apache.velocity.VelocityContext context)
               throws MailBuildException
指定されたXMLファイルからMailインスタンスを生成します。 指定されたVelocityContextを使って、XMLファイルの内容を動的に生成できます。

定義:
インタフェース VelocityMailBuilder 内の buildMail
パラメータ:
file - メール内容を記述したXMLファイル
context - VelocityContext
戻り値:
生成されたMailインスタンス
例外:
MailBuildException - Mailインスタンスの生成に失敗した場合

getDocumentFromClassPath

protected Document getDocumentFromClassPath(String classPath)
                                     throws MailBuildException
指定されたクラスパス上のファイルを読み込んで、XMLドキュメントを生成します。

パラメータ:
classPath -
戻り値:
JDOM Document
例外:
MailBuildException

getDocumentFromFile

protected Document getDocumentFromFile(File file)
指定されたファイルを読み込んで、XMLドキュメントを生成します。

パラメータ:
file -
戻り値:
JDOM Document

build

protected Mail build(Element mailElement)
XMLのmailルートエレメントからMailインスタンスを生成します。

パラメータ:
mailElement - mail要素を示すElementインスタンス
戻り値:
Mail 生成されたMail

build

protected Mail build(String templateText,
                     org.apache.velocity.VelocityContext context)
              throws Exception,
                     org.apache.velocity.exception.ParseErrorException,
                     org.apache.velocity.exception.MethodInvocationException,
                     org.apache.velocity.exception.ResourceNotFoundException,
                     IOException,
                     JDOMException
VelocityContextとXMLテンプレートをマージさせ、Mailインスタンスを生成します。

パラメータ:
templateText - マージするXMLテンプレートの文字列
context - マージするVelocityContext
戻り値:
Mail
例外:
Exception
org.apache.velocity.exception.ParseErrorException
org.apache.velocity.exception.MethodInvocationException
org.apache.velocity.exception.ResourceNotFoundException
IOException
JDOMException

setReturnPath

protected void setReturnPath(Element root,
                             Mail mail)
パラメータ:
root -
mail -

setReplyTo

protected void setReplyTo(Element root,
                          Mail mail)
パラメータ:
root -
mail -

setBody

protected void setBody(Element root,
                       Mail mail)
パラメータ:
root -
mail -

setHtml

protected void setHtml(Element root,
                       Mail mail)
パラメータ:
root -
mail -

setSubject

protected void setSubject(Element root,
                          Mail mail)
パラメータ:
root -
mail -

setRecipients

protected void setRecipients(Element root,
                             Mail mail)
パラメータ:
root -
mail -

setFrom

protected void setFrom(Element root,
                       Mail mail)
パラメータ:
root -
mail -

clearCache

public void clearCache()
インタフェース VelocityMailBuilder の記述:
メールデータキャッシュをクリアします。

定義:
インタフェース VelocityMailBuilder 内の clearCache
関連項目:
VelocityMailBuilder.clearCache()

isCacheEnabled

public boolean isCacheEnabled()
インタフェース VelocityMailBuilder の記述:
VelocityContextとマージする前のメールデータをキャッシュする設定かどうか判定します。

定義:
インタフェース VelocityMailBuilder 内の isCacheEnabled
戻り値:
メールデータをキャッシュする設定の場合は true
関連項目:
VelocityMailBuilder.isCacheEnabled()

setCacheEnabled

public void setCacheEnabled(boolean cacheEnabled)
インタフェース VelocityMailBuilder の記述:
VelocityContextとマージする前のメールデータをキャッシュするかどうかを設定します。 デフォルトはキャッシュしない設定です。

キャッシュのキーは、buildMail()メソッド引数のメールデータファイルのクラスパス或いはファイルパスです。 キャッシュに有効期限はありません。 また、メールデータファイルの内容が途中で更新されても、キャッシュされているメールデータは更新されませんので注意してください。

falseを指定してこのメソッドを呼ぶとメールデータキャッシュはクリアされます。

定義:
インタフェース VelocityMailBuilder 内の setCacheEnabled
パラメータ:
cacheEnabled - メールデータをキャッシュする場合は true
関連項目:
VelocityMailBuilder.setCacheEnabled(boolean)

hasTemplateCache

protected boolean hasTemplateCache(String key)

putTemplateCache

protected void putTemplateCache(String key,
                                String templateXmlText)

getTemplateCache

protected String getTemplateCache(String key)

buildMail

public Mail buildMail(String classPath,
                      org.apache.velocity.VelocityContext context,
                      String mailId)
               throws MailBuildException
インタフェース VelocityMultipleMailBuilder の記述:
指定されたクラスパス上のファイルを読み込み、mailIdが示すデータからMailインスタンスを生成します。 指定されたVelocityContextを使って、XMLファイルの内容を動的に生成できます。

定義:
インタフェース VelocityMultipleMailBuilder 内の buildMail
パラメータ:
classPath - メール内容を記述したファイルのパス
context - VelocityContext
mailId - 生成するMailのメールデータを示すID
戻り値:
生成されたMailインスタンス
例外:
MailBuildException - Mailインスタンスの生成に失敗した場合
関連項目:
VelocityMultipleMailBuilder.buildMail(java.lang.String, org.apache.velocity.VelocityContext, java.lang.String)

buildMail

public Mail buildMail(File file,
                      org.apache.velocity.VelocityContext context,
                      String mailId)
               throws MailBuildException
インタフェース VelocityMultipleMailBuilder の記述:
指定されたファイルを読み込み、mailIdが示すデータからMailインスタンスを生成します。 指定されたVelocityContextを使って、XMLファイルの内容を動的に生成できます。

定義:
インタフェース VelocityMultipleMailBuilder 内の buildMail
パラメータ:
file - メール内容を記述したファイル
context - VelocityContext
mailId - 生成するMailのメールデータを示すID
戻り値:
生成されたMailインスタンス
例外:
MailBuildException - Mailインスタンスの生成に失敗した場合
関連項目:
VelocityMultipleMailBuilder.buildMail(java.io.File, org.apache.velocity.VelocityContext, java.lang.String)

buildMail

public Mail buildMail(String classPath,
                      String mailId)
               throws MailBuildException
インタフェース MultipleMailBuilder の記述:
指定されたクラスパス上のファイルを読み込み、mailIdが示すデータからMailインスタンスを生成します。

定義:
インタフェース MultipleMailBuilder 内の buildMail
パラメータ:
classPath - メール内容を記述したファイルのパス
mailId - 生成するMailのメールデータを示すID
戻り値:
生成されたMailインスタンス
例外:
MailBuildException - Mailインスタンスの生成に失敗した場合
関連項目:
MultipleMailBuilder.buildMail(java.lang.String, java.lang.String)

buildMail

public Mail buildMail(File file,
                      String mailId)
               throws MailBuildException
インタフェース MultipleMailBuilder の記述:
指定されたファイルを読み込み、mailIdが示すデータからMailインスタンスを生成します。

定義:
インタフェース MultipleMailBuilder 内の buildMail
パラメータ:
file - メール内容を記述したファイル
mailId - 生成するMailのメールデータを示すID
戻り値:
生成されたMailインスタンス
例外:
MailBuildException - Mailインスタンスの生成に失敗した場合
関連項目:
MultipleMailBuilder.buildMail(java.io.File, java.lang.String)


Copyright © 2004-2006 OZACC. All Rights Reserved.