Class 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.DynamicMBean
    A DynamicMBean for exposing attributes and methods via annotations.
    The Attivio MBean class works on methods with three kinds of annotations:
    The fastest way to validate if a Class is valid for its annotation is through calling with the class object.
    new AttivioMBeanInfo(Class)
    See Also:
    AttivioMBeanInfo
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static AttivioLogger log
      The 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.Object getAttribute​(java.lang.String attribute)
      Gets the value for an attribute on this MBean.
      javax.management.AttributeList getAttributes​(java.lang.String[] attributes)
      Gets the value for multiple attributes at once.
      javax.management.MBeanInfo getMBeanInfo()
      Gets the MBeanInfo for this MBean.
      java.lang.Object invoke​(java.lang.String actionName, java.lang.Object[] params, java.lang.String[] signature)
      Invokes a method on this MBean.
      void setAttribute​(javax.management.Attribute attribute)
      Sets the value for an attribute on this MBean.
      javax.management.AttributeList setAttributes​(javax.management.AttributeList attributes)
      Sets the value for multiple attributes at once.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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:
        getMBeanInfo in interface javax.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.ReflectionException
        Gets the value for an attribute on this MBean.
        Specified by:
        getAttribute in interface javax.management.DynamicMBean
        Parameters:
        attribute - the name of the attribute to return
        Returns:
        the value for the named attribute
        Throws:
        javax.management.AttributeNotFoundException
        javax.management.MBeanException
        javax.management.ReflectionException
      • setAttribute

        public void setAttribute​(javax.management.Attribute attribute)
                          throws javax.management.AttributeNotFoundException,
                                 javax.management.InvalidAttributeValueException,
                                 javax.management.MBeanException,
                                 javax.management.ReflectionException
        Sets the value for an attribute on this MBean.
        Specified by:
        setAttribute in interface javax.management.DynamicMBean
        Parameters:
        attribute - the attribute name and value to set
        Throws:
        javax.management.AttributeNotFoundException
        javax.management.InvalidAttributeValueException
        javax.management.MBeanException
        javax.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.ReflectionException
        Invokes a method on this MBean.
        Specified by:
        invoke in interface javax.management.DynamicMBean
        Parameters:
        actionName - the name of the method to invoke
        params - 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.MBeanException
        javax.management.ReflectionException
      • getAttributes

        public final javax.management.AttributeList getAttributes​(java.lang.String[] attributes)
        Gets the value for multiple attributes at once.
        Specified by:
        getAttributes in interface javax.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:
        setAttributes in interface javax.management.DynamicMBean
        Parameters:
        attributes - an AttributeList listing the attribute names and values to set.
        Returns:
        an AttributeList listing the new value for each attribute.