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

java.lang.Object
  extended by javax.mail.Folder
      extended by org.apache.geronimo.javamail.store.nntp.NNTPFolder
          extended by org.apache.geronimo.javamail.store.nntp.NNTPGroupFolder

public class NNTPGroupFolder
extends NNTPFolder

The NNTP implementation of the javax.mail.Folder Note that only INBOX is supported in NNTP

http://www.faqs.org/rfcs/rfc1939.html

Version:
$Rev: 686231 $ $Date: 2008-08-15 10:24:20 -0400 (Fri, 15 Aug 2008) $
See Also:
Folder

Field Summary
protected  int firstArticle
           
protected  int lastArticle
           
 
Fields inherited from class org.apache.geronimo.javamail.store.nntp.NNTPFolder
connection, folderOpen, fullName, messageCount, name, parent, permanentFlags, session
 
Fields inherited from class javax.mail.Folder
HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE, store
 
Constructor Summary
protected NNTPGroupFolder(NNTPRootFolder parent, NNTPStore store, String name, NNTPNewsrcGroup groupInfo)
          Construct a "real" folder representing an NNTP news group.
 
Method Summary
 void closeFolder()
          Close the folder, which also clears out the article caches.
 boolean exists()
          Test to see if this folder actually exists.
 void fetch(Message[] msgs, FetchProfile fp)
           
 Message getMessage(int msgNum)
          Checks wether the message is in cache, if not will create a new message object and return it.
 Message[] getMessages()
          Retrieve all articles in the group.
 boolean hasNewMessages()
          Ping the NNTP server to check if a newsgroup has any new messages.
 boolean isSeen(int article)
          Return the "seen" state for an article in a folder.
 boolean isSubscribed()
          Return the subscription status of this folder.
protected  void openFolder()
          Open the folder for use.
 void setSeen(int article, boolean flag)
          Set the seen state for an article in a folder.
 void setSubscribed(boolean flag)
          Set or clear the subscription status of a file.
 
Methods inherited from class org.apache.geronimo.javamail.store.nntp.NNTPFolder
appendMessages, checkClosed, checkOpen, close, create, delete, expunge, getFolder, getFullName, getMessageCount, getName, getParent, getPermanentFlags, getSeparator, getType, isOpen, list, listSubscribed, notifyMessageChangedListeners, open, renameTo
 
Methods inherited from class javax.mail.Folder
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, copyMessages, finalize, getDeletedMessageCount, getMessages, getMessages, getMode, getNewMessageCount, getStore, getUnreadMessageCount, getURLName, list, listSubscribed, notifyConnectionListeners, notifyFolderListeners, notifyFolderRenamedListeners, notifyMessageAddedListeners, notifyMessageRemovedListeners, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, search, search, setFlags, setFlags, setFlags, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

firstArticle

protected int firstArticle

lastArticle

protected int lastArticle
Constructor Detail

NNTPGroupFolder

protected NNTPGroupFolder(NNTPRootFolder parent,
                          NNTPStore store,
                          String name,
                          NNTPNewsrcGroup groupInfo)
Construct a "real" folder representing an NNTP news group.

Parameters:
parent - The parent root folder.
store - The Store this folder is attached to.
name - The folder name.
groupInfo - The newsrc group information attached to the newsrc database. This contains subscription and article "SEEN" information.
Method Detail

exists

public boolean exists()
               throws MessagingException
Test to see if this folder actually exists. This pings the server for information about the GROUP and updates the article count and index information.

Overrides:
exists in class NNTPFolder
Returns:
true if the newsgroup exists on the server, false otherwise.
Throws:
MessagingException

hasNewMessages

public boolean hasNewMessages()
                       throws MessagingException
Ping the NNTP server to check if a newsgroup has any new messages.

Overrides:
hasNewMessages in class NNTPFolder
Returns:
True if the server has new articles from the last time we checked. Also returns true if this is the first time we've checked.
Throws:
MessagingException

openFolder

protected void openFolder()
                   throws MessagingException
Open the folder for use. This retrieves article count information from the server.

Overrides:
openFolder in class NNTPFolder
Throws:
MessagingException

closeFolder

public void closeFolder()
                 throws MessagingException
Close the folder, which also clears out the article caches.

Overrides:
closeFolder in class NNTPFolder
Throws:
MessagingException

getMessage

public Message getMessage(int msgNum)
                   throws MessagingException
Checks wether the message is in cache, if not will create a new message object and return it.

Overrides:
getMessage in class NNTPFolder
Throws:
MessagingException
See Also:
Folder.getMessage(int)

getMessages

public Message[] getMessages()
                      throws MessagingException
Retrieve all articles in the group.

Overrides:
getMessages in class Folder
Returns:
An array of all messages in the group.
Throws:
MessagingException

fetch

public void fetch(Message[] msgs,
                  FetchProfile fp)
           throws MessagingException
Overrides:
fetch in class Folder
Throws:
MessagingException
See Also:
The JavaMail API recommends that this method be overrident to provide a meaningfull implementation.

isSubscribed

public boolean isSubscribed()
Return the subscription status of this folder.

Overrides:
isSubscribed in class NNTPFolder
Returns:
true if the folder is marked as subscribed, false for unsubscribed.

setSubscribed

public void setSubscribed(boolean flag)
Set or clear the subscription status of a file.

Overrides:
setSubscribed in class NNTPFolder
Parameters:
flag - The new subscription state.

isSeen

public boolean isSeen(int article)
Return the "seen" state for an article in a folder.

Overrides:
isSeen in class NNTPFolder
Parameters:
article - The article number.
Returns:
true if the article is marked as seen in the newsrc file, false for unseen files.

setSeen

public void setSeen(int article,
                    boolean flag)
Set the seen state for an article in a folder.

Overrides:
setSeen in class NNTPFolder
Parameters:
article - The article number.
flag - The new seen state.


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