org.cid.distribution.plugins.mail
Class SMTPHandler

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

public class SMTPHandler
extends MessageHandlerBase

A JavaMail based SMTP output channel implementation.


Constructor Summary
SMTPHandler()
          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.
 java.lang.String getCloseAfterMessages()
           
 java.lang.String getHost()
          Returns the SMTP host (evaluated).
 DistributionMail getMail()
           
 int getMessagesSent()
           
 int getPartialSent()
           
 java.lang.String getPassword()
          Returns the password used to open the SMTP connection (evaluated).
 java.lang.String getUsername()
          Returns the username used to open the SMTP connection (evaluated).
 MessageEnumeration process(DistributionMessage message)
          Sends a message through this channel
 void setCloseAfterMessages(java.lang.String closeAfterMessages)
          This makes this SMTPHandler close the connection after a given number of messages sent to the server.
 void setHost(java.lang.String host)
          Sets the SMTP host to use by this OutputChannel.
 void setMail(java.lang.String mail)
           
 void setPassword(java.lang.String password)
          Sets the password used to open the SMTP connection.
 void setUsername(java.lang.String username)
          Sets the username used to open the SMTP connection.
 
Methods inherited from class org.cid.distribution.base.MessageHandlerBase
destroy, getId, init, setDistributionContext, setId
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMTPHandler

public SMTPHandler()
Class constructor.

Method Detail

process

public MessageEnumeration process(DistributionMessage message)
                           throws DistributionProcessingException,
                                  DistributionConfigurationException
Sends a message through this channel

Parameters:
message - The Message to send
Returns:
The result of the handle processing, usually indicating whether the processing of this message has succeeded or failed.
Throws:
DistributionProcessingException
DistributionConfigurationException

addRules

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


getCloseAfterMessages

public java.lang.String getCloseAfterMessages()
Returns:
Returns the closeAfterMessages (evaluated).

setCloseAfterMessages

public void setCloseAfterMessages(java.lang.String closeAfterMessages)

This makes this SMTPHandler close the connection after a given number of messages sent to the server. The default si 0, which means never close the channel.

This option may be useful to avoid problems which some SMTP servers, which disconnect the client after sending a certain number of messages sent. Note that the server can disconnect a client for many reasons, see @see

Parameters:
closeAfterMessages - The closeAfterMessages to set.
See Also:

getHost

public java.lang.String getHost()
Returns the SMTP host (evaluated).

Returns:
The SMTP host (evaluated).

setHost

public void setHost(java.lang.String host)
Sets the SMTP host to use by this OutputChannel.

Parameters:
host - The SMTP host to use by this OutputChannel.

getPassword

public java.lang.String getPassword()
Returns the password used to open the SMTP connection (evaluated).

Returns:
The password used to open the SMTP connection (evaluated).

setPassword

public void setPassword(java.lang.String password)
Sets the password used to open the SMTP connection.

Parameters:
password - The password used to open the SMTP connection.

getUsername

public java.lang.String getUsername()
Returns the username used to open the SMTP connection (evaluated).

Returns:
The username used to open the SMTP connection (evaluated).

setUsername

public void setUsername(java.lang.String username)
Sets the username used to open the SMTP connection.

Parameters:
username - The username used to open the SMTP connection.

getPartialSent

public int getPartialSent()
Returns:
Returns the partialSent.

getMessagesSent

public int getMessagesSent()
Returns:
Returns the messagesSent.

getMail

public DistributionMail getMail()
Returns:
Returns the property.

setMail

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


Copyright © 2006 null. All Rights Reserved.