com.ozacc.mail.impl
クラス XMLMailBuilderImpl

java.lang.Object
  拡張com.ozacc.mail.impl.AbstractXMLMailBuilder
      拡張com.ozacc.mail.impl.XMLMailBuilderImpl
すべての実装インタフェース:
MailBuilder
直系の既知のサブクラス:
XMLVelocityMailBuilderImpl

public class XMLMailBuilderImpl
extends com.ozacc.mail.impl.AbstractXMLMailBuilder
implements MailBuilder

メールデータのXMLファイルからMailインスタンスを生成するクラス。

ソースXMLを読み込む際に、DTDバリデーションが実行されますので妥当なXMLデータ(Valid XML Document)でなければいけません。 メールデータXMLのDTDは、http://www.ozacc.com/library/dtd/ozacc-mail.dtdを参照。

導入されたバージョン:
1.0.1
バージョン:
$Id: XMLMailBuilderImpl.java,v 1.5 2004/09/17 23:07:16 otsuka Exp $
作成者:
Tomohiro Otsuka

フィールドの概要
protected  Map documentBuilderCache
           
 
コンストラクタの概要
XMLMailBuilderImpl()
          コンストラクタ。
 
メソッドの概要
protected  Mail buildMail(Document doc)
          DOM DocumentからMailインスタンスを生成します。
 Mail buildMail(File file)
          指定されたファイルを読み込んでMailインスタンスを生成します。
 Mail buildMail(String classPath)
          指定されたクラスパス上のファイルを読み込んでMailインスタンスを生成します。
protected  DocumentBuilder createDocumentBuilder()
          DocumentBuilderインスタンスを生成します。
protected  DocumentBuilder createDocumentBuilder(boolean ignoreComment)
          DocumentBuilderインスタンスを生成します。
protected  Document getDocumentFromClassPath(String classPath)
          指定されたクラスパスのXMLファイルを読み込み、DOM Documentを生成します。
protected  Document getDocumentFromClassPath(String classPath, boolean ignoreComment)
          指定されたクラスパスのXMLファイルを読み込み、DOM Documentを生成します。
protected  Document getDocumentFromFile(File file)
          指定されたXMLファイルを読み込み、DOM Documentを生成します。
protected  Document getDocumentFromFile(File file, boolean ignoreComment)
          指定されたXMLファイルを読み込み、DOM Documentを生成します。
protected  void setFrom(Element root, Mail mail)
           
protected  void setHtml(Element root, Mail mail)
          HTML本文をセット。
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)
           
protected  void setText(Element root, Mail mail)
           
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

documentBuilderCache

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

XMLMailBuilderImpl

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

メソッドの詳細

buildMail

public Mail buildMail(String classPath)
               throws MailBuildException
インタフェース MailBuilder の記述:
指定されたクラスパス上のファイルを読み込んでMailインスタンスを生成します。

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

buildMail

public Mail buildMail(File file)
               throws MailBuildException
インタフェース MailBuilder の記述:
指定されたファイルを読み込んでMailインスタンスを生成します。

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

buildMail

protected Mail buildMail(Document doc)
DOM DocumentからMailインスタンスを生成します。

パラメータ:
doc - メールデータのDOM Document
戻り値:
生成されたMailインスタンス

getDocumentFromFile

protected Document getDocumentFromFile(File file,
                                       boolean ignoreComment)
                                throws SAXException,
                                       IOException
指定されたXMLファイルを読み込み、DOM Documentを生成します。 ignoreCommentが指定されている場合は、XMLのコメントを削除しません。

パラメータ:
file - XMLファイル
戻り値:
DOM Document
例外:
IOException
SAXException

getDocumentFromFile

protected Document getDocumentFromFile(File file)
                                throws SAXException,
                                       IOException
指定されたXMLファイルを読み込み、DOM Documentを生成します。 XMLのコメントや改行は削除されます。

パラメータ:
file - XMLファイル
戻り値:
DOM Document
例外:
IOException
SAXException

createDocumentBuilder

protected DocumentBuilder createDocumentBuilder(boolean ignoreComment)
                                         throws FactoryConfigurationError
DocumentBuilderインスタンスを生成します。 ignoreCommentが指定されている場合は、コメントを削除しないように設定されたDocumentBuilderを生成します。

パラメータ:
ignoreComment -
戻り値:
DocumentBuilder
例外:
FactoryConfigurationError

createDocumentBuilder

protected DocumentBuilder createDocumentBuilder()
                                         throws FactoryConfigurationError
DocumentBuilderインスタンスを生成します。 このDocumentBuilderを使用して生成されるDOM Documentでは、元のXMLデータにあるコメントは削除されます。

戻り値:
DocumentBuilder
例外:
FactoryConfigurationError

getDocumentFromClassPath

protected Document getDocumentFromClassPath(String classPath,
                                            boolean ignoreComment)
                                     throws SAXException,
                                            IOException
指定されたクラスパスのXMLファイルを読み込み、DOM Documentを生成します。 ignoreCommentが指定されている場合は、XMLのコメントを削除しません。

パラメータ:
ignoreComment -
classPath -
戻り値:
DOM Document
例外:
IOException
SAXException

getDocumentFromClassPath

protected Document getDocumentFromClassPath(String classPath)
                                     throws SAXException,
                                            IOException
指定されたクラスパスのXMLファイルを読み込み、DOM Documentを生成します。 XMLのコメントや改行は削除されます。

パラメータ:
classPath -
戻り値:
DOM Document
例外:
IOException
SAXException

setReplyTo

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

setText

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

setHtml

protected void setHtml(Element root,
                       Mail mail)
HTML本文をセット。

パラメータ:
root -
mail -

setSubject

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

setRecipients

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

setReturnPath

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

setFrom

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


Copyright © 2004 OZACC. All Rights Reserved.