Package org.opends.server.extensions
Class SMTPAlertHandler
- java.lang.Object
-
- org.opends.server.extensions.SMTPAlertHandler
-
- All Implemented Interfaces:
ConfigurationChangeListener<SmtpAlertHandlerCfg>
,AlertHandler<SmtpAlertHandlerCfg>
public class SMTPAlertHandler extends 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
Constructors Constructor Description SMTPAlertHandler()
Creates a new instance of this SMTP alert handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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(ServerContext serverContext, SmtpAlertHandlerCfg configuration)
Initializes this alert handler based on the information in the provided configuration entry.boolean
isConfigurationAcceptable(SmtpAlertHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons)
Indicates whether the provided configuration is acceptable for this alert handler.boolean
isConfigurationChangeAcceptable(SmtpAlertHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons)
Indicates whether the proposed change to the configuration is acceptable to this change listener.void
sendAlertNotification(AlertGenerator generator, String alertType, LocalizableMessage alertMessage)
Sends an alert notification based on the provided information.
-
-
-
Method Detail
-
initializeAlertHandler
public void initializeAlertHandler(ServerContext serverContext, SmtpAlertHandlerCfg configuration) throws ConfigException
Description copied from interface:AlertHandler
Initializes this alert handler based on the information in the provided configuration entry.- Specified by:
initializeAlertHandler
in interfaceAlertHandler<SmtpAlertHandlerCfg>
- Parameters:
serverContext
- The server contextconfiguration
- 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.
-
getAlertHandlerConfiguration
public AlertHandlerCfg getAlertHandlerConfiguration()
Description copied from interface:AlertHandler
Retrieves the current configuration for this alert handler.- Specified by:
getAlertHandlerConfiguration
in interfaceAlertHandler<SmtpAlertHandlerCfg>
- Returns:
- The current configuration for this alert handler.
-
finalizeAlertHandler
public void finalizeAlertHandler()
Description copied from interface:AlertHandler
Performs any necessary cleanup that may be necessary when this alert handler is finalized.- Specified by:
finalizeAlertHandler
in interfaceAlertHandler<SmtpAlertHandlerCfg>
-
sendAlertNotification
public void sendAlertNotification(AlertGenerator generator, String alertType, LocalizableMessage alertMessage)
Description copied from interface:AlertHandler
Sends an alert notification based on the provided information.- Specified by:
sendAlertNotification
in interfaceAlertHandler<SmtpAlertHandlerCfg>
- Parameters:
generator
- The alert generator that created the alert.alertType
- The alert type name for this alert.alertMessage
- A message (possiblynull
) that can provide more information about this alert.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(SmtpAlertHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:AlertHandler
Indicates whether the provided configuration is acceptable for this alert handler.- Specified by:
isConfigurationAcceptable
in interfaceAlertHandler<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, orfalse
if it is not.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(SmtpAlertHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListener
Indicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptable
in interfaceConfigurationChangeListener<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, orfalse
if it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(SmtpAlertHandlerCfg configuration)
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<SmtpAlertHandlerCfg>
- Parameters:
configuration
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
-