Spring Integration

org.springframework.integration.mail
Class ImapMailReceiver

java.lang.Object
  extended by org.springframework.integration.mail.AbstractMailReceiver
      extended by org.springframework.integration.mail.ImapMailReceiver
All Implemented Interfaces:
DisposableBean, 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
initialized, logger
 
Constructor Summary
ImapMailReceiver()
           
ImapMailReceiver(String url)
           
 
Method Summary
protected  javax.mail.Message[] searchForNewMessages()
          Retrieves new messages from this receiver's folder.
 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, isShouldMarkMessagesAsRead, openFolder, receive, setJavaMailAuthenticator, setJavaMailProperties, setMaxFetchSize, setProtocol, setSession, setShouldDeleteMessages, setShouldMarkMessagesAsRead, shouldDeleteMessages, toString
 
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(String url)
Method Detail

waitForNewMessages

public void waitForNewMessages()
                        throws javax.mail.MessagingException,
                               InterruptedException
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
InterruptedException

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

Spring Integration

Copyright © 2010. All Rights Reserved.