|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.mail.Folder
org.apache.geronimo.mail.AbstractFolder
Apache implementation of a generic Folder
. May be subclassed for optimisation for specific protocols.
This stores messages using an internal List
, and allows messages to be cached inside the folder.
Note that the messages do not have to be present or fully loaded; it is possible that a message
will only contain the message ID and be loaded dynamically on request.
Whilst it is possible for other implementations to override Folder
directly, this provides common
methods that allow for easier implementation. Subclasses should implement the abstract methods
from Folder
and the doXxxx()
that this requires in order to facilitate creation
of future folder types.
Field Summary |
Fields inherited from class javax.mail.Folder |
HOLDS_FOLDERS, HOLDS_MESSAGES, mode, READ_ONLY, READ_WRITE, store |
Constructor Summary | |
AbstractFolder(javax.mail.Store store,
javax.mail.URLName name)
Create a new folder associated with the given Store |
Method Summary | |
void |
appendMessages(javax.mail.Message[] messages)
Runs through the array of messages and appends them onto the folder using #add(Message) . |
void |
close(boolean expunge)
Closes the folder, and if expunge , then automatically expunges prior to closure. |
boolean |
delete(boolean recurse)
|
protected abstract void |
doClose()
Implemented by the provider, to close the folder. |
protected abstract void |
doDelete(int id)
Implemented by subclasses to actually delete a message from the store. |
protected abstract javax.mail.Message |
doGetMessage(int id)
Implemented by subclasses to actually load a message from the store. |
protected abstract void |
doOpen(int newMode)
Implemented by subclasses to perform a rename operation. |
protected abstract boolean |
doRenameTo(javax.mail.Folder newName)
Implemented by subclasses to perform a rename operation. |
protected abstract void |
doRenumberMessageTo(javax.mail.Message message,
int id)
Renumber message with new ID after an expunge occurs. |
javax.mail.Message[] |
expunge()
Runs through a list of messages, and removes them from the internal list of messages. |
String |
getFullName()
Returns the full URLName of this folder |
javax.mail.Message |
getMessage(int id)
|
String |
getName()
Returns just the name portion of the URLName |
char |
getSeparator()
Uses ' / ' as the separator. |
int |
getType()
Returns HOLDS_MESSAGES . |
boolean |
hasNewMessages()
|
javax.mail.Folder[] |
list(String pattern)
|
void |
open(int newMode)
|
boolean |
renameTo(javax.mail.Folder newName)
|
Methods inherited from class javax.mail.Folder |
addConnectionListener, addFolderListener, addMessageChangedListener, addMessageCountListener, copyMessages, create, exists, fetch, finalize, getDeletedMessageCount, getFolder, getMessageCount, getMessages, getMessages, getMessages, getMode, getNewMessageCount, getParent, getPermanentFlags, getStore, getUnreadMessageCount, getURLName, isOpen, 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 |
public AbstractFolder(javax.mail.Store store, javax.mail.URLName name)
Store
store
- the Store
this folder is associated withname
- the name of this folderMethod Detail |
public void appendMessages(javax.mail.Message[] messages) throws javax.mail.MessagingException
#add(Message)
.
messages
- the array of messages to add.
javax.mail.MessagingException
public void close(boolean expunge) throws javax.mail.MessagingException
expunge
, then automatically expunges prior to closure.
Afterwards calls doClose() as a hook to the underlying implementation to do the real close operation.
javax.mail.MessagingException
public boolean delete(boolean recurse) throws javax.mail.MessagingException
javax.mail.MessagingException
protected abstract void doClose() throws javax.mail.MessagingException
javax.mail.MessagingException
- if an error occurs during closure.protected abstract void doDelete(int id) throws javax.mail.MessagingException
id
- the message number to delete
javax.mail.MessagingException
- in case of any errorprotected abstract javax.mail.Message doGetMessage(int id) throws javax.mail.MessagingException
id
- the message number to use
javax.mail.MessagingException
- in case of any errorprotected abstract void doOpen(int newMode) throws javax.mail.MessagingException
javax.mail.MessagingException
protected abstract boolean doRenameTo(javax.mail.Folder newName)
newName
- the new name to use
protected abstract void doRenumberMessageTo(javax.mail.Message message, int id) throws javax.mail.MessagingException
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.
message
- the message to renumberid
- the message id
javax.mail.MessagingException
public javax.mail.Message[] expunge() throws javax.mail.MessagingException
javax.mail.MessagingException
public String getFullName()
public javax.mail.Message getMessage(int id) throws javax.mail.MessagingException
javax.mail.MessagingException
public String getName()
public char getSeparator() throws javax.mail.MessagingException
/
' as the separator. This may be overriden by subclases, but is a sensible default.
javax.mail.MessagingException
public int getType() throws javax.mail.MessagingException
HOLDS_MESSAGES
. Override if the server supports folders HOLDS_FOLDERS
instead/as well.
javax.mail.MessagingException
public boolean hasNewMessages() throws javax.mail.MessagingException
javax.mail.MessagingException
public javax.mail.Folder[] list(String pattern) throws javax.mail.MessagingException
javax.mail.MessagingException
public void open(int newMode) throws javax.mail.MessagingException
javax.mail.MessagingException
public boolean renameTo(javax.mail.Folder newName) throws javax.mail.MessagingException
javax.mail.MessagingException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |