org.apache.geronimo.javamail.store.nntp
Class NNTPMessage

java.lang.Object
  extended by javax.mail.Message
      extended by javax.mail.internet.MimeMessage
          extended by org.apache.geronimo.javamail.store.nntp.NNTPMessage
All Implemented Interfaces:
MimePart, Part

public class NNTPMessage
extends MimeMessage

NNTP implementation of javax.mail.internet.MimeMessage Only the most basic information is given and Message objects created here is a light-weight reference to the actual Message As per the JavaMail spec items from the actual message will get filled up on demand If some other items are obtained from the server as a result of one call, then the other details are also processed and filled in. For ex if RETR is called then header information will also be processed in addition to the content

Version:
$Rev: 437941 $ $Date: 2006-08-28 23:56:02 -0400 (Mon, 28 Aug 2006) $

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.mail.internet.MimeMessage
MimeMessage.RecipientType
 
Field Summary
protected  NNTPConnection connection
           
protected  boolean contentLoaded
           
protected  boolean headersLoaded
           
protected  Session session
           
protected  NNTPStore store
           
 
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
 
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
 
Method Summary
 void addHeader(String name, String value)
           
 void addHeaderLine(String line)
           
 Enumeration getAllHeaderLines()
           
 Enumeration getAllHeaders()
           
protected  InputStream getContentStream()
           
 String[] getHeader(String name)
          Following is a set of methods that deal with headers These methods are just overrides on the superclass methods to allow lazy loading of the header information.
 String getHeader(String name, String delimiter)
           
 int getLineCount()
          Get a line count for the NNTP message.
 Enumeration getMatchingHeaderLines(String[] names)
           
 Enumeration getMatchingHeaders(String[] names)
           
 String getMessageId()
          Get the server assigned messageid for the article.
 Enumeration getNonMatchingHeaderLines(String[] names)
           
 Enumeration getNonMatchingHeaders(String[] names)
           
 int getSize()
          Retrieve the size of the message content.
 void loadArticle()
          Load the entire article from the NNTP server.
 void loadContent()
          Load just the message content from the NNTP server.
 void loadHeaders()
          Retrieve the message headers from the NNTP server.
 void removeHeader(String name)
           
 void saveChanges()
          We cannot modify these messages
 void setFlags(Flags flag, boolean newvalue)
          Override of setFlags().
 void setHeader(String name, String value)
           
 void updateContent(InputStream in)
          Update the article content from an input stream.
 void updateHeaders(InputStream in)
          Update the message headers from an input stream.
 
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, getMessageID, getRawInputStream, getReceivedDate, getRecipients, getReplyTo, getSender, getSentDate, 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, updateHeaders, updateMessageID, writeTo, writeTo
 
Methods inherited from class javax.mail.Message
addRecipient, getFolder, getMessageNumber, isExpunged, match, setExpunged, setFlag, setMessageNumber, setRecipient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected Session session

store

protected NNTPStore store

connection

protected NNTPConnection connection

headersLoaded

protected boolean headersLoaded

contentLoaded

protected boolean contentLoaded
Method Detail

getSize

public int getSize()
            throws MessagingException
Retrieve the size of the message content. The content will be retrieved from the server, if necessary.

Specified by:
getSize in interface Part
Overrides:
getSize in class MimeMessage
Returns:
The size of the content.
Throws:
MessagingException

getLineCount

public int getLineCount()
                 throws MessagingException
Get a line count for the NNTP message. This is potentially stored in the Lines article header. If not there, we return a default of -1.

Specified by:
getLineCount in interface Part
Overrides:
getLineCount in class MimeMessage
Returns:
The header line count estimate, or -1 if not retrieveable.
Throws:
MessagingException

getContentStream

protected InputStream getContentStream()
                                throws MessagingException
Overrides:
getContentStream in class MimeMessage
Throws:
MessagingException
See Also:
MimeMessage.getContentStream()

getHeader

public String[] getHeader(String name)
                   throws MessagingException
Following is a set of methods that deal with headers These methods are just overrides on the superclass methods to allow lazy loading of the header information.

