org.cid.distribution.plugins.mail
Class POP3Handler

java.lang.Object
  extended by org.cid.distribution.base.MessageHandlerBase
      extended by org.cid.distribution.plugins.mail.POP3Handler
All Implemented Interfaces:
DistributionContextAware, MessageEnumeration, MessageHandler

public class POP3Handler
extends MessageHandlerBase
implements MessageEnumeration

The POP3Handler stablishes a connection to a POP3 server and retrieves the messages stored, which are then forwarded to other nodes.

The POP3Handler does this for each message it receives. The usual way of using it is at the beginning of a node chain, so the POP3Handler is 'activated' with an initial empty message that starts the distribution process.

Version:
$Revision:111 $

Constructor Summary
POP3Handler()
          Class constructor.
 
Method Summary
static void addRules(org.apache.commons.digester.Digester d, java.lang.String patternPrefix)
          Configures additional rules for the commons-digester library.
 void destroy()
          Closes the connection to the POP3 server.
 java.lang.String getHost()
          Gets the mail server hostname or IP address.
 int getMessageCount()
          Returns the number of messages processed by this InputChannel.
 java.lang.String getPassword()
          Gets the mail server account password.
 java.lang.Short getPort()
          Gets the mail server port.
 java.lang.String getProperty()
           
 java.lang.String getProtocol()
           
 java.lang.String getUsername()
          Gets the mail server account username.
 boolean hasMoreMessages()
          Tests if this enumeration contains more elements.
 DistributionMessage nextMessage()
          Retrieves the next message.
 MessageEnumeration process(DistributionMessage message)
          Gets all messages from the configured mail server and copies them, breaking the link from the message to the mail session.
 void setHost(java.lang.String host)
          Sets the mail server hostname or IP address.
 void setPassword(java.lang.String password)
          Sets the mail server account password.
 void setPort(java.lang.String port)
          Sets the mail server port.
 void setProperty(java.lang.String property)
           
 void setProtocol(java.lang.String protocol)
          Sets the protocol to use when connecting to the server.
 void setUsername(java.lang.String username)
          Sets the mail server account username.
 
Methods inherited from class org.cid.distribution.base.MessageHandlerBase
getId, init, setDistributionContext, setId
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

POP3Handler

public POP3Handler()
Class constructor.

Method Detail

process

public MessageEnumeration process(DistributionMessage message)
                           throws DistributionConfigurationException,
                                  DistributionProcessingException
Gets all messages from the configured mail server and copies them, breaking the link from the message to the mail session.

Specified by:
process in interface MessageHandler
Returns:
A enumeration of retrieved messages.
Throws:
DistributionConfigurationException
DistributionProcessingException

destroy

public void destroy()
             throws DistributionProcessingException,
                    DistributionConfigurationException
Closes the connection to the POP3 server. For most providers, this is required so the messages read are deleted from the remote mailbox.

Specified by:
destroy in interface MessageHandler
Overrides:
destroy in class MessageHandlerBase
Throws:
DistributionProcessingException
DistributionConfigurationException
See Also:
MessageHandlerBase.destroy()

hasMoreMessages

public boolean hasMoreMessages()
Tests if this enumeration contains more elements.

Specified by:
hasMoreMessages in interface MessageEnumeration
Returns:

nextMessage

public DistributionMessage nextMessage()
                                throws DistributionProcessingException
Retrieves the next message.

Specified by:
nextMessage in interface MessageEnumeration
Returns:
Throws:
DistributionProcessingException

addRules

public static void addRules(org.apache.commons.digester.Digester d,
                            java.lang.String patternPrefix)
Configures additional rules for the commons-digester library.


getHost

public java.lang.String getHost()
Gets the mail server hostname or IP address.

Returns:
The mail server hostname or IP address.

setHost

public void setHost(java.lang.String host)
Sets the mail server hostname or IP address.

Parameters:
host - The mail server hostname or IP address.

getPassword

public java.lang.String getPassword()
Gets the mail server account password.

Returns:
The mail server account password.

setPassword

public void setPassword(java.lang.String password)
Sets the mail server account password.

Parameters:
password - The mail server account password.

getPort

public java.lang.Short getPort()
Gets the mail server port.

Returns:
The mail server port.

setPort

public void setPort(java.lang.String port)
Sets the mail server port.

Parameters:
port - The mail server port.

getUsername

public java.lang.String getUsername()
Gets the mail server account username.

Returns:
The mail server account username.

setUsername

public void setUsername(java.lang.String username)
Sets the mail server account username.

Parameters:
username - The mail server account username.

getProtocol

public java.lang.String getProtocol()
Returns:
Returns the protocol.

setProtocol

public void setProtocol(java.lang.String protocol)

Sets the protocol to use when connecting to the server.

Valid values are pop3 and pop3s.

Parameters:
protocol - The protocol to set.

getMessageCount

public int getMessageCount()
Returns the number of messages processed by this InputChannel.

Returns:
The number of messages processed by this InputChannel.

getProperty

public java.lang.String getProperty()
Returns:
Returns the property.

setProperty

public void setProperty(java.lang.String property)
Parameters:
property - The property to set.


Copyright © 2006 null. All Rights Reserved.