Package org.opends.server.config
Class JMXMBean
- java.lang.Object
-
- org.opends.server.config.JMXMBean
-
- All Implemented Interfaces:
DynamicMBean,DirectoryServerMBean
@PublicAPI(stability=VOLATILE, mayInstantiate=true, mayInvoke=true) public final class JMXMBean extends Object implements DynamicMBean, DirectoryServerMBean
This class defines a JMX MBean that can be registered with the Directory Server to provide monitoring and statistical information, provide read and/or read-write access to the monitoring, and provide notifications and alerts if a significant event or severe/fatal error occurs.
-
-
Constructor Summary
Constructors Constructor Description JMXMBean(Dn monitorEntryDN, ServerContext serverContext)Creates a new dynamic JMX MBean for use with the Directory Server.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAlertGenerator(AlertGenerator generator)Adds the provided alert generator to the set of alert generators associated with this JMX MBean.voidaddMonitorProvider(MonitorProvider component)Adds the given monitor provider to the set of components associated with this JMX MBean.AttributegetAttribute(String attributeName)Obtain the value of a specific attribute of the Dynamic MBean.AttributeListgetAttributes(String[] attributes)Get the values of several attributes of the Dynamic MBean.static StringgetJmxName(Dn monitorEntryDN)Creates a JMX object name string based on a DN.MBeanInfogetMBeanInfo()Provides the exposed attributes and actions of the Dynamic MBean using an MBeanInfo object.ObjectNamegetObjectName()Retrieves the JMX object name for this JMX MBean.Objectinvoke(String actionName, Object[] params, String[] signature)Allows an action to be invoked on the Dynamic MBean.voidremoveAlertGenerator(AlertGenerator generator)Removes the provided alert generator from the set of alert generators associated with this JMX MBean.voidremoveMonitorProvider(MonitorProvider component)Removes the given monitor provider from the set of components associated with this JMX MBean.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.
-
-
-
Constructor Detail
-
JMXMBean
public JMXMBean(Dn monitorEntryDN, ServerContext serverContext) throws MalformedObjectNameException
Creates a new dynamic JMX MBean for use with the Directory Server.- Parameters:
monitorEntryDN- The DN of the monitoring entry with which this MBean is associated.serverContext- The server context- Throws:
MalformedObjectNameException- if we cannot build a valid JMX object name
-
-
Method Detail
-
getJmxName
public static String getJmxName(Dn monitorEntryDN)
Creates a JMX object name string based on a DN.- Parameters:
monitorEntryDN- The DN of the monitoring entry with which this ObjectName is associated.- Returns:
- The string representation of the JMX Object Name associated with the input DN.
-
getObjectName
public ObjectName getObjectName()
Retrieves the JMX object name for this JMX MBean.- Specified by:
getObjectNamein interfaceDirectoryServerMBean- Returns:
- The JMX object name for this JMX MBean.
-
addAlertGenerator
public void addAlertGenerator(AlertGenerator generator)
Adds the provided alert generator to the set of alert generators associated with this JMX MBean.- Parameters:
generator- The alert generator to add to the set of alert generators for this JMX MBean.
-
removeAlertGenerator
public void removeAlertGenerator(AlertGenerator generator)
Removes the provided alert generator from the set of alert generators associated with this JMX MBean.- Parameters:
generator- The alert generator to remove from the set of alert generators for this JMX MBean.
-
addMonitorProvider
public void addMonitorProvider(MonitorProvider component)
Adds the given monitor provider to the set of components associated with this JMX MBean.- Parameters:
component- The component to add to the set of monitor providers for this JMX MBean.
-
removeMonitorProvider
public void removeMonitorProvider(MonitorProvider component)
Removes the given monitor provider from the set of components associated with this JMX MBean.- Parameters:
component- The component to remove from the set of monitor providers for this JMX MBean.
-
getAttribute
public Attribute getAttribute(String attributeName) throws AttributeNotFoundException
Obtain the value of a specific attribute of the Dynamic MBean.- Specified by:
getAttributein interfaceDynamicMBean- Parameters:
attributeName- The name of the attribute to be retrieved.- Returns:
- The requested attribute.
- Throws:
AttributeNotFoundException- If the specified attribute is not associated with this MBean.
-
setAttribute
public void setAttribute(Attribute attribute) throws InvalidAttributeValueException
Set the value of a specific attribute of the Dynamic MBean. In this case, it will always throwInvalidAttributeValueExceptionbecause setting attribute values over JMX is currently not allowed.- Specified by:
setAttributein interfaceDynamicMBean- Parameters:
attribute- The identification of the attribute to be set and the value it is to be set to.- Throws:
InvalidAttributeValueException- If the provided value is not acceptable for 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. In this case, the list will always be empty because we do not support setting attribute values over JMX.
-
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.
-
-