org.opends.server.extensions
Class SMTPAlertHandler

java.lang.Object
  extended by org.opends.server.extensions.SMTPAlertHandler
All Implemented Interfaces:
ConfigurationChangeListener<SMTPAlertHandlerCfg>, AlertHandler<SMTPAlertHandlerCfg>

public class SMTPAlertHandler
extends java.lang.Object
implements AlertHandler<SMTPAlertHandlerCfg>, ConfigurationChangeListener<SMTPAlertHandlerCfg>

This class implements a Directory Server alert handler that may be used to send administrative alerts via SMTP.


Constructor Summary
SMTPAlertHandler()
          Creates a new instance of this SMTP alert handler.
 
Method Summary
 ConfigChangeResult applyConfigurationChange(SMTPAlertHandlerCfg configuration)
          Applies the configuration changes to this change listener.
 void finalizeAlertHandler()
          Performs any necessary cleanup that may be necessary when this alert handler is finalized.
 AlertHandlerCfg getAlertHandlerConfiguration()
          Retrieves the current configuration for this alert handler.
 void initializeAlertHandler(SMTPAlertHandlerCfg configuration)
          Initializes this alert handler based on the information in the provided configuration entry.
 boolean isConfigurationAcceptable(AlertHandlerCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the provided configuration is acceptable for this alert handler.
 boolean isConfigurationChangeAcceptable(SMTPAlertHandlerCfg configuration, java.util.List<Message> unacceptableReasons)
          Indicates whether the proposed change to the configuration is acceptable to this change listener.
 void sendAlertNotification(AlertGenerator generator, java.lang.String alertType, Message alertMessage)
          Sends an alert notification based on the provided information.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SMTPAlertHandler

public SMTPAlertHandler()
Creates a new instance of this SMTP alert handler.

Method Detail

initializeAlertHandler

public void initializeAlertHandler(SMTPAlertHandlerCfg configuration)
                            throws ConfigException,
                                   InitializationException
Initializes this alert handler based on the information in the provided configuration entry.

Specified by:
initializeAlertHandler in interface AlertHandler<SMTPAlertHandlerCfg>
Parameters:
configuration - The configuration to use to initialize this alert handler.
Throws:
ConfigException - If the provided entry does not contain a valid configuration for this alert handler.
InitializationException - If a problem occurs during initialization that is not related to the server configuration.

getAlertHandlerConfiguration

public AlertHandlerCfg getAlertHandlerConfiguration()
Retrieves the current configuration for this alert handler.

Specified by:
getAlertHandlerConfiguration in interface AlertHandler<SMTPAlertHandlerCfg>
Returns:
The current configuration for this alert handler.

isConfigurationAcceptable

public boolean isConfigurationAcceptable(AlertHandlerCfg configuration,
                                         java.util.List<Message> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this alert handler.

Specified by:
isConfigurationAcceptable in interface AlertHandler<SMTPAlertHandlerCfg>
Parameters:
configuration - The configuration for which to make tje determination.
unacceptableReasons - A list to which human-readable reasons may be added to explain why the configuration is not acceptable.
Returns:
true if the provided configuration is acceptable, or false if it is not.

finalizeAlertHandler

public void finalizeAlertHandler()
Performs any necessary cleanup that may be necessary when this alert handler is finalized.

Specified by:
finalizeAlertHandler in interface AlertHandler<SMTPAlertHandlerCfg>

sendAlertNotification

public void sendAlertNotification(AlertGenerator generator,
                                  java.lang.String alertType,
                                  Message alertMessage)
Sends an alert notification based on the provided information.

Specified by:
sendAlertNotification in interface AlertHandler<SMTPAlertHandlerCfg>
Parameters:
generator - The alert generator that created the alert.
alertType - The alert type name for this alert.
alertMessage - A message (possibly null) that can provide more information about this alert.

isConfigurationChangeAcceptable

public boolean isConfigurationChangeAcceptable(SMTPAlertHandlerCfg 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<SMTPAlertHandlerCfg>
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(SMTPAlertHandlerCfg configuration)
Applies the configuration changes to this change listener.

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