org.figure8.join.services.notification.mail
Class MailNotifier

java.lang.Object
  extended by org.figure8.join.services.notification.mail.MailNotifier
All Implemented Interfaces:
Configurable, Notifier, SubscribersNotifier

public class MailNotifier
extends java.lang.Object
implements SubscribersNotifier

This is an implementation of SubscribersNotifier using the mail as notification media.

Version:
$Revision: 1.1 $
Author:
Laurent Broudoux

Field Summary
static java.lang.String FROM_PARAM
          Name of configurable parameter denoting the From address to use in sent messages.
protected static ParameterDefinition fromParam
          ParameterDefinition representation of parameter denoting the From address to use.
static java.lang.String HOST_PARAM
          Name of configurable parameter denoting the SMTP host to use.
protected static ParameterDefinition hostParam
          ParameterDefinition representation of parameter denoting the SMTP host to use.
protected static java.util.List parameters
          List of ParameterDefinitions supported by this adapter
static java.lang.String PASSWORD_PARAM
          Name of configurable parameter denoting the password for connecting to SMTP host.
protected static ParameterDefinition pwdParam
          ParameterDefinition representation of parameter denoting the password of SMTP host.
static java.lang.String USER_PARAM
          Name of configurable parameter denoting the username for connecting to SMTP host.
protected static ParameterDefinition userParam
          ParameterDefintion representation of paramter denoting the username of SMTP host.
 
Constructor Summary
MailNotifier()
          Creates a new instance of MailNotifier.
 
Method Summary
 java.lang.String[] extractRecipients(RemoteSubscriber[] subscribers)
          Extract mail addresses for subscribers to provide recipients.
 java.lang.String getFrom()
           
 java.lang.String getHost()
           
 ParameterDefinition[] getParameterDefinitions()
          Get this object parameters definitions as an array
 java.util.List getParameterDefinitionsAsList()
          Get this object parameters definitions as a list
 java.lang.String getPassword()
           
 java.lang.String getUsername()
           
 void notify(RemoteSubscriber[] subscribers, java.lang.String title, java.lang.String content)
          Notify subscribers of mailing list defined into Join application
 void notify(java.lang.String[] recipients, java.lang.String title, java.lang.String content)
          Notifier are able to notify recipients and use a title and a content within their notification messages.
 void setFrom(java.lang.String from)
           
 void setHost(java.lang.String host)
           
 void setParameter(ParameterDefinition parameter, java.lang.String parameterValue)
          Set the value of a parameter using its definitions
 void setParameter(java.lang.String parameterName, java.lang.String parameterValue)
          Set the value of a parameter using its nama
 void setParameters(java.util.Properties parameters)
          Convenient methods for setting all attributes values using a single method.
 void setPassword(java.lang.String password)
           
 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

HOST_PARAM

public static final java.lang.String HOST_PARAM
Name of configurable parameter denoting the SMTP host to use.

See Also:
Constant Field Values

USER_PARAM

public static final java.lang.String USER_PARAM
Name of configurable parameter denoting the username for connecting to SMTP host.

See Also:
Constant Field Values

PASSWORD_PARAM

public static final java.lang.String PASSWORD_PARAM
Name of configurable parameter denoting the password for connecting to SMTP host.

See Also:
Constant Field Values

FROM_PARAM

public static final java.lang.String FROM_PARAM
Name of configurable parameter denoting the From address to use in sent messages.

See Also:
Constant Field Values

parameters

protected static java.util.List parameters
List of ParameterDefinitions supported by this adapter


hostParam

protected static final ParameterDefinition hostParam
ParameterDefinition representation of parameter denoting the SMTP host to use.


userParam

protected static final ParameterDefinition userParam
ParameterDefintion representation of paramter denoting the username of SMTP host.


pwdParam

protected static final ParameterDefinition pwdParam
ParameterDefinition representation of parameter denoting the password of SMTP host.


fromParam

