org.apache.geronimo.javamail.store.imap
Class IMAPRootFolder

java.lang.Object
  extended by javax.mail.Folder
      extended by org.apache.geronimo.javamail.store.imap.IMAPFolder
          extended by org.apache.geronimo.javamail.store.imap.IMAPRootFolder
All Implemented Interfaces:
UIDFolder, IMAPUntaggedResponseHandler

public class IMAPRootFolder
extends IMAPFolder

An IMAP folder instance for the root of IMAP folder tree. This has some of the folder operations disabled.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.geronimo.javamail.store.imap.IMAPFolder
IMAPFolder.FetchProfileItem
 
Field Summary
 
Fields inherited from class org.apache.geronimo.javamail.store.imap.IMAPFolder
availableFlags, cachedStatus, currentConnection, folderOpen, folderType, fullname, lastStatusTimeStamp, listInfo, maxSequenceNumber, messages, name, nextMessageID, permanentFlags, recentMessages, separator, session, statusCacheTimeout, subscribed, uidCache, uidNext, uidValidity, UNDETERMINED, unseenMessages
 
Fields inherited from class javax.mail.Folder
HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE, store
 
Fields inherited from interface javax.mail.UIDFolder
LASTUID
 
Constructor Summary
IMAPRootFolder(IMAPStore store)
          Create a default IMAPRootFolder attached to a specific Store instance.
 
Method Summary
 void appendMessages(Message[] msgs)
          Append the supplied messages to this folder.
 boolean create(int newType)
          Create a new folder capable of containing subfolder and/or messages as determined by the type parameter.
 boolean delete(boolean recurse)
          Delete this folder and possibly any subfolders.
 boolean exists()
          Check to see if this folder physically exists in the store.
 Message[] expunge()
          Permanently delete all supplied messages that have the DELETED flag set from the Store.
 int getDeletedMessagesCount()
           
 Folder getFolder(String name)
          Get the Folder determined by the supplied name; if the name is relative then it is interpreted relative to this folder.
 int getMessagesCount()
           
 int getNewMessagesCount()
           
 Folder getParent()
          Return the parent for this folder; if the folder is at the root of a heirarchy this returns null.
 int getUnreadMessagesCount()
           
 boolean hasNewMessages()
          Check to see if this Folder conatins messages with the Flag.RECENT flag set.
 boolean rename(boolean recurse)
           
 
Methods inherited from class org.apache.geronimo.javamail.store.imap.IMAPFolder
addACL, addRights, addToUidCache, appendMessage, checkClosed, checkFolderValidity, checkMessageFolder, checkMessageValidity, checkOpen, checkOpenReadWrite, checkReadWrite, cleanupFolder, close, copyMessages, expungeMessage, fetch, filterFolders, findListResponse, generateMessageSet, generateMessageSet, getAttributes, getConnection, getDeletedMessageCount, getFullName, getMailBoxName, getMessage, getMessageByUID, getMessageCount, getMessages, getMessagesByUID, getMessagesByUID, getName, getNewMessageCount, getPermanentFlags, getQuota, getSeparator, getType, getUID, getUIDValidity, getUnreadMessageCount, handleResponse, holdsFolders, isOpen, isSubscribed, list, listRights, listSubscribed, myRights, notifyMessageChangedListeners, open, populateMessageCache, refreshStatus, releaseConnection, removeACL, removeRights, renameTo, resolveMessages, retrieveMessageByUid, search, search, setFlags, setFlags, setFlags, setQuota, setSubscribed
 
Methods inherited from class javax.mail.Folder
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, finalize, getMessages, getMessages, getMode, getStore, getURLName, list, listSubscribed, notifyConnectionListeners, notifyFolderListeners, notifyFolderRenamedListeners, notifyMessageAddedListeners, notifyMessageRemovedListeners, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IMAPRootFolder

public IMAPRootFolder(IMAPStore store)
Create a default IMAPRootFolder attached to a specific Store instance.

Parameters:
store - The Store instance this is the root for.
Method Detail

getFolder

public Folder getFolder(String name)
                 throws MessagingException
Get the Folder determined by the supplied name; if the name is relative then it is interpreted relative to this folder. This does not check that the named folder actually exists.

Overrides:
getFolder in class IMAPFolder
Parameters:
name - the name of the folder to return
Returns:
the named folder
Throws:
MessagingException - if there was a problem accessing the store

getParent

public Folder getParent()
Description copied from class: IMAPFolder
Return the parent for this folder; if the folder is at the root of a heirarchy this returns null. This can be invoked when the folder is closed.

Overrides:
getParent in class IMAPFolder
Returns:
this folder's parent

exists

public boolean exists()
               throws MessagingException
Description copied from class: IMAPFolder
Check to see if this folder physically exists in the store. This can be invoked when the folder is closed.

Overrides:
exists in class IMAPFolder
Returns:
true if the folder really exists
Throws:
MessagingException - if there was a problem accessing the store

hasNewMessages

public boolean hasNewMessages()
Description copied from class: IMAPFolder
Check to see if this Folder conatins messages with the Flag.RECENT flag set. This can be used when the folder is closed to perform a light-weight check for new mail; to perform an incremental check for new mail the folder must be opened.

Overrides:
hasNewMessages in class IMAPFolder
Returns:
true if the Store has recent messages

getMessagesCount

public int getMessagesCount()

getNewMessagesCount

public int getNewMessagesCount()

getUnreadMessagesCount

public int getUnreadMessagesCount()

getDeletedMessagesCount

public int getDeletedMessagesCount()

create

public boolean create(int newType)
               throws MessagingException
Description copied from class: IMAPFolder
Create a new folder capable of containing subfolder and/or messages as determined by the type parameter. Any hierarchy defined by the folder name will be recursively created. If the folder was sucessfully created, a CREATED FolderEvent is sent to all FolderListeners registered with this Folder or with the Store.

Overrides:
create in class IMAPFolder
Parameters:
newType - the type, indicating if this folder should contain subfolders, messages or both
Returns:
true if the folder was sucessfully created
Throws:
MessagingException - if there was a problem accessing the store

delete

public boolean delete(boolean recurse)
               throws MessagingException
Description copied from class: IMAPFolder
Delete this folder and possibly any subfolders. This operation can only be performed on a closed folder. If recurse is true, then all subfolders are deleted first, then any messages in this folder are removed and it is finally deleted; FolderEvent.DELETED events are sent as appropriate. If recurse is false, then the behaviour depends on the folder type and store implementation as followd: FolderEvents are sent to all listeners registered with this folder or with the Store.

Overrides:
delete in class IMAPFolder
Parameters:
recurse - whether subfolders should be recursively deleted as well
Returns:
true if the delete operation succeeds
Throws:
MessagingException - if there was a problem accessing the store

rename

public boolean rename(boolean recurse)
               throws MessagingException
Throws:
MessagingException

appendMessages

public void appendMessages(Message[] msgs)
                    throws MessagingException
Description copied from class: IMAPFolder
Append the supplied messages to this folder. A MessageCountEvent is sent to all listeners registered with this folder when all messages have been appended. If the array contains a previously expunged message, it must be re-appended to the Store and implementations must not abort this operation.

Overrides:
appendMessages in class IMAPFolder
Parameters:
msgs - The array of messages to append to the folder.
Throws:
MessagingException - if there was a problem accessing the store

expunge

public Message[] expunge()
                  throws MessagingException
Description copied from class: IMAPFolder
Permanently delete all supplied messages that have the DELETED flag set from the Store. The original message indices of all messages actually deleted are returned and a MessageCountEvent event is sent to all listeners with this folder. The expunge may cause the indices of all messaged that remain in the folder to change.

Overrides:
expunge in class IMAPFolder
Returns:
the original indices of messages that were actually deleted
Throws:
MessagingException - if there was a problem accessing the store


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