Package com.attivio.client.exposedapi
Class AttivioMBean<T>
- java.lang.Object
-
- com.attivio.client.exposedapi.AttivioMBean<T>
-
- Type Parameters:
T- The type of the object represented by this MBean
- All Implemented Interfaces:
javax.management.DynamicMBean
public class AttivioMBean<T> extends java.lang.Object implements javax.management.DynamicMBeanA DynamicMBean for exposing attributes and methods via annotations.
The Attivio MBean class works on methods with three kinds of annotations:ReadableandJmxReadable.- Method must satisfy validity as defined by
JMXUtils.isValidReadable(Method)
- Method must satisfy validity as defined by
WritableandJmxWritable.- Method must satisfy validity as defined by
JMXUtils.isValidWritable(Method)
- Method must satisfy validity as defined by
InvokableandJmxInvokable.- Method must satisfy validity as defined by
JMXUtils.isValidWritable(Method)
- Method must satisfy validity as defined by
- In cases annotation and methods are not consistent,
IllegalArgumentExceptionwill be thrown when instantiating this class.
The fastest way to validate if a Class is valid for its annotation is through calling with the class object.
newAttivioMBeanInfo(Class)- See Also:
AttivioMBeanInfo
-
-
Field Summary
Fields Modifier and Type Field Description protected static AttivioLoggerlogThe logger
-
Constructor Summary
Constructors Constructor Description AttivioMBean(T beanObj)Constructs a new AttivioMBean for an object.AttivioMBean(T beanObj, java.lang.Class<?> beanClass)Constructs a new AttivioMBean for an object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ObjectgetAttribute(java.lang.String attribute)Gets the value for an attribute on this MBean.javax.management.AttributeListgetAttributes(java.lang.String[] attributes)Gets the value for multiple attributes at once.javax.management.MBeanInfogetMBeanInfo()Gets the MBeanInfo for this MBean.java.lang.Objectinvoke(java.lang.String actionName, java.lang.Object[] params, java.lang.String[] signature)Invokes a method on this MBean.voidsetAttribute(javax.management.Attribute attribute)Sets the value for an attribute on this MBean.javax.management.AttributeListsetAttributes(javax.management.AttributeList attributes)Sets the value for multiple attributes at once.
-
-
-
Field Detail
-
log
protected static final AttivioLogger log
The logger
-
-
Constructor Detail
-
AttivioMBean
public AttivioMBean(T beanObj)
Constructs a new AttivioMBean for an object.- Parameters:
beanObj- the object to create an MBean for.
-
AttivioMBean
public AttivioMBean(T beanObj, java.lang.Class<?> beanClass)
Constructs a new AttivioMBean for an object.- Parameters:
beanObj- the object to create an MBean for.- Throws:
java.lang.IllegalArgumentException- when annotated method signature does not meet expectation
-
-
Method Detail
-
getMBeanInfo
public javax.management.MBeanInfo getMBeanInfo()
Gets the MBeanInfo for this MBean.- Specified by:
getMBeanInfoin interfacejavax.management.DynamicMBean- Returns:
- the MBeanInfo for this MBean
-
getAttribute
public java.lang.Object getAttribute(java.lang.String attribute) throws javax.management.AttributeNotFoundException, javax.management.MBeanException, javax.management.ReflectionExceptionGets the value for an attribute on this MBean.- Specified by:
getAttributein interfacejavax.management.DynamicMBean- Parameters:
attribute- the name of the attribute to return- Returns:
- the value for the named attribute
- Throws:
javax.management.AttributeNotFoundExceptionjavax.management.MBeanExceptionjavax.management.ReflectionException
-
setAttribute
public void setAttribute(javax.management.Attribute attribute) throws javax.management.AttributeNotFoundException, javax.management.InvalidAttributeValueException, javax.management.MBeanException, javax.management.ReflectionExceptionSets the value for an attribute on this MBean.- Specified by:
setAttributein interfacejavax.management.DynamicMBean- Parameters:
attribute- the attribute name and value to set- Throws:
javax.management.AttributeNotFoundExceptionjavax.management.InvalidAttributeValueExceptionjavax.management.MBeanExceptionjavax.management.ReflectionException
-
invoke
public java.lang.Object invoke(java.lang.String actionName, java.lang.Object[] params, java.lang.String[] signature) throws javax.management.MBeanException, javax.management.ReflectionExceptionInvokes a method on this MBean.- Specified by:
invokein interfacejavax.management.DynamicMBean- Parameters:
actionName- the name of the method to invokeparams- the parameters to pase to the invoked method.signature- the signature for the invoked method- Returns:
- the value returned by the invoked method
- Throws:
javax.management.MBeanExceptionjavax.management.ReflectionException
-
getAttributes
public final javax.management.AttributeList getAttributes(java.lang.String[] attributes)
Gets the value for multiple attributes at once.- Specified by:
getAttributesin interfacejavax.management.DynamicMBean- Parameters:
attributes- The names of the attributes to fetch values for- Returns:
- an AttributeList listing all fetched attributes.
-
setAttributes
public final javax.management.AttributeList setAttributes(javax.management.AttributeList attributes)
Sets the value for multiple attributes at once.- Specified by:
setAttributesin interfacejavax.management.DynamicMBean- Parameters:
attributes- an AttributeList listing the attribute names and values to set.- Returns:
- an AttributeList listing the new value for each attribute.
-
-