Package org.opends.server.extensions
Class JMXAlertHandler
java.lang.Object
javax.management.NotificationBroadcasterSupport
org.opends.server.extensions.JMXAlertHandler
- All Implemented Interfaces:
DynamicMBean
,NotificationBroadcaster
,NotificationEmitter
,ConfigurationChangeListener<JmxAlertHandlerCfg>
,AlertHandler<JmxAlertHandlerCfg>
,DirectoryServerMBean
public final class JMXAlertHandler
extends NotificationBroadcasterSupport
implements AlertHandler<JmxAlertHandlerCfg>, ConfigurationChangeListener<JmxAlertHandlerCfg>, DynamicMBean, DirectoryServerMBean
This class provides an implementation of a Directory Server alert handler that will send alerts using JMX
notifications.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionapplyConfigurationChange
(JmxAlertHandlerCfg configuration) Applies the configuration changes to this change listener.void
Performs any necessary cleanup that may be necessary when this alert handler is finalized.Retrieves the current configuration for this alert handler.getAttribute
(String attribute) getAttributes
(String[] attributes) Retrieves information about the types of JMX notifications that may be generated.Retrieves the JMX object name for this JMX alert handler.void
initializeAlertHandler
(ServerContext serverContext, JmxAlertHandlerCfg configuration) Initializes this alert handler based on the information in the provided configuration entry.boolean
isConfigurationAcceptable
(JmxAlertHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons) Indicates whether the provided configuration is acceptable for this alert handler.boolean
isConfigurationChangeAcceptable
(JmxAlertHandlerCfg 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.void
setAttribute
(Attribute attribute) setAttributes
(AttributeList attributes) Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
-
Constructor Details
-
JMXAlertHandler
public JMXAlertHandler()
-
-
Method Details
-
initializeAlertHandler
public void initializeAlertHandler(ServerContext serverContext, JmxAlertHandlerCfg configuration) throws InitializationException Description copied from interface:AlertHandler
Initializes this alert handler based on the information in the provided configuration entry.- Specified by:
initializeAlertHandler
in interfaceAlertHandler<JmxAlertHandlerCfg>
- Parameters:
serverContext
- The server contextconfiguration
- The configuration to use to initialize this alert handler.- Throws:
InitializationException
- If a problem occurs during initialization that is not related to the server configuration.
-
getAlertHandlerConfiguration
Description copied from interface:AlertHandler
Retrieves the current configuration for this alert handler.- Specified by:
getAlertHandlerConfiguration
in interfaceAlertHandler<JmxAlertHandlerCfg>
- 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<JmxAlertHandlerCfg>
-
getObjectName
Retrieves the JMX object name for this JMX alert handler.- Specified by:
getObjectName
in interfaceDirectoryServerMBean
- Returns:
- The JMX object name for this JMX alert handler.
-
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<JmxAlertHandlerCfg>
- 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.
-
getNotificationInfo
Retrieves information about the types of JMX notifications that may be generated.- Specified by:
getNotificationInfo
in interfaceNotificationBroadcaster
- Overrides:
getNotificationInfo
in classNotificationBroadcasterSupport
- Returns:
- Information about the types of JMX notifications that may be generated.
-
getAttribute
- Specified by:
getAttribute
in interfaceDynamicMBean
- Throws:
AttributeNotFoundException
-
setAttribute
- Specified by:
setAttribute
in interfaceDynamicMBean
- Throws:
AttributeNotFoundException
-
getAttributes
- Specified by:
getAttributes
in interfaceDynamicMBean
-
setAttributes
- Specified by:
setAttributes
in interfaceDynamicMBean
-
invoke
- Specified by:
invoke
in interfaceDynamicMBean
- Throws:
MBeanException
-
getMBeanInfo
- Specified by:
getMBeanInfo
in interfaceDynamicMBean
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(JmxAlertHandlerCfg 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<JmxAlertHandlerCfg>
- 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(JmxAlertHandlerCfg 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<JmxAlertHandlerCfg>
- 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
Description copied from interface:ConfigurationChangeListener
Applies the configuration changes to this change listener.- Specified by:
applyConfigurationChange
in interfaceConfigurationChangeListener<JmxAlertHandlerCfg>
- Parameters:
configuration
- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-