|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.ws.transport.mail.monitor.AbstractMonitoringStrategy
public abstract class AbstractMonitoringStrategy
Abstract base class for the MonitoringStrategy interface. Exposes a deleteMessages property, and includes a basic workflow for message monitoring.
| Field Summary | |
|---|---|
protected org.apache.commons.logging.Log |
logger
Logger available to subclasses. |
| Constructor Summary | |
|---|---|
AbstractMonitoringStrategy()
|
|
| Method Summary | |
|---|---|
protected void |
deleteMessages(javax.mail.Folder folder,
javax.mail.Message[] messages)
Deletes the given messages from the given folder. |
protected void |
fetchMessages(javax.mail.Folder folder,
javax.mail.Message[] messages)
Fetches the specified messages from the specified folder. |
int |
getFolderOpenMode()
Returns the folder open mode to be used by this strategy. |
javax.mail.Message[] |
monitor(javax.mail.Folder folder)
Monitors the given folder, and returns any new messages when they arrive. |
protected javax.mail.Message[] |
searchForNewMessages(javax.mail.Folder folder)
Retrieves new messages from the given folder. |
void |
setDeleteMessages(boolean deleteMessages)
Sets whether messages should be marked as DELETED after they have been
read. |
protected abstract void |
waitForNewMessages(javax.mail.Folder folder)
Template method that blocks until new messages arrive in the given folder. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final org.apache.commons.logging.Log logger
| Constructor Detail |
|---|
public AbstractMonitoringStrategy()
| Method Detail |
|---|
public void setDeleteMessages(boolean deleteMessages)
DELETED after they have been
read. Default is true.
public int getFolderOpenMode()
MonitoringStrategyFolder.READ_ONLY or Folder.READ_WRITE.
getFolderOpenMode in interface MonitoringStrategy
public final javax.mail.Message[] monitor(javax.mail.Folder folder)
throws javax.mail.MessagingException,
InterruptedException
waitForNewMessages(Folder), then searches for new messages using searchForNewMessages(Folder), fetches
the messages using fetchMessages(Folder, Message[]), and finally deletes the messages, if deleteMessages is true.
monitor in interface MonitoringStrategyfolder - the folder to monitor
javax.mail.MessagingException - in case of JavaMail errors
InterruptedException - when a thread is interrupted
protected abstract void waitForNewMessages(javax.mail.Folder folder)
throws javax.mail.MessagingException,
InterruptedException
Thread.sleep(long) or the IMAP IDLE command.
folder - the folder to monitor
javax.mail.MessagingException - in case of JavaMail errors
InterruptedException - when a thread is interrupted
protected javax.mail.Message[] searchForNewMessages(javax.mail.Folder folder)
throws javax.mail.MessagingException
SearchTerm that searches for
all messages in the folder that are RECENT, not ANSWERED, and not DELETED. The search term
is used to search for new messages.
folder - the folder to retrieve new messages from
javax.mail.MessagingException - in case of JavaMail errors
protected void fetchMessages(javax.mail.Folder folder,
javax.mail.Message[] messages)
throws javax.mail.MessagingException
fetches every FetchProfile.Item.
folder - the folder to fetch messages frommessages - the messages to fetch
javax.mail.MessagingException - in case of JavMail errors
protected void deleteMessages(javax.mail.Folder folder,
javax.mail.Message[] messages)
throws javax.mail.MessagingException
setDeleteMessages(boolean) is
true.
folder - the folder to delete messages frommessages - the messages to delete
javax.mail.MessagingException - in case of JavaMail errors
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||