org.apache.cocoon.mail
Class MailContentHandlerDelegate

java.lang.Object
  extended byorg.apache.cocoon.util.AbstractLogEnabled
      extended byorg.apache.cocoon.mail.MailContentHandlerDelegate

public class MailContentHandlerDelegate
extends org.apache.cocoon.util.AbstractLogEnabled

Marshal javamail objects

Having one or more javamail objects, like Message, Folder, et al. emit SAX events

Since:
24 October 2002
Version:
$Id: MailContentHandlerDelegate.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
static String PREFIX
          PREFIX of the generated XML elements
static String URI
          URI of the generated XML elements
 
Constructor Summary
MailContentHandlerDelegate(ContentHandler contentHandler)
          Constructor for the MailContentHandler object
 
Method Summary
protected  void contentToSAX(ContentHandler contentHandler, Part part)
          Emit content of message part as sequence of SAX events
protected  void emitAddress(String nodeName, Address address)
          Helper method emitting SAX events representing an internet address
protected  void emitDate(String nodeName, Date d)
          Helper method emitting SAX events representing a date
 void endDocument()
          Emit starting SAX events sequence, including SAX endDocument event
protected  void endDocumentInternal(boolean emitEndDocument)
          Emit end document sequence
 void endDocumentXMLizer()
          Emit starting SAX events sequence, excluding SAX endDocument event
protected  void folderToSAX(ContentHandler contentHandler, Folder folder)
          Emit folder as sequence of SAX events
 SimpleDateFormat getSimpleDateFormat()
          Gets the simpleDateFormat attribute of the MailContentHandlerDelegate object
 void marshalFolderToSAX(Folder folder)
          Emit a folder as a sequence of SAX events
 void marshalFolderToSAX(Folder[] folders)
          Emit folders as a sequence of SAX events
 void marshalMessageEnvelopeToSAX(Message message)
          Emit a message envelope as a sequence of SAX events
 void marshalMessageToSAX(Message message)
          Emit a message envelope, and message content as a sequence of SAX events
 void marshalPartToSAX(Part part)
          Emit a message content as a sequence of SAX events
protected  void messageEnvelopeToSAX(ContentHandler contentHandler, Message message)
          Emit message envelope as sequence of SAX events
protected  void partToSAX(ContentHandler contentHandler, Part part, int i)
          Emit part as sequence of SAX events
 void setSimpleDateFormat(SimpleDateFormat sdf)
          Sets the simpleDateFormatter attribute of the MailContentHandlerDelegate object
 void startDocument()
          Emit starting SAX events sequence, including SAX startDocument event
protected  void startDocumentInternal(boolean emitStartDocument)
          Emit start document sequence
 void startDocumentXMLizer()
          Emit starting SAX events sequence, excluding SAX startDocument event
 
Methods inherited from class org.apache.cocoon.util.AbstractLogEnabled
getLogger, setLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URI

public static final String URI
URI of the generated XML elements

See Also:
Constant Field Values

PREFIX

public static final String PREFIX
PREFIX of the generated XML elements

See Also:
Constant Field Values
Constructor Detail

MailContentHandlerDelegate

public MailContentHandlerDelegate(ContentHandler contentHandler)
Constructor for the MailContentHandler object

Parameters:
contentHandler - Description of Parameter
Method Detail

setSimpleDateFormat

public void setSimpleDateFormat(SimpleDateFormat sdf)
Sets the simpleDateFormatter attribute of the MailContentHandlerDelegate object

Parameters:
sdf - The new simpleDateFormat value

getSimpleDateFormat

public SimpleDateFormat getSimpleDateFormat()
Gets the simpleDateFormat attribute of the MailContentHandlerDelegate object

Returns:
The simpleDateFormat value

startDocument

public void startDocument()
                   throws SAXException
Emit starting SAX events sequence, including SAX startDocument event

Throws:
SAXException - thrown iff generating SAX events fails

startDocumentXMLizer

public void startDocumentXMLizer()
                          throws SAXException
Emit starting SAX events sequence, excluding SAX startDocument event

Throws:
SAXException - thrown iff generating SAX events fails