Specified by:
getHeader in interface Part
Overrides:
getHeader in class MimeMessage
Throws:
MessagingException

getHeader

public String getHeader(String name,
                        String delimiter)
                 throws MessagingException
Specified by:
getHeader in interface MimePart
Overrides:
getHeader in class MimeMessage
Throws:
MessagingException

getAllHeaders

public Enumeration getAllHeaders()
                          throws MessagingException
Specified by:
getAllHeaders in interface Part
Overrides:
getAllHeaders in class MimeMessage
Throws:
MessagingException

getMatchingHeaders

public Enumeration getMatchingHeaders(String[] names)
                               throws MessagingException
Specified by:
getMatchingHeaders in interface Part
Overrides:
getMatchingHeaders in class MimeMessage
Throws:
MessagingException

getNonMatchingHeaders

public Enumeration getNonMatchingHeaders(String[] names)
                                  throws MessagingException
Specified by:
getNonMatchingHeaders in interface Part
Overrides:
getNonMatchingHeaders in class MimeMessage
Throws:
MessagingException

getAllHeaderLines

public Enumeration getAllHeaderLines()
                              throws MessagingException
Specified by:
getAllHeaderLines in interface MimePart
Overrides:
getAllHeaderLines in class MimeMessage
Throws:
MessagingException

getMatchingHeaderLines

public Enumeration getMatchingHeaderLines(String[] names)
                                   throws MessagingException
Specified by:
getMatchingHeaderLines in interface MimePart
Overrides:
getMatchingHeaderLines in class MimeMessage
Throws:
MessagingException

getNonMatchingHeaderLines

public Enumeration getNonMatchingHeaderLines(String[] names)
                                      throws MessagingException
Specified by:
getNonMatchingHeaderLines in interface MimePart
Overrides:
getNonMatchingHeaderLines in class MimeMessage
Throws:
MessagingException

addHeader

public void addHeader(String name,
                      String value)
               throws MessagingException
Specified by:
addHeader in interface Part
Overrides:
addHeader in class MimeMessage
Throws:
MessagingException

setHeader

public void setHeader(String name,
                      String value)
               throws MessagingException
Specified by:
setHeader in interface Part
Overrides:
setHeader in class MimeMessage
Throws:
MessagingException

removeHeader

public void removeHeader(String name)
                  throws MessagingException
Specified by:
removeHeader in interface Part
Overrides:
removeHeader in class MimeMessage
Throws:
MessagingException

addHeaderLine

public void addHeaderLine(String line)
                   throws MessagingException
Specified by:
addHeaderLine in interface MimePart
Overrides:
addHeaderLine in class MimeMessage
Throws:
MessagingException

saveChanges

public void saveChanges()
                 throws MessagingException
We cannot modify these messages

Overrides:
saveChanges in class MimeMessage
Throws:
MessagingException

loadHeaders

public void loadHeaders()
                 throws MessagingException
Retrieve the message headers from the NNTP server.

Throws:
MessagingException

updateHeaders

public void updateHeaders(InputStream in)
                   throws MessagingException
Update the message headers from an input stream.

Parameters:
in - The InputStream source for the header information.
Throws:
MessagingException

loadContent

public void loadContent()
                 throws MessagingException
Load just the message content from the NNTP server.

Throws:
MessagingException

loadArticle

public void loadArticle()
                 throws MessagingException
Load the entire article from the NNTP server. This updates both the headers and the content.

Throws:
MessagingException

updateContent

public void updateContent(InputStream in)
                   throws MessagingException
Update the article content from an input stream.

Parameters:
in - The content data source.
Throws:
MessagingException

getMessageId

public String getMessageId()
Get the server assigned messageid for the article.

Returns:
The server assigned message id.

setFlags

public void setFlags(Flags flag,
                     boolean newvalue)
              throws MessagingException
Override of setFlags(). We need to ensure that if the SEEN flag is set or cleared, that the newsrc file correctly reflects the current state.

Overrides:
setFlags in class MimeMessage
Parameters:
flag - The flag being set.
newvalue - The new flag value.
Throws:
MessagingException


Copyright © 2003-2009 The Apache Software Foundation. All Rights Reserved.