org.opends.server.extensions
Class SMTPAccountStatusNotificationHandler

java.lang.Object
  extended by org.opends.server.api.AccountStatusNotificationHandler<SMTPAccountStatusNotificationHandlerCfg>
      extended by org.opends.server.extensions.SMTPAccountStatusNotificationHandler
All Implemented Interfaces:
ConfigurationChangeListener<SMTPAccountStatusNotificationHandlerCfg>

public class SMTPAccountStatusNotificationHandler
extends AccountStatusNotificationHandler<SMTPAccountStatusNotificationHandlerCfg>
implements ConfigurationChangeListener<SMTPAccountStatusNotificationHandlerCfg>

This class provides an implementation of an account status notification handler that can send e-mail messages via SMTP to end users and/or administrators whenever an account status notification occurs. The e-mail messages will be generated from template files, which contain the information to use to create the message body. The template files may contain plain text, in addition to the following tokens:


Constructor Summary
SMTPAccountStatusNotificationHandler()
          Creates a new, uninitialized instance of this account status notification handler.
 
Method Summary
 ConfigChangeResult applyConfigurationChange(SMTPAccountStatusNotificationHandlerCfg configuration)
          Applies the configuration changes to this change listener.
 void handleStatusNotification(AccountStatusNotification notification)
          Performs any processing that may be necessary in conjunction with the provided account status notification.
 void initializeStatusNotificationHandler(SMTPAccountStatusNotificationHandlerCfg configuration)
          Initializes this account status notification handler based on the information in the provided configuration entry.
 boolean isConfigurationAcceptable(AccountStatusNotificationHandlerCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the provided configuration is acceptable for this account status notification handler.
 boolean isConfigurationChangeAcceptable(SMTPAccountStatusNotificationHandlerCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed change to the configuration is acceptable to this change listener.
 
Methods inherited from class org.opends.server.api.AccountStatusNotificationHandler
finalizeStatusNotificationHandler
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMTPAccountStatusNotificationHandler

public SMTPAccountStatusNotificationHandler()
Creates a new, uninitialized instance of this account status notification handler.

Method Detail

initializeStatusNotificationHandler

public void initializeStatusNotificationHandler(SMTPAccountStatusNotificationHandlerCfg configuration)
                                         throws ConfigException,
                                                InitializationException
Initializes this account status notification handler based on the information in the provided configuration entry.

Specified by:
initializeStatusNotificationHandler in class AccountStatusNotificationHandler<SMTPAccountStatusNotificationHandlerCfg>
Parameters:
configuration - The configuration entry that contains the information to use to initialize this account status notification handler.
Throws:
ConfigException - If the provided entry does not contain a valid configuration for this account status notification handler.
InitializationException - If a problem occurs during initialization that is not related to the server configuration.

isConfigurationAcceptable

public boolean isConfigurationAcceptable(AccountStatusNotificationHandlerCfg configuration,
                                         java.util.List<Message> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this account status notification handler. It should be possible to call this method on an uninitialized account status notification handler instance in order to determine whether the handler would be able to use the provided configuration.

Note that implementations which use a subclass of the provided configuration class will likely need to cast the configuration to the appropriate subclass type.

Overrides:
isConfigurationAcceptable in class AccountStatusNotificationHandler<SMTPAccountStatusNotificationHandlerCfg>
Parameters:
configuration - The account status notification handler configuration for which to make the determination.
unacceptableReasons - A list that may be used to hold the reasons that the provided configuration is not acceptable.
Returns:
true if the provided configuration is acceptable for this account status notification handler, or false if not.

handleStatusNotification

public void handleStatusNotification(AccountStatusNotification notification)
Performs any processing that may be necessary in conjunction with the provided account status notification.

Specified by:
handleStatusNotification in class AccountStatusNotificationHandler<SMTPAccountStatusNotificationHandlerCfg>
Parameters:
notification - The account status notification to be processed.

isConfigurationChangeAcceptable

public boolean isConfigurationChangeAcceptable(SMTPAccountStatusNotificationHandlerCfg configuration,
                                               java.util.List<Message> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.

Specified by:
isConfigurationChangeAcceptable in interface ConfigurationChangeListener<SMTPAccountStatusNotificationHandlerCfg>
Parameters:
configuration - The new configuration containing the changes.
unacceptableReasons - A list that can be used to hold messages about why the provided configuration is not acceptable.
Returns:
Returns true if the proposed change is acceptable, or false if it is not.

applyConfigurationChange

public ConfigChangeResult applyConfigurationChange(SMTPAccountStatusNotificationHandlerCfg configuration)
Applies the configuration changes to this change listener.

Specified by:
applyConfigurationChange in interface ConfigurationChangeListener<SMTPAccountStatusNotificationHandlerCfg>
Parameters:
configuration - The new configuration containing the changes.
Returns:
Returns information about the result of changing the configuration.