net.fortuna.mstor
Class MStorMessage

java.lang.Object
  extended by javax.mail.Message
      extended by javax.mail.internet.MimeMessage
          extended by net.fortuna.mstor.MStorMessage
All Implemented Interfaces:
java.io.Serializable, javax.mail.internet.MimePart, javax.mail.Part, Taggable

public final class MStorMessage
extends javax.mail.internet.MimeMessage
implements java.io.Serializable, Taggable

Implementation of a message for the mstor javamail provider.

Author:
Ben Fortuna
 $Id$

 Created: [7/07/2004]
 
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.mail.internet.MimeMessage
javax.mail.internet.MimeMessage.RecipientType
 
Field Summary
 
Fields inherited from class javax.mail.internet.MimeMessage
content, contentStream, dh, flags, headers, modified, saved
 
Fields inherited from class javax.mail.Message
expunged, folder, msgnum, session
 
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
 
Constructor Summary
MStorMessage(javax.mail.Folder folder, java.io.InputStream in, int msgnum)
           
MStorMessage(javax.mail.Folder folder, java.io.InputStream in, int msgnum, MessageDelegate delegate)
           
MStorMessage(javax.mail.Folder folder, int msgnum)
           
MStorMessage(javax.mail.Folder folder, javax.mail.internet.InternetHeaders headers, byte[] content, int msgnum)
           
MStorMessage(MessageDelegate delegate)
           
MStorMessage(javax.mail.internet.MimeMessage m)
           
MStorMessage(javax.mail.Session session)
           
MStorMessage(javax.mail.Session session, java.io.InputStream in)
           
 
Method Summary
 void addHeader(java.lang.String s, java.lang.String s1)
          
 void addHeaderLine(java.lang.String s)
          
 void addTag(java.lang.String tag)
          Add the specified tag to the associated tags.
 java.util.Enumeration<java.lang.String> getAllHeaderLines()
          
 java.util.Enumeration<javax.mail.Header> getAllHeaders()
          
protected  java.io.InputStream getContentStream()
          
 java.lang.String[] getHeader(java.lang.String name)
          
 java.lang.String getHeader(java.lang.String name, java.lang.String delimiter)
          
 MStorMessage getInReplyTo()
           
 java.util.Enumeration<java.lang.String> getMatchingHeaderLines(java.lang.String[] names)
          
 java.util.Enumeration<javax.mail.Header> getMatchingHeaders(java.lang.String[] names)
          
 java.util.Enumeration<java.lang.String> getNonMatchingHeaderLines(java.lang.String[] names)
          
 java.util.Enumeration<javax.mail.Header> getNonMatchingHeaders(java.lang.String[] names)
          
 java.util.Date getReceivedDate()
          
 java.util.List<MStorMessage> getReferences()
           
 Tags getTags()
          Returns tags associated with this message.
protected  long getUid()
          Returns the UID associated with the message.
 void removeHeader(java.lang.String s)
          
 void removeTag(java.lang.String tag)
          Remove the specified tag from the associated tags.
 void saveChanges()
          Attempts to save metadata after calling saveChanges in the superclass.
protected  void setExpunged(boolean expunged)
          
 void setFlag(javax.mail.Flags.Flag flag, boolean set)
          
 void setFlags(javax.mail.Flags flags, boolean set)
          
 void setHeader(java.lang.String s, java.lang.String s1)
          
protected  void updateHeaders()
          Attempts to update headers in metadata after updating headers in superclass.
 
Methods inherited from class javax.mail.internet.MimeMessage
addFrom, addRecipients, addRecipients, createInternetHeaders, createMimeMessage, getAllRecipients, getContent, getContentID, getContentLanguage, getContentMD5, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFileName, getFlags, getFrom, getInputStream, getLineCount, getMessageID, getRawInputStream, getRecipients, getReplyTo, getSender, getSentDate, getSize, getSubject, isMimeType, isSet, parse, reply, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setFrom, setFrom, setRecipients, setRecipients, setReplyTo, setSender, setSentDate, setSubject, setSubject, setText, setText, setText, updateMessageID, writeTo, writeTo
 
