|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.integration.adapter.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 | |
---|---|
private boolean |
deleteMessages
|
protected org.apache.commons.logging.Log |
logger
Logger available to subclasses. |
private int |
maxMessagesPerReceive
|
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[] |
receive(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. |
void |
setMaxMessagePerDownload(int maxMessagesPerReceive)
|
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
private boolean deleteMessages
private int maxMessagesPerReceive
Constructor Detail |
---|
public AbstractMonitoringStrategy()
Method Detail |
---|
public void setDeleteMessages(boolean deleteMessages)
DELETED
after they have been
read. Default is true
.
public int getFolderOpenMode()
MonitoringStrategy
Folder.READ_ONLY
or Folder.READ_WRITE
.
getFolderOpenMode
in interface MonitoringStrategy
public void setMaxMessagePerDownload(int maxMessagesPerReceive)
public final javax.mail.Message[] receive(javax.mail.Folder folder) throws javax.mail.MessagingException, java.lang.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
.
receive
in interface MonitoringStrategy
folder
- the folder to monitor
javax.mail.MessagingException
- in case of JavaMail errors
java.lang.InterruptedException
- when a thread is interruptedprotected 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 errorsprotected 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 errorsprotected 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 |