endDocument

public void endDocument()
                 throws SAXException
Emit starting SAX events sequence, including SAX endDocument event

Throws:
SAXException - thrown iff generating SAX events fails

endDocumentXMLizer

public void endDocumentXMLizer()
                        throws SAXException
Emit starting SAX events sequence, excluding SAX endDocument event

Throws:
SAXException - thrown iff generating SAX events fails

marshalFolderToSAX

public void marshalFolderToSAX(Folder folder)
Emit a folder as a sequence of SAX events

Parameters:
folder - emit this folder

marshalFolderToSAX

public void marshalFolderToSAX(Folder[] folders)
Emit folders as a sequence of SAX events

Parameters:
folders - emit these folders

marshalMessageEnvelopeToSAX

public void marshalMessageEnvelopeToSAX(Message message)
Emit a message envelope as a sequence of SAX events

Parameters:
message - emit envelope of this message

marshalMessageToSAX

public void marshalMessageToSAX(Message message)
Emit a message envelope, and message content as a sequence of SAX events

Parameters:
message - emit envelope, and content of this message

marshalPartToSAX

public void marshalPartToSAX(Part part)
Emit a message content as a sequence of SAX events

Parameters:
part - Description of the Parameter

startDocumentInternal

protected void startDocumentInternal(boolean emitStartDocument)
                              throws SAXException
Emit start document sequence

Parameters:
emitStartDocument - flag controlling invocation of SAX startDocument
Throws:
SAXException - thrown iff generating SAX events fails

endDocumentInternal

protected void endDocumentInternal(boolean emitEndDocument)
                            throws SAXException
Emit end document sequence

Parameters:
emitEndDocument - flag controlling invocation of SAX endDocument
Throws:
SAXException - thrown iff generating SAX events fails

folderToSAX

protected void folderToSAX(ContentHandler contentHandler,
                           Folder folder)
                    throws MessagingException,
                           SAXException
Emit folder as sequence of SAX events

Parameters:
folder - emit this folder
contentHandler - specifies sink of SAX events
Throws:
MessagingException - thrown iff accessing javamail data fails
SAXException - thrown iff generating SAX events fails

messageEnvelopeToSAX

protected void messageEnvelopeToSAX(ContentHandler contentHandler,
                                    Message message)
                             throws MessagingException,
                                    SAXException
Emit message envelope as sequence of SAX events

Parameters:
message - emit envelope of this message
contentHandler - specifies sink of SAX events
Throws:
MessagingException - thrown iff accessing javamail data fails
SAXException - thrown iff generating SAX events fails

partToSAX

protected void partToSAX(ContentHandler contentHandler,
                         Part part,
                         int i)
                  throws MessagingException,
                         IOException,
                         SAXException
Emit part as sequence of SAX events

Parameters:
part - Description of the Parameter
contentHandler - specifies sink of SAX events
i - Description of the Parameter
Throws:
MessagingException - thrown iff accessing javamail data fails
IOException - thrown iff accessing content fails
SAXException - thrown iff generating SAX events fails

contentToSAX

protected void contentToSAX(ContentHandler contentHandler,
                            Part part)
                     throws MessagingException,
                            IOException,
                            SAXException
Emit content of message part as sequence of SAX events

Parameters:
contentHandler - specifies sink of SAX events
part - emit this part as sequence of SAX events
Throws:
SAXException - thrown iff generating SAX events fails
MessagingException - thrown iff accessing javamail data fails
IOException - thrown iff accessing content fails

emitAddress

protected void emitAddress(String nodeName,
                           Address address)
                    throws SAXException
Helper method emitting SAX events representing an internet address

Parameters:
nodeName - emitted element node name
address - emitted address data
Throws:
SAXException - thrown iff generating SAX events fails

emitDate

protected void emitDate(String nodeName,
                        Date d)
                 throws SAXException
Helper method emitting SAX events representing a date

Parameters:
nodeName - emitted element node name
d - Description of the Parameter
Throws:
SAXException - thrown iff generating SAX events fails


Copyright © 1999-2008 The Apache Software Foundation. All Rights Reserved.