Methods inherited from class javax.mail.Message
addRecipient, getFolder, getMessageNumber, isExpunged, match, setMessageNumber, setRecipient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MStorMessage

public MStorMessage(javax.mail.Session session)
Parameters:
session - the session associated with the message

MStorMessage

public MStorMessage(javax.mail.Session session,
                    java.io.InputStream in)
Parameters:
session - the session associated with the message
in - an input stream to read message data from

MStorMessage

public MStorMessage(javax.mail.internet.MimeMessage m)
             throws javax.mail.MessagingException
Parameters:
m - a message instance to duplicate
Throws:
javax.mail.MessagingException - where an unexpected error occurs duplicating the specified message

MStorMessage

public MStorMessage(javax.mail.Folder folder,
                    int msgnum)
Parameters:
folder - the folder associated with the message
msgnum - the message number of the message in the specified folder

MStorMessage

public MStorMessage(javax.mail.Folder folder,
                    java.io.InputStream in,
                    int msgnum)
Parameters:
folder - the folder associated with the message
in - an input stream to read message data from
msgnum - the message number of the message in the specified folder

MStorMessage

public MStorMessage(MessageDelegate delegate)
Parameters:
delegate - a delegate providing implementation-specific message functionality

MStorMessage

public MStorMessage(javax.mail.Folder folder,
                    java.io.InputStream in,
                    int msgnum,
                    MessageDelegate delegate)
Parameters:
folder - the folder associated with the message
in - an input stream to read message data from
msgnum - the message number of the message in the specified folder
delegate - a delegate providing implementation-specific message functionality

MStorMessage

public MStorMessage(javax.mail.Folder folder,
                    javax.mail.internet.InternetHeaders headers,
                    byte[] content,
                    int msgnum)
             throws javax.mail.MessagingException
Parameters:
folder - the folder associated with the message
headers - headers for the message instance
content - message data
msgnum - the message number of the message in the specified folder
Throws:
javax.mail.MessagingException - where an unexpected error occurs
Method Detail

getAllHeaderLines

public java.util.Enumeration<java.lang.String> getAllHeaderLines()
                                                          throws javax.mail.MessagingException

Specified by:
getAllHeaderLines in interface javax.mail.internet.MimePart
Overrides:
getAllHeaderLines in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

getAllHeaders

public java.util.Enumeration<javax.mail.Header> getAllHeaders()
                                                       throws javax.mail.MessagingException

Specified by:
getAllHeaders in interface javax.mail.Part
Overrides:
getAllHeaders in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

getHeader

public java.lang.String getHeader(java.lang.String name,
                                  java.lang.String delimiter)
                           throws javax.mail.MessagingException

Specified by:
getHeader in interface javax.mail.internet.MimePart
Overrides:
getHeader in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

getHeader

public java.lang.String[] getHeader(java.lang.String name)
                             throws javax.mail.MessagingException

Specified by:
getHeader in interface javax.mail.Part
Overrides:
getHeader in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

getMatchingHeaderLines

public java.util.Enumeration<java.lang.String> getMatchingHeaderLines(java.lang.String[] names)
                                                               throws javax.mail.MessagingException

Specified by:
getMatchingHeaderLines in interface javax.mail.internet.MimePart
Overrides:
getMatchingHeaderLines in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

getMatchingHeaders

public java.util.Enumeration<javax.mail.Header> getMatchingHeaders(java.lang.String[] names)
                                                            throws javax.mail.MessagingException

Specified by:
getMatchingHeaders in interface javax.mail.Part
Overrides:
getMatchingHeaders in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

getNonMatchingHeaderLines

public java.util.Enumeration<java.lang.String> getNonMatchingHeaderLines(java.lang.String[] names)
                                                                  throws javax.mail.MessagingException

