com.openexchange.mail.parser
Interface MailMessageHandler

All Known Implementing Classes:
DumperMessageHandler, ImageMessageHandler, InlineContentHandler, JSONMessageHandler, MailPartHandler, MultipleMailPartHandler, NonInlineForwardPartHandler, RawJSONMessageHandler

public interface MailMessageHandler

MailMessageHandler - This interface declares the handleXXX methods which are invoked by the MailMessageParser instance on certain parts of a message.

Each methods returns a boolean value which indicates whether the underlying MailMessageParser instance should proceed or quit message parsing after method invocation.

Author:
Thorben Betten

Method Summary
 boolean handleAttachment(MailPart part, boolean isInline, java.lang.String baseContentType, java.lang.String fileName, java.lang.String id)
          Handle an attachment part (any non-inline parts and file attachments)
 boolean handleBccRecipient(javax.mail.internet.InternetAddress[] recipientAddrs)
          Handle the 'Bcc' recipient message header
 boolean handleCcRecipient(javax.mail.internet.InternetAddress[] recipientAddrs)
          Handle the 'Cc' recipient message header
 boolean handleColorLabel(int colorLabel)
          Handle message's color label
 boolean handleContentId(java.lang.String contentId)
          Handle content id
 boolean handleDispositionNotification(javax.mail.internet.InternetAddress dispositionNotificationTo, boolean seen)
          Handle message's disposition notification
 boolean handleFrom(javax.mail.internet.InternetAddress[] fromAddrs)
          Handle the 'From' message header
 boolean handleHeaders(int size, java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> iter)
          Handle those message headers which cannot be handled through a handleXXX method
 boolean handleImagePart(MailPart part, java.lang.String imageCID, java.lang.String baseContentType, boolean isInline, java.lang.String fileName, java.lang.String id)
          Handle an image part (image/*)
 boolean handleInlineHtml(java.lang.String htmlContent, ContentType contentType, long size, java.lang.String fileName, java.lang.String id)
          Handle a html inline part (text/html)
 boolean handleInlinePlainText(java.lang.String plainTextContent, ContentType contentType, long size, java.lang.String fileName, java.lang.String id)
          Handle a plain text inline part (either text/plain or text/enriched)
 boolean handleInlineUUEncodedAttachment(UUEncodedPart part, java.lang.String id)
          Handle a UUEncoded file attachment inline part
 boolean handleInlineUUEncodedPlainText(java.lang.String decodedTextContent, ContentType contentType, int size, java.lang.String fileName, java.lang.String id)
          Handle a UUEncoded plain text inline part
 void handleMessageEnd(MailMessage mail)
          Perform some optional finishing operations
 boolean handleMsgRef(java.lang.String msgRef)
          Handle referenced mail
 boolean handleMultipart(MailPart mp, int bodyPartCount, java.lang.String id)
          Handle a multipart (multipart/*)
 boolean handleNestedMessage(MailPart mailPart, java.lang.String id)
          Handle a nested message (message/rfc822) Get the message via: MailMessage nestedMail = (MailMessage) mailPart.getContent();
 boolean handlePriority(int priority)
          Handle message's priority
 boolean handleReceivedDate(java.util.Date receivedDate)
          Handle message's received date
 boolean handleSentDate(java.util.Date sentDate)
          Handle message's sent date
 boolean handleSpecialPart(MailPart part, java.lang.String baseContentType, java.lang.String fileName, java.lang.String id)
          Handle special parts.
 boolean handleSubject(java.lang.String subject)
          Handle message's subject
 boolean handleSystemFlags(int flags)
          Handle message's system flags (//SEEN, //ANSWERED, ...)
 boolean handleToRecipient(javax.mail.internet.InternetAddress[] recipientAddrs)
          Handle the 'To' recipient message header
 boolean handleUserFlags(java.lang.String[] userFlags)
          Handle message's user flags
 

Method Detail

handleFrom

boolean handleFrom(javax.mail.internet.InternetAddress[] fromAddrs)
                   throws MailException
Handle the 'From' message header

Throws:
MailException

handleToRecipient

boolean handleToRecipient(javax.mail.internet.InternetAddress[] recipientAddrs)
                          throws MailException
Handle the 'To' recipient message header

Throws:
MailException

handleCcRecipient

boolean handleCcRecipient(javax.mail.internet.InternetAddress[] recipientAddrs)
                          throws MailException
Handle the 'Cc' recipient message header

Throws:
MailException

handleBccRecipient

boolean handleBccRecipient(javax.mail.internet.InternetAddress[] recipientAddrs)
                           throws MailException
Handle the 'Bcc' recipient message header

Throws:
MailException

handleSubject

boolean handleSubject(java.lang.String subject)
                      throws MailException
Handle message's subject

Throws:
MailException

handleSentDate

boolean handleSentDate(java.util.Date sentDate)
                       throws MailException
Handle message's sent date

Throws:
MailException

handleReceivedDate

boolean handleReceivedDate(java.util.Date receivedDate)
                           throws MailException
Handle message's received date

Throws:
MailException

handleHeaders

boolean handleHeaders(int size,
                      java.util.Iterator<java.util.Map.Entry<java.lang.String,java.lang.String>> iter)
                      throws MailException
Handle those message headers which cannot be handled through a handleXXX method

Parameters:
size - The iterator's size or -1 to use Iterator.hasNext() instead
iter - The header iterator
Returns:
true to continue parsing; otherwise false
Throws:
MailException

handlePriority

boolean handlePriority(int priority)
                       throws MailException
Handle message's priority

Throws:
MailException

handleMsgRef

boolean handleMsgRef(java.lang.String msgRef)
                     throws MailException
Handle referenced mail

Throws:
MailException

handleDispositionNotification

boolean handleDispositionNotification(javax.mail.internet.InternetAddress dispositionNotificationTo,
                                      boolean seen)
                                      throws MailException
Handle message's disposition notification

Parameters:
seen - TODO
Throws:
MailException

handleContentId

boolean handleContentId(java.lang.String contentId)
                        throws MailException
Handle content id

Throws:
MailException

handleSystemFlags

boolean handleSystemFlags(int flags)
                          throws MailException
Handle message's system flags (//SEEN, //ANSWERED, ...)

Throws:
MailException

handleUserFlags

boolean handleUserFlags(java.lang.String[] userFlags)
                        throws MailException
Handle message's user flags

Throws:
MailException

handleColorLabel

boolean handleColorLabel(int colorLabel)
                         throws MailException
Handle message's color label

Throws:
MailException

handleInlinePlainText

boolean handleInlinePlainText(java.lang.String plainTextContent,
                              ContentType contentType,
                              long size,
                              java.lang.String fileName,
                              java.lang.String id)
                              throws MailException
Handle a plain text inline part (either text/plain or text/enriched)

Throws:
MailException

handleInlineUUEncodedPlainText

boolean handleInlineUUEncodedPlainText(java.lang.String decodedTextContent,
                                       ContentType contentType,
                                       int size,
                                       java.lang.String fileName,
                                       java.lang.String id)
                                       throws MailException
Handle a UUEncoded plain text inline part

Throws:
MailException

handleInlineUUEncodedAttachment

boolean handleInlineUUEncodedAttachment(UUEncodedPart part,
                                        java.lang.String id)
                                        throws MailException
Handle a UUEncoded file attachment inline part

Throws:
MailException

handleInlineHtml

boolean handleInlineHtml(java.lang.String htmlContent,
                         ContentType contentType,
                         long size,
                         java.lang.String fileName,
                         java.lang.String id)
                         throws MailException
Handle a html inline part (text/html)

Throws:
MailException

handleAttachment

boolean handleAttachment(MailPart part,
                         boolean isInline,
                         java.lang.String baseContentType,
                         java.lang.String fileName,
                         java.lang.String id)
                         throws MailException
Handle an attachment part (any non-inline parts and file attachments)

Throws:
MailException

handleSpecialPart

boolean handleSpecialPart(MailPart part,
                          java.lang.String baseContentType,
                          java.lang.String fileName,
                          java.lang.String id)
                          throws MailException
Handle special parts. A special part is either of MIME type message/delivery-status, message/disposition-notification, text/rfc822-headers, text/x-vcard, text/vcard, text/calendar or text/x-vCalendar

Throws:
MailException

handleImagePart

boolean handleImagePart(MailPart part,
                        java.lang.String imageCID,
                        java.lang.String baseContentType,
                        boolean isInline,
                        java.lang.String fileName,
                        java.lang.String id)
                        throws MailException
Handle an image part (image/*)

Throws:
MailException

handleMultipart

boolean handleMultipart(MailPart mp,
                        int bodyPartCount,
                        java.lang.String id)
                        throws MailException
Handle a multipart (multipart/*)

Throws:
MailException

handleNestedMessage

boolean handleNestedMessage(MailPart mailPart,
                            java.lang.String id)
                            throws MailException
Handle a nested message (message/rfc822)

Get the message via:

 
 MailMessage nestedMail = (MailMessage) mailPart.getContent();
 

Throws:
MailException

handleMessageEnd

void handleMessageEnd(MailMessage mail)
                      throws MailException
Perform some optional finishing operations

Throws:
MailException