Package org.opends.server.extensions
Class SMTPAccountStatusNotificationHandler
java.lang.Object
org.opends.server.api.AccountStatusNotificationHandler<SmtpAccountStatusNotificationHandlerCfg>
org.opends.server.extensions.SMTPAccountStatusNotificationHandler
- All Implemented Interfaces:
ConfigurationChangeListener<SmtpAccountStatusNotificationHandlerCfg>
public final 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:
- %%notification-type%% -- Will be replaced with the name of the account status notification type for the notification.
- %%notification-message%% -- Will be replaced with the message for the account status notification.
- %%notification-user-dn%% -- Will be replaced with the string representation of the DN for the user that is the target of the account status notification.
- %%notification-user-attr:attrname%% -- Will be replaced with the value of the attribute specified by attrname from the user's entry. If the specified attribute has multiple values, then the first value encountered will be used. If the specified attribute does not have any values, then it will be replaced with an empty string.
- %%notification-property:propname%% -- Will be replaced with the value of the specified notification property from the account status notification. If the specified property has multiple values, then the first value encountered will be used. If the specified property does not have any values, then it will be replaced with an empty string.
-
Constructor Summary
ConstructorDescriptionCreates a new, uninitialized instance of this account status notification handler. -
Method Summary
Modifier and TypeMethodDescriptionapplyConfigurationChange
(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, ServerContext serverContext) Initializes this account status notification handler based on the information in the provided configuration entry.boolean
isConfigurationAcceptable
(SmtpAccountStatusNotificationHandlerCfg configuration, ServerContext serverContext, List<LocalizableMessage> unacceptableReasons) Indicates whether the provided configuration is acceptable for this account status notification handler.boolean
isConfigurationChangeAcceptable
(SmtpAccountStatusNotificationHandlerCfg configuration, List<LocalizableMessage> 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
-
Constructor Details
-
SMTPAccountStatusNotificationHandler
public SMTPAccountStatusNotificationHandler()Creates a new, uninitialized instance of this account status notification handler.
-
-
Method Details
-
initializeStatusNotificationHandler
public void initializeStatusNotificationHandler(SmtpAccountStatusNotificationHandlerCfg configuration, ServerContext serverContext) throws ConfigException Description copied from class:AccountStatusNotificationHandler
Initializes this account status notification handler based on the information in the provided configuration entry.- Specified by:
initializeStatusNotificationHandler
in classAccountStatusNotificationHandler<SmtpAccountStatusNotificationHandlerCfg>
- Parameters:
configuration
- The configuration entry that contains the information to use to initialize this account status notification handler.serverContext
- The server context- Throws:
ConfigException
- If the provided entry does not contain a valid configuration for this account status notification handler.
-
handleStatusNotification
Description copied from class:AccountStatusNotificationHandler
Performs any processing that may be necessary in conjunction with the provided account status notification.- Specified by:
handleStatusNotification
in classAccountStatusNotificationHandler<SmtpAccountStatusNotificationHandlerCfg>
- Parameters:
notification
- The account status notification to be processed.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(SmtpAccountStatusNotificationHandlerCfg 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<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, orfalse
if it is not.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(SmtpAccountStatusNotificationHandlerCfg configuration, ServerContext serverContext, List<LocalizableMessage> unacceptableReasons) Description copied from class:AccountStatusNotificationHandler
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.- Overrides:
isConfigurationAcceptable
in classAccountStatusNotificationHandler<SmtpAccountStatusNotificationHandlerCfg>
- Parameters:
configuration
- The account status notification handler configuration for which to make the determination.serverContext
- The server contextunacceptableReasons
- 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, orfalse
if not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(SmtpAccountStatusNotificationHandlerCfg configuration) Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<SmtpAccountStatusNotificationHandlerCfg>
- Parameters:
configuration
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-