Spring Web Services Framework

org.springframework.ws.transport.mail.monitor
Class Pop3PollingMonitoringStrategy

java.lang.Object
  extended by org.springframework.ws.transport.mail.monitor.AbstractMonitoringStrategy
      extended by org.springframework.ws.transport.mail.monitor.PollingMonitoringStrategy
          extended by org.springframework.ws.transport.mail.monitor.Pop3PollingMonitoringStrategy
All Implemented Interfaces:
MonitoringStrategy

public class Pop3PollingMonitoringStrategy
extends PollingMonitoringStrategy

Implementation of the MonitoringStrategy interface that uses a simple polling mechanism suitable for POP3 servers. Since POP3 does not have a native mechanism to determine which messages are "new", this implementation simply retrieves all messages in the Folder, and delete them afterwards. All messages in the POP3 mailbox are therefore, by definition, new.

Setting the deleteMessages property is therefore ignored: messages are always deleted.

Since:
1.5.0
Author:
Arjen Poutsma

Field Summary
 
Fields inherited from class org.springframework.ws.transport.mail.monitor.PollingMonitoringStrategy
DEFAULT_POLLING_FREQUENCY
 
Fields inherited from class org.springframework.ws.transport.mail.monitor.AbstractMonitoringStrategy
logger
 
Constructor Summary
Pop3PollingMonitoringStrategy()
           
 
Method Summary
protected  void afterSleep(Folder folder)
          Re-opens the folder, if it closed.
protected  void deleteMessages(Folder folder, Message[] messages)
          Deletes the given messages from the given folder, and closes it to expunge deleted messages.
protected  Message[] searchForNewMessages(Folder folder)
          Simply returns Folder.getMessages().
 void setDeleteMessages(boolean deleteMessages)
          Sets whether messages should be marked as DELETED after they have been read.
 
Methods inherited from class org.springframework.ws.transport.mail.monitor.PollingMonitoringStrategy
setPollingInterval, waitForNewMessages
 
Methods inherited from class org.springframework.ws.transport.mail.monitor.AbstractMonitoringStrategy
fetchMessages, getFolderOpenMode, monitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pop3PollingMonitoringStrategy

public Pop3PollingMonitoringStrategy()
Method Detail

setDeleteMessages

public void setDeleteMessages(boolean deleteMessages)
Description copied from class: AbstractMonitoringStrategy
Sets whether messages should be marked as DELETED after they have been read. Default is true.

Overrides:
setDeleteMessages in class AbstractMonitoringStrategy

afterSleep

protected void afterSleep(Folder folder)
                   throws MessagingException
Re-opens the folder, if it closed.

Overrides:
afterSleep in class PollingMonitoringStrategy
Parameters:
folder - the folder to check for new messages
Throws:
MessagingException - in case of JavaMail errors

searchForNewMessages

protected Message[] searchForNewMessages(Folder folder)
                                  throws MessagingException
Simply returns Folder.getMessages().

Overrides:
searchForNewMessages in class AbstractMonitoringStrategy
Parameters:
folder - the folder to retrieve new messages from
Returns:
the new messages
Throws:
MessagingException - in case of JavaMail errors

deleteMessages

protected void deleteMessages(Folder folder,
                              Message[] messages)
                       throws MessagingException
Deletes the given messages from the given folder, and closes it to expunge deleted messages.

Overrides:
deleteMessages in class AbstractMonitoringStrategy
Parameters:
folder - the folder to delete messages from
messages - the messages to delete
Throws:
MessagingException - in case of JavaMail errors

Spring Web Services Framework

Copyright © 2005-2013 The Spring Web Services Framework. All Rights Reserved.