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 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
Constructors Constructor Description JMXAlertHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConfigChangeResultapplyConfigurationChange(JmxAlertHandlerCfg configuration)Applies the configuration changes to this change listener.voidfinalizeAlertHandler()Performs any necessary cleanup that may be necessary when this alert handler is finalized.AlertHandlerCfggetAlertHandlerConfiguration()Retrieves the current configuration for this alert handler.AttributegetAttribute(String attribute)Obtain the value of a specific attribute of the Dynamic MBean.AttributeListgetAttributes(String[] attributes)Get the values of several attributes of the Dynamic MBean.MBeanInfogetMBeanInfo()Provides the exposed attributes and actions of the Dynamic MBean using an MBeanInfo object.MBeanNotificationInfo[]getNotificationInfo()Retrieves information about the types of JMX notifications that may be generated.ObjectNamegetObjectName()Retrieves the JMX object name for this JMX alert handler.voidinitializeAlertHandler(ServerContext serverContext, JmxAlertHandlerCfg configuration)Initializes this alert handler based on the information in the provided configuration entry.Objectinvoke(String actionName, Object[] params, String[] signature)Allows an action to be invoked on the Dynamic MBean.booleanisConfigurationAcceptable(JmxAlertHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons)Indicates whether the provided configuration is acceptable for this alert handler.booleanisConfigurationChangeAcceptable(JmxAlertHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons)Indicates whether the proposed change to the configuration is acceptable to this change listener.voidsendAlertNotification(AlertGenerator generator, String alertType, LocalizableMessage alertMessage)Sends an alert notification based on the provided information.voidsetAttribute(Attribute attribute)Set the value of a specific attribute of the Dynamic MBean.AttributeListsetAttributes(AttributeList attributes)Sets the values of several attributes of the Dynamic MBean.-
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
-
-
-
-
Method Detail
-
initializeAlertHandler
public void initializeAlertHandler(ServerContext serverContext, JmxAlertHandlerCfg configuration) throws InitializationException
Description copied from interface:AlertHandlerInitializes this alert handler based on the information in the provided configuration entry.- Specified by:
initializeAlertHandlerin 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
public AlertHandlerCfg getAlertHandlerConfiguration()
Description copied from interface:AlertHandlerRetrieves the current configuration for this alert handler.- Specified by:
getAlertHandlerConfigurationin interfaceAlertHandler<JmxAlertHandlerCfg>- Returns:
- The current configuration for this alert handler.
-
finalizeAlertHandler
public void finalizeAlertHandler()
Description copied from interface:AlertHandlerPerforms any necessary cleanup that may be necessary when this alert handler is finalized.- Specified by:
finalizeAlertHandlerin interfaceAlertHandler<JmxAlertHandlerCfg>
-
getObjectName
public ObjectName getObjectName()
Retrieves the JMX object name for this JMX alert handler.- Specified by:
getObjectNamein 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:AlertHandlerSends an alert notification based on the provided information.- Specified by:
sendAlertNotificationin 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
public MBeanNotificationInfo[] getNotificationInfo()
Retrieves information about the types of JMX notifications that may be generated.- Specified by:
getNotificationInfoin interfaceNotificationBroadcaster- Overrides:
getNotificationInfoin classNotificationBroadcasterSupport- Returns:
- Information about the types of JMX notifications that may be generated.
-
getAttribute
public Attribute getAttribute(String attribute) throws AttributeNotFoundException
Obtain the value of a specific attribute of the Dynamic MBean.- Specified by:
getAttributein interfaceDynamicMBean- Parameters:
attribute- The name of the attribute to be retrieved.- Returns:
- The requested MBean attribute.
- Throws:
AttributeNotFoundException- If the specified attribute is not associated with this MBean.
-
setAttribute
public void setAttribute(Attribute attribute) throws AttributeNotFoundException
Set the value of a specific attribute of the Dynamic MBean.- Specified by:
setAttributein interfaceDynamicMBean- Parameters:
attribute- The identification of the attribute to be set and the value it is to be set to.- Throws:
AttributeNotFoundException- If the specified attribute is not associated with this MBean.
-
getAttributes
public AttributeList getAttributes(String[] attributes)
Get the values of several attributes of the Dynamic MBean.- Specified by:
getAttributesin interfaceDynamicMBean- Parameters:
attributes- A list of the attributes to be retrieved.- Returns:
- The list of attributes retrieved.
-
setAttributes
public AttributeList setAttributes(AttributeList attributes)
Sets the values of several attributes of the Dynamic MBean.- Specified by:
setAttributesin interfaceDynamicMBean- Parameters:
attributes- A list of attributes: The identification of the attributes to be set and the values they are to be set to.- Returns:
- The list of attributes that were set with their new values.
-
invoke
public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException
Allows an action to be invoked on the Dynamic MBean.- Specified by:
invokein interfaceDynamicMBean- Parameters:
actionName- The name of the action to be invoked.params- An array containing the parameters to be set when the action is invoked.signature- An array containing the signature of the action. The class objects will be loaded through the same class loader as the one used for loading the MBean on which action is invoked.- Returns:
- The object returned by the action, which represents the result of invoking the action on the MBean specified.
- Throws:
MBeanException- If a problem is encountered while invoking the method.
-
getMBeanInfo
public MBeanInfo getMBeanInfo()
Provides the exposed attributes and actions of the Dynamic MBean using an MBeanInfo object.- Specified by:
getMBeanInfoin interfaceDynamicMBean- Returns:
- An instance of
MBeanInfoallowing all attributes and actions exposed by this Dynamic MBean to be retrieved.
-
isConfigurationAcceptable
public boolean isConfigurationAcceptable(JmxAlertHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:AlertHandlerIndicates whether the provided configuration is acceptable for this alert handler.- Specified by:
isConfigurationAcceptablein 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:
trueif the provided configuration is acceptable, orfalseif it is not.
-
isConfigurationChangeAcceptable
public boolean isConfigurationChangeAcceptable(JmxAlertHandlerCfg configuration, List<LocalizableMessage> unacceptableReasons)
Description copied from interface:ConfigurationChangeListenerIndicates whether the proposed change to the configuration is acceptable to this change listener.- Specified by:
isConfigurationChangeAcceptablein 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
trueif the proposed change is acceptable, orfalseif it is not.
-
applyConfigurationChange
public ConfigChangeResult applyConfigurationChange(JmxAlertHandlerCfg configuration)
Description copied from interface:ConfigurationChangeListenerApplies the configuration changes to this change listener.- Specified by:
applyConfigurationChangein interfaceConfigurationChangeListener<JmxAlertHandlerCfg>- Parameters:
configuration- The new configuration containing the changes.- Returns:
- Returns information about the result of changing the configuration.
-
-