public abstract class MailFolder
extends java.lang.Object
implements java.util.Iterator
Constructor and Description |
---|
MailFolder(MailActivationSpec spec)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the mail session
|
protected void |
close(boolean checkSuccessful)
Closes a mail session
|
protected abstract void |
closeStore(boolean success,
Store store,
Folder folder)
Close a store
|
static MailFolder |
getInstance(MailActivationSpec mailActivationSpec)
Get an instance of a mail folder
|
protected abstract Message[] |
getMessages(Folder folder)
Get the messages from a folder
|
boolean |
hasNext() |
protected abstract void |
markMessageSeen(Message message)
Mark a message as seen
|
java.lang.Object |
next() |
void |
open()
Open a mail session
|
protected abstract Store |
openStore(Session session)
Open a store
|
void |
remove() |
public MailFolder(MailActivationSpec spec)
spec
- The mail activation specpublic void open() throws java.lang.Exception
java.lang.Exception
- Thrown if a session can't be establishedpublic void close() throws MessagingException
MessagingException
- Thrown if an error occurs duing closepublic boolean hasNext()
hasNext
in interface java.util.Iterator
public java.lang.Object next()
next
in interface java.util.Iterator
public void remove()
remove
in interface java.util.Iterator
protected void close(boolean checkSuccessful)
checkSuccessful
- Check if it was a successful closepublic static MailFolder getInstance(MailActivationSpec mailActivationSpec)
mailActivationSpec
- The mail activation specnull
if not IMAP / POP basedprotected abstract Store openStore(Session session) throws NoSuchProviderException
session
- The mail sessionNoSuchProviderException
- Thrown if there is no providerprotected abstract void closeStore(boolean success, Store store, Folder folder) throws MessagingException
success
- Check for successful closestore
- The storefolder
- The folderMessagingException
- Thrown if there is an errorprotected abstract Message[] getMessages(Folder folder) throws MessagingException
folder
- The folderMessagingException
- Thrown if there is an errorprotected abstract void markMessageSeen(Message message) throws MessagingException
message
- The messagesMessagingException
- Thrown if there is an errorCopyright ? 2010 Red Hat Middleware LLC (http://www.jboss.com/)