Spring Integration

org.springframework.integration.mail
Class ImapMailReceiver

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.mail.AbstractMailReceiver
          extended by org.springframework.integration.mail.ImapMailReceiver
All Implemented Interfaces:
org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, NamedComponent, MailReceiver

public class ImapMailReceiver
extends AbstractMailReceiver

A MailReceiver implementation for receiving mail messages from a mail server that supports the IMAP protocol. In addition to the pollable AbstractMailReceiver.receive() method, the waitForNewMessages() method provides the option of blocking until new messages are available prior to calling AbstractMailReceiver.receive(). That option is only available if the server supports the idle command.

Author:
Arjen Poutsma, Mark Fisher, Oleg Zhurakousky

Field Summary
 
Fields inherited from class org.springframework.integration.mail.AbstractMailReceiver
folderOpenMode, initialized, logger, SI_USER_FLAG
 
Constructor Summary
ImapMailReceiver()
           
ImapMailReceiver(java.lang.String url)
           
 
Method Summary
 java.lang.Boolean isShouldMarkMessagesAsRead()
          Check if messages should be marked as read.
protected  javax.mail.Message[] searchForNewMessages()
          Retrieves new messages from this receiver's folder.
protected  void setAdditionalFlags(javax.mail.Message message)
          Optional method allowing you to set additional flags.
 void setShouldMarkMessagesAsRead(java.lang.Boolean shouldMarkMessagesAsRead)
          Specify if messages should be marked as read.
 void waitForNewMessages()
          This method is unique to the IMAP receiver and only works if IMAP IDLE is supported (see RFC 2177 for more detail).
 
Methods inherited from class org.springframework.integration.mail.AbstractMailReceiver
deleteMessages, destroy, fetchMessages, getFolder, onInit, openFolder, receive, setJavaMailAuthenticator, setJavaMailProperties, setMaxFetchSize, setProtocol, setSelectorExpression, setSession, setShouldDeleteMessages, shouldDeleteMessages, toString
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getComponentType, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImapMailReceiver

public ImapMailReceiver()

ImapMailReceiver

public ImapMailReceiver(java.lang.String url)
Method Detail

isShouldMarkMessagesAsRead

public java.lang.Boolean isShouldMarkMessagesAsRead()
Check if messages should be marked as read.


setShouldMarkMessagesAsRead

public void setShouldMarkMessagesAsRead(java.lang.Boolean shouldMarkMessagesAsRead)
Specify if messages should be marked as read.


waitForNewMessages

public void waitForNewMessages()
                        throws javax.mail.MessagingException
This method is unique to the IMAP receiver and only works if IMAP IDLE is supported (see RFC 2177 for more detail).

Throws:
javax.mail.MessagingException

searchForNewMessages

protected javax.mail.Message[] searchForNewMessages()
                                             throws javax.mail.MessagingException
Retrieves new messages from this receiver's folder. This implementation creates a 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.

Specified by:
searchForNewMessages in class AbstractMailReceiver
Returns:
the new messages
Throws:
javax.mail.MessagingException - in case of JavaMail errors

setAdditionalFlags

protected void setAdditionalFlags(javax.mail.Message message)
                           throws javax.mail.MessagingException
Description copied from class: AbstractMailReceiver
Optional method allowing you to set additional flags. Currently only implemented in IMapMailReceiver.

Overrides:
setAdditionalFlags in class AbstractMailReceiver
Throws:
javax.mail.MessagingException

Spring Integration