com.novell.nds.dirxml.util.mail
Class MailMessagePart

java.lang.Object
  extended by javax.mail.BodyPart
      extended by javax.mail.internet.MimeBodyPart
          extended by com.novell.nds.dirxml.util.mail.MailMessagePart
All Implemented Interfaces:
javax.mail.internet.MimePart, javax.mail.Part

public class MailMessagePart
extends javax.mail.internet.MimeBodyPart

Class to construct a MimeBodyPart based on an XML description. Handles <message> and <attachment> elements that are children of the <mail> element.


Nested Class Summary
static class MailMessagePart.SpecifiedMimeTypeMap
          Extension of FileTypeMap to allow a specify mime-type specified in the XML description to override whatever FileTypeMap would return
 
Field Summary
protected  String encoding
           
protected  String filename
           
protected  String language
           
protected  String m_sMailTemplateDN
           
protected  String m_sTemplateAttr
           
protected  String mimeType
           
protected  Document replacementData
           
protected  Vector resourceList
           
protected  String stylesheetName
           
protected  String templateData
           
 
Fields inherited from class javax.mail.internet.MimeBodyPart
content, contentStream, dh, headers
 
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
 
Constructor Summary
MailMessagePart(Element message, StylesheetSource stylesheets, MailMessage parent)
          Construct the message part based on an XML description.
 
Method Summary
static Node cloneSubtree(Document targetDoc, Node sourceRoot)
          Clone a subtree, possibly into another document.
protected  void construct(StylesheetSource stylesheets)
          Construct the message part after parsing the XML description.
protected  void parse(Element message, StylesheetSource stylesheets)
          Parse the XML describing the message part.
 void setFileName(String filename)
          Set the filename associated with this message part.
 
Methods inherited from class javax.mail.internet.MimeBodyPart
addHeader, addHeaderLine, attachFile, attachFile, getAllHeaderLines, getAllHeaders, getContent, getContentID, getContentLanguage, getContentMD5, getContentStream, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFileName, getHeader, getHeader, getInputStream, getLineCount, getMatchingHeaderLines, getMatchingHeaders, getNonMatchingHeaderLines, getNonMatchingHeaders, getRawInputStream, getSize, isMimeType, removeHeader, saveFile, saveFile, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setHeader, setText, setText, setText, updateHeaders, writeTo
 
Methods inherited from class javax.mail.BodyPart
getParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mimeType

protected String mimeType

language

protected String language

stylesheetName

protected String stylesheetName

templateData

protected String templateData

replacementData

protected Document replacementData

resourceList

protected Vector resourceList

filename

protected String filename

m_sMailTemplateDN

protected String m_sMailTemplateDN

m_sTemplateAttr

protected String m_sTemplateAttr

encoding

protected String encoding
Constructor Detail

MailMessagePart

public MailMessagePart(Element message,
                       StylesheetSource stylesheets,
                       MailMessage parent)
                throws HandlerException,
                       FileNotFoundException
Construct the message part based on an XML description.

Parameters:
message - <message> or <attachment> element
stylesheets - A StylesheetSource object from which to load stylesheets, xml documents, and other files referenced in the describing XML. is being sent.
parent - MailMessage of which this MailMessagePart of a part of.
Throws:
HandlerException
FileNotFoundException
Method Detail

parse

protected void parse(Element message,
                     StylesheetSource stylesheets)
              throws HandlerException,
                     FileNotFoundException
Parse the XML describing the message part.

Parameters:
message - <message> or <attachment> element
stylesheets - Source for any files, XML documents, or XSLT stylesheets references in the mail XML description. supplied to stylesheets used in construction of message parts.
Throws:
HandlerException
FileNotFoundException

construct

protected void construct(StylesheetSource stylesheets)
                  throws HandlerException
Construct the message part after parsing the XML description.

Parameters:
stylesheets - Source for any files, XML documents, or XSLT stylesheets references in the mail XML description.
Throws:
HandlerException

setFileName

public void setFileName(String filename)
                 throws javax.mail.MessagingException
Set the filename associated with this message part. Used for attachments.

Specified by:
setFileName in interface javax.mail.Part
Overrides:
setFileName in class javax.mail.internet.MimeBodyPart
Parameters:
filename - unnormalized filename
Throws:
javax.mail.MessagingException

cloneSubtree

public static Node cloneSubtree(Document targetDoc,
                                Node sourceRoot)
Clone a subtree, possibly into another document. Stolen from engine's XdsUtil class.

Parameters:
targetDoc - target document for the cloned document
sourceRoot - root of subtree to clone
Returns:
root of the cloned subtree, or null if not cloneable