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

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.NNTPRootFolder

public class NNTPRootFolder
extends NNTPFolder

The base NNTP implementation of the javax.mail.Folder This is a base class for both the Root NNTP server and each NNTP group folder.

Version:
$Rev: 437941 $
See Also:
Folder

Field Summary
protected static String NNTP_LISTALL
           
 
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 NNTPRootFolder(NNTPStore store, String name, String fullName)
          Construct the NNTPRootFolder.
 
Method Summary
protected  Folder[] filterActiveGroups(String pattern)
          Retrieve the list of matching groups from the NNTP server using the LIST ACTIVE command.
protected  Folder[] filterAllGroups(String pattern)
          Retrieve a list of all groups from the server and filter on the names.
protected  Folder[] filterSubscribedGroups(String pattern)
          Return the set of groups from the newsrc subscribed groups list that match a given filter.
 Folder getFolder(String name)
          Get a new folder from the root folder.
protected  String getGroupName(String response)
          Utility method for extracting a name from a group list response.
 int getType()
          Return whether this folder can hold just messages or also subfolders.
 Folder[] list(String pattern)
          List the subfolders.
 Folder[] listSubscribed(String pattern)
          Retrieve the list of subscribed folders that match the given pattern string.
 
Methods inherited from class org.apache.geronimo.javamail.store.nntp.NNTPFolder
appendMessages, checkClosed, checkOpen, close, closeFolder, create, delete, exists, expunge, getFullName, getMessage, getMessageCount, getName, getParent, getPermanentFlags, getSeparator, hasNewMessages, isOpen, isSeen, isSubscribed, notifyMessageChangedListeners, open, openFolder, renameTo, setSeen, setSubscribed
 
Methods inherited from class javax.mail.Folder
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, copyMessages, fetch, finalize, getDeletedMessageCount, getMessages, 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

NNTP_LISTALL

protected static final String NNTP_LISTALL
See Also:
Constant Field Values
Constructor Detail

NNTPRootFolder

protected NNTPRootFolder(NNTPStore store,
                         String name,
                         String fullName)
Construct the NNTPRootFolder.

Parameters:
store - The owning Store.
name - The folder name (by default, this is the server host name).
fullName - The fullName to use for this server (derived from welcome string).
Method Detail

list

public Folder[] list(String pattern)
              throws MessagingException
List the subfolders. For group folders, this is a meaningless so we throw a MethodNotSupportedException.

Overrides:
list in class NNTPFolder
Parameters:
pattern - The folder pattern string.
Returns:
Never returns.
Throws:
MessagingException

listSubscribed

public Folder[] listSubscribed(String pattern)
                        throws MessagingException
Retrieve the list of subscribed folders that match the given pattern string.

Overrides:
listSubscribed in class NNTPFolder
Parameters:
pattern - The pattern string used for the matching
Returns:
An array of matching folders from the subscribed list.
Throws:
MessagingException

filterActiveGroups

protected Folder[] filterActiveGroups(String pattern)
                               throws MessagingException
Retrieve the list of matching groups from the NNTP server using the LIST ACTIVE command. The server does the wildcard matching for us.

Parameters:
pattern - The pattern string (in wildmat format) used to match.
Returns:
An array of folders for the matching groups.
Throws:
MessagingException

filterAllGroups

protected Folder[] filterAllGroups(String pattern)
                            throws MessagingException
Retrieve a list of all groups from the server and filter on the names. Not recommended for the usenet servers, as there are over 30000 groups to process.

Parameters:
pattern - The pattern string used for the selection.
Returns:
The Folders for the matching groups.
Throws:
MessagingException

filterSubscribedGroups

protected Folder[] filterSubscribedGroups(String pattern)
                                   throws MessagingException
Return the set of groups from the newsrc subscribed groups list that match a given filter.

Parameters:
pattern - The selection pattern.
Returns:
The Folders for the matching groups.
Throws:
MessagingException

getGroupName

protected String getGroupName(String response)
Utility method for extracting a name from a group list response.

Parameters:
response - The response string.
Returns:
The group name.

getType

public int getType()
            throws MessagingException
Return whether this folder can hold just messages or also subfolders. Only the root folder can hold other folders, so it will need to override.

Overrides:
getType in class NNTPFolder
Returns:
Always returns Folder.HOLDS_FOLDERS.
Throws:
MessagingException

getFolder

public Folder getFolder(String name)
                 throws MessagingException
Get a new folder from the root folder. This creates a new folder, which might not actually exist on the server. If the folder doesn't exist, an error will occur on folder open.

Overrides:
getFolder in class NNTPFolder
Parameters:
name - The name of the requested folder.
Returns:
A new folder object for this folder.
Throws:
MessagingException


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