Specified by:
getNonMatchingHeaderLines in interface javax.mail.internet.MimePart
Overrides:
getNonMatchingHeaderLines in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

getNonMatchingHeaders

public java.util.Enumeration<javax.mail.Header> getNonMatchingHeaders(java.lang.String[] names)
                                                               throws javax.mail.MessagingException

Specified by:
getNonMatchingHeaders in interface javax.mail.Part
Overrides:
getNonMatchingHeaders in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

getContentStream

protected java.io.InputStream getContentStream()
                                        throws javax.mail.MessagingException

Overrides:
getContentStream in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

setExpunged

protected void setExpunged(boolean expunged)

Overrides:
setExpunged in class javax.mail.Message

getReceivedDate

public java.util.Date getReceivedDate()
                               throws javax.mail.MessagingException

Overrides:
getReceivedDate in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

setFlags

public void setFlags(javax.mail.Flags flags,
                     boolean set)
              throws javax.mail.MessagingException

Overrides:
setFlags in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

setFlag

public void setFlag(javax.mail.Flags.Flag flag,
                    boolean set)
             throws javax.mail.MessagingException

Overrides:
setFlag in class javax.mail.Message
Throws:
javax.mail.MessagingException

setHeader

public void setHeader(java.lang.String s,
                      java.lang.String s1)
               throws javax.mail.MessagingException

Specified by:
setHeader in interface javax.mail.Part
Overrides:
setHeader in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

addHeader

public void addHeader(java.lang.String s,
                      java.lang.String s1)
               throws javax.mail.MessagingException

Specified by:
addHeader in interface javax.mail.Part
Overrides:
addHeader in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

removeHeader

public void removeHeader(java.lang.String s)
                  throws javax.mail.MessagingException

Specified by:
removeHeader in interface javax.mail.Part
Overrides:
removeHeader in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

addHeaderLine

public void addHeaderLine(java.lang.String s)
                   throws javax.mail.MessagingException

Specified by:
addHeaderLine in interface javax.mail.internet.MimePart
Overrides:
addHeaderLine in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException

addTag

public void addTag(java.lang.String tag)
            throws javax.mail.MessagingException
Description copied from interface: Taggable
Add the specified tag to the associated tags.

Specified by:
addTag in interface Taggable
Parameters:
tag - a message tag
Throws:
javax.mail.MessagingException - where an error occurs updating tags

removeTag

public void removeTag(java.lang.String tag)
               throws javax.mail.MessagingException
Description copied from interface: Taggable
Remove the specified tag from the associated tags.

Specified by:
removeTag in interface Taggable
Parameters:
tag - a message tag
Throws:
javax.mail.MessagingException - where an error occurs updating tags

saveChanges

public void saveChanges()
                 throws javax.mail.MessagingException
Attempts to save metadata after calling saveChanges in the superclass.

Overrides:
saveChanges in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException - where an error occurs in the delegate save

updateHeaders

protected void updateHeaders()
                      throws javax.mail.MessagingException
Attempts to update headers in metadata after updating headers in superclass.

Overrides:
updateHeaders in class javax.mail.internet.MimeMessage
Throws:
javax.mail.MessagingException - where an error occurs in the delegate update

getTags

public Tags getTags()
             throws javax.mail.MessagingException
Returns tags associated with this message. Note that any changes made to the returned instance will not affect this message.

Specified by:
getTags in interface Taggable
Returns:
Returns the tags.
Throws:
javax.mail.MessagingException - where an error occurs retrieving flags

getUid

protected long getUid()
Returns the UID associated with the message.

Returns:
a long representation of a UID, or -1 if no UID is assigned

getInReplyTo

public MStorMessage getInReplyTo()
Returns:
a message instance such that this message is a reply to it

getReferences

public java.util.List<MStorMessage> getReferences()
Returns:
a list of message instances related to this message


Copyright © 2004-2011 Micronode. All Rights Reserved.