com.ozacc.mail.impl
クラス XMLMailBuilderImpl

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

public class XMLMailBuilderImpl
extends Object
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.3 2004/09/15 09:04:07 otsuka Exp $
作成者:
Tomohiro Otsuka

コンストラクタの概要
XMLMailBuilderImpl()
          コンストラクタ。
 
メソッドの概要
protected  Mail build(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を生成します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

コンストラクタの詳細

XMLMailBuilderImpl

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

メソッドの詳細

buildMail

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

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

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

buildMail

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

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

build

protected Mail build(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


Copyright © 2004 OZACC. All Rights Reserved.