org.peabody.emailprocessor
Class JavaMailMessageSource

java.lang.Object
  extended by org.peabody.emailprocessor.AbstractMessageSource
      extended by org.peabody.emailprocessor.JavaMailMessageSource
All Implemented Interfaces:
MessageSource

public class JavaMailMessageSource
extends AbstractMessageSource

This class provides a message source from a server using JavaMail. Supported protocols are those supported by JavaMail (i.e. "smtp" and "imap").


Field Summary
protected  int currentMessage
          Index of the current message
protected  java.lang.String folder
           
protected  java.lang.String hostName
           
protected  javax.mail.Folder mailFolder
          The mailFolder
protected  int messageCount
          How many messages are in the store
protected  java.lang.String password
           
protected  java.lang.String protocol
           
protected  javax.mail.Session session
          The mail session
protected  javax.mail.Store store
          The POP3 store
protected  java.lang.String userName
           
 
Constructor Summary
JavaMailMessageSource()
          Creates a new JavaMailMessageSource, if you use this constructor you will need to initialize the parameters using the individual setters.
JavaMailMessageSource(java.lang.String aProtocol, java.lang.String aHostName, java.lang.String aUserName, java.lang.String aPassword, java.lang.String aFolder)
          Creates a new JavaMailMessageSource.
 
Method Summary
 void close()
           
 java.lang.String getFolder()
           
 java.lang.String getHostName()
           
 javax.mail.Message getNextMessage()
          Retrieves the next message
 java.lang.String getPassword()
           
 java.lang.String getProtocol()
           
 java.lang.String getUserName()
           
 void init()
           
 void setFolder(java.lang.String folder)
           
 void setHostName(java.lang.String hostName)
           
 void setPassword(java.lang.String password)
           
 void setProtocol(java.lang.String protocol)
           
 void setUserName(java.lang.String userName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected javax.mail.Session session
The mail session


store

protected javax.mail.Store store
The POP3 store


mailFolder

protected javax.mail.Folder mailFolder
The mailFolder


messageCount

protected int messageCount
How many messages are in the store


currentMessage

protected int currentMessage
Index of the current message


protocol

protected java.lang.String protocol

hostName

protected java.lang.String hostName

userName

protected java.lang.String userName

password

protected java.lang.String password

folder

protected java.lang.String folder
Constructor Detail

JavaMailMessageSource

public JavaMailMessageSource(java.lang.String aProtocol,
                             java.lang.String aHostName,
                             java.lang.String aUserName,
                             java.lang.String aPassword,
                             java.lang.String aFolder)
                      throws javax.mail.MessagingException
Creates a new JavaMailMessageSource. The connection is established as soon as the object is init()ed, messages are downloaded as #getNextMessage is called. This method calls init()

Throws:
javax.mail.MessagingException

JavaMailMessageSource

public JavaMailMessageSource()
Creates a new JavaMailMessageSource, if you use this constructor you will need to initialize the parameters using the individual setters.

Method Detail

init

public void init()

getNextMessage

public javax.mail.Message getNextMessage()
                                  throws javax.mail.MessagingException
Retrieves the next message

Throws:
javax.mail.MessagingException

close

public void close()
           throws javax.mail.MessagingException
Specified by:
close in interface MessageSource
Overrides:
close in class AbstractMessageSource
Throws:
javax.mail.MessagingException

getProtocol

public java.lang.String getProtocol()

setProtocol

public void setProtocol(java.lang.String protocol)

getHostName

public java.lang.String getHostName()

setHostName

public void setHostName(java.lang.String hostName)

getUserName

public java.lang.String getUserName()

setUserName

public void setUserName(java.lang.String userName)

getPassword

public java.lang.String getPassword()

setPassword

public void setPassword(java.lang.String password)

getFolder

public java.lang.String getFolder()

setFolder

public void setFolder(java.lang.String folder)