protected static final ParameterDefinition fromParam
ParameterDefinition representation of parameter denoting the From address to use.

Constructor Detail

MailNotifier

public MailNotifier()
Creates a new instance of MailNotifier.

Method Detail

getHost

public java.lang.String getHost()
Returns:
The SMTP host to use for sending messages.

setHost

public void setHost(java.lang.String host)
Parameters:
host - The SMTP host to use for sending messages.

getUsername

public java.lang.String getUsername()
Returns:
The username for connecting to SMTP host.

setUsername

public void setUsername(java.lang.String username)
Parameters:
username - The username for connecting to SMTP host.

getPassword

public java.lang.String getPassword()
Returns:
The password for connecting to SMTP host.

setPassword

public void setPassword(java.lang.String password)
Parameters:
password - The password for connecting to SMTP host.

getFrom

public java.lang.String getFrom()
Returns:
The From address that appears on sent messages.

setFrom

public void setFrom(java.lang.String from)
Parameters:
from - The From address that appears on sent messages.

extractRecipients

public java.lang.String[] extractRecipients(RemoteSubscriber[] subscribers)
Extract mail addresses for subscribers to provide recipients.

Specified by:
extractRecipients in interface SubscribersNotifier
Parameters:
subscribers - The subscribers to get recipients for
Returns:
The list of corresponding recipients.

notify

public void notify(RemoteSubscriber[] subscribers,
                   java.lang.String title,
                   java.lang.String content)
            throws NotificationException
Notify subscribers of mailing list defined into Join application

Specified by:
notify in interface SubscribersNotifier
Parameters:
subscribers - The subscriber of mailing list to notify
title - The title of notification message to send
content - The content of notification message to send
Throws:
NotificationException - if an exception occurs during the notification operation (usually they are network related exceptions)

notify

public void notify(java.lang.String[] recipients,
                   java.lang.String title,
                   java.lang.String content)
            throws NotificationException
Notifier are able to notify recipients and use a title and a content within their notification messages. The definition of a recipients is voluntary abstract letting implementations or sub-interfaces defining what they consider as valid recipients (ex: mail addresses, IM identifies, etc...)

Specified by:
notify in interface Notifier
Parameters:
recipients - An array of recipients to noitify. Recipient is described with a String
title - The title of notification message to send
content - The content of notification message to send
Throws:
NotificationException - if an exception occurs during the notification operation (usually they are network related exceptions)

getParameterDefinitionsAsList

public java.util.List getParameterDefinitionsAsList()
Get this object parameters definitions as a list

Specified by:
getParameterDefinitionsAsList in interface Configurable
Returns:
A list of ParameterDefinition objects

getParameterDefinitions

public ParameterDefinition[] getParameterDefinitions()
Get this object parameters definitions as an array

Specified by:
getParameterDefinitions in interface Configurable
Returns:
An array of ParameterDefinition objects

setParameter

public void setParameter(java.lang.String parameterName,
                         java.lang.String parameterValue)
                  throws InvalidParameterException
Set the value of a parameter using its nama

Specified by:
setParameter in interface Configurable
Parameters:
parameterName - The name of parameter so set value for
parameterValue - The value of the paramater
Throws:
InvalidParameterException - if this parameter is not supported by this object

setParameter

public void setParameter(ParameterDefinition parameter,
                         java.lang.String parameterValue)
                  throws InvalidParameterException
Set the value of a parameter using its definitions

Specified by:
setParameter in interface Configurable
Parameters:
parameter - The definitino of the paramater to set
parameterValue - The value of the parameter
Throws:
InvalidParameterException - if this parameter is not supported by this object

setParameters

public void setParameters(java.util.Properties parameters)
                   throws InvalidParameterException
Convenient methods for setting all attributes values using a single method.

Specified by:
setParameters in interface Configurable
Parameters:
parameters - Properties where keys are parameter names
Throws:
InvalidParameterException - if one of these parameters is not supported by this object


Copyright © 2005-2008 Join. All Rights Reserved.