org.apache.geronimo.mail.imap
Class IMAPFolder

java.lang.Object
  extended byjavax.mail.Folder
      extended byorg.apache.geronimo.mail.AbstractFolder
          extended byorg.apache.geronimo.mail.imap.IMAPFolder

public class IMAPFolder
extends AbstractFolder

Represents an Apache implementation of an IMAP folder.

Version:
$Revision: 1.3 $ $Date: 2004/03/10 10:00:32 $

Field Summary
 
Fields inherited from class javax.mail.Folder
HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE, store
 
Constructor Summary
IMAPFolder(javax.mail.Store store, javax.mail.URLName name)
          Create a new IMAP folder associated with the given store
 
Method Summary
 boolean create(int type)
           
protected  void doClose()
          Implemented by the provider, to close the folder.
protected  void doDelete(int id)
          Implemented by subclasses to actually delete a message from the store.
protected  javax.mail.Message doGetMessage(int id)
          Implemented by subclasses to actually load a message from the store.
 void doOpen(int newMode)
          Implemented by subclasses to perform a rename operation.
protected  boolean doRenameTo(javax.mail.Folder newName)
          Implemented by subclasses to perform a rename operation.
protected  void doRenumberMessageTo(javax.mail.Message message, int id)
          Renumber message with new ID after an expunge occurs.
 boolean exists()
           
 javax.mail.Folder getFolder(String name)
           
 int getMessageCount()
           
 javax.mail.Folder getParent()
           
 javax.mail.Flags getPermanentFlags()
           
 boolean isOpen()
           
 
Methods inherited from class org.apache.geronimo.mail.AbstractFolder
appendMessages, close, delete, expunge, getFullName, getMessage, getName, getSeparator, getType, hasNewMessages, list, open, renameTo
 
Methods inherited from class javax.mail.Folder
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, copyMessages, fetch, finalize, getDeletedMessageCount, getMessages, getMessages, getMessages, getMode, getNewMessageCount, getStore, getUnreadMessageCount, getURLName, isSubscribed, list, listSubscribed, listSubscribed, notifyConnectionListeners, notifyFolderListeners, notifyFolderRenamedListeners, notifyMessageAddedListeners, notifyMessageChangedListeners, notifyMessageRemovedListeners, removeConnectionListener, removeFolderListener, removeMessageChangedListener, removeMessageCountListener, search, search, setFlags, setFlags, setFlags, setSubscribed, toString
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IMAPFolder

public IMAPFolder(javax.mail.Store store,
                  javax.mail.URLName name)
Create a new IMAP folder associated with the given store

Parameters:
store - the Store that this folder is a part of
name - the name of this folder
Method Detail

create

public boolean create(int type)
               throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

doClose

protected void doClose()
                throws javax.mail.MessagingException
Description copied from class: AbstractFolder
Implemented by the provider, to close the folder. An expunge will already have been performed if required.

Specified by:
doClose in class AbstractFolder
Throws:
javax.mail.MessagingException - if an error occurs during closure.

doDelete

protected void doDelete(int id)
                 throws javax.mail.MessagingException
Description copied from class: AbstractFolder
Implemented by subclasses to actually delete a message from the store. This is then removed from the folder's message cache.

Specified by:
doDelete in class AbstractFolder
Parameters:
id - the message number to delete
Returns:
the newly-created message from the store
Throws:
javax.mail.MessagingException - in case of any error

doGetMessage

protected javax.mail.Message doGetMessage(int id)
                                   throws javax.mail.MessagingException
Description copied from class: AbstractFolder
Implemented by subclasses to actually load a message from the store. This is then cached in the itnernal folder. Note that the message returned does not need to be fully loaded; it can be a placeholder with the message id only and dynamically access the rest of the message when required.

Specified by:
doGetMessage in class AbstractFolder
Parameters:
id - the message number to use
Returns:
the newly-created message from the store
Throws:
javax.mail.MessagingException - in case of any error

doRenameTo

protected boolean doRenameTo(javax.mail.Folder newName)
Description copied from class: AbstractFolder
Implemented by subclasses to perform a rename operation. Called by renameTo(), and if successful, the name is update.

Specified by:
doRenameTo in class AbstractFolder
Parameters:
newName - the new name to use
Returns:
true if the folder is renamed; false otherwise.

doRenumberMessageTo

protected void doRenumberMessageTo(javax.mail.Message message,
                                   int id)
                            throws javax.mail.MessagingException
Description copied from class: AbstractFolder
Renumber message with new ID after an expunge occurs. Since the Message#setMessageNumber is protected, there cannot be an implementation that provides it. However, subclasses that use their own implementation of Message (e.g. POP3Message) can set up the setMessageNumber to be protected, and thus available in the local package. This method implementation is likely to look like:
   protected void doRenumberMessageTo(Message message, int id) throws MessagingException {
     ((POP3Message)message).setMessageNumber(id);
   }
 
Note that this cannot be done generically in the superclass since there is no way of making the setMessageNumber() method visible to this class without violating the JavaMail spec.

Specified by:
doRenumberMessageTo in class AbstractFolder
Parameters:
message - the message to renumber
id - the message id
Throws:
javax.mail.MessagingException

exists

public boolean exists()
               throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getFolder

public javax.mail.Folder getFolder(String name)
                            throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getMessageCount

public int getMessageCount()
                    throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getParent

public javax.mail.Folder getParent()
                            throws javax.mail.MessagingException
Throws:
javax.mail.MessagingException

getPermanentFlags

public javax.mail.Flags getPermanentFlags()

isOpen

public boolean isOpen()

doOpen

public void doOpen(int newMode)
            throws javax.mail.MessagingException
Description copied from class: AbstractFolder
Implemented by subclasses to perform a rename operation. Called by renameTo(), and if successful, the name is update.

Specified by:
doOpen in class AbstractFolder
Throws:
javax.mail.MessagingException


Copyright © 2003-2005 Apache Software Foundation. All Rights Reserved.