|
Spring Web Services Framework | |||||||||
| 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 Log |
logger
Logger available to subclasses. |
| Constructor Summary | |
|---|---|
AbstractMonitoringStrategy()
|
|
| Method Summary | |
|---|---|
protected void |
deleteMessages(Folder folder,
Message[] messages)
Deletes the given messages from the given folder. |
protected void |
fetchMessages(Folder folder,
Message[] messages)
Fetches the specified messages from the specified folder. |
int |
getFolderOpenMode()
Returns the folder open mode to be used by this strategy. |
Message[] |
monitor(Folder folder)
Monitors the given folder, and returns any new messages when they arrive. |
protected Message[] |
searchForNewMessages(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(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 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 Message[] monitor(Folder folder)
throws 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
MessagingException - in case of JavaMail errors
InterruptedException - when a thread is interrupted
protected abstract void waitForNewMessages(Folder folder)
throws MessagingException,
InterruptedException
Thread.sleep(long) or the IMAP IDLE command.
folder - the folder to monitor
MessagingException - in case of JavaMail errors
InterruptedException - when a thread is interrupted
protected Message[] searchForNewMessages(Folder folder)
throws 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
MessagingException - in case of JavaMail errors
protected void fetchMessages(Folder folder,
Message[] messages)
throws MessagingException
fetches every FetchProfile.Item.
folder - the folder to fetch messages frommessages - the messages to fetch
MessagingException - in case of JavMail errors
protected void deleteMessages(Folder folder,
Message[] messages)
throws MessagingException
setDeleteMessages(boolean) is
true.
folder - the folder to delete messages frommessages - the messages to delete
MessagingException - in case of JavaMail errors
|
Spring Web Services Framework | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||