Class MBeanInfoData

java.lang.Object
org.jolokia.service.jmx.handler.list.MBeanInfoData

public class MBeanInfoData extends Object
Tree of MBean meta data. This map is a container for one or more MBeanInfo meta data which can be obtained via a list request. The full structure in its JSON representation looks like below. The amount of data included can be fine tuned in two ways:
  • With a maxDepth parameter given at construction time, the size of the map can be restricted (from top down)
  • A given path selects only a partial information from the tree
Both limiting factors are taken care of when adding the information so that this map doesn't get unnecessarily to large.

 {
   <domain> : {
     <prop list> : {
       "attr" : {
         <attr name> : {
           "type" : <attribute type>,
           "desc" : <textual description of attribute>,
           "rw"   : true/false
         },
         ...
       },
       "op" : {
         <operation name> : {
           "args" : [
             {
               "type" : <argument type>,
               "name" : <argument name>,
               "desc" : <textual description of argument>
             },
             ...
           ],
           "ret"  : <return type>,
           "desc" : <textual description of operation>
         },
         ...
       },
       "notif" : {
         <notification type> : {
           "name" : <name>,
           "desc" : <desc>,
           "types" : [ <type1>, <type2>, ... ]
         },
         ...
       }
     },
     ...
   },
   ...
 }
 
Since:
13.09.11
Author:
roland
  • Constructor Details

    • MBeanInfoData

      public MBeanInfoData(int pMaxDepth, Deque<String> pPathStack, boolean pUseCanonicalName, boolean pListKeys, boolean pListCache, String pProvider)
      Constructor taking a max depth. The max depth specifies how deep the info tree should be build up. The tree will be truncated if it gets larger than this value. A path (in form of a stack) can be given, in which only a sub information (sub-tree or leaf value) is stored
      Parameters:
      pMaxDepth - max depth
      pPathStack - the stack for restricting the information to add. The given stack will be cloned and is left untouched.
      pUseCanonicalName - whether to use canonical name in listings
      pListKeys -
      pListCache -
  • Method Details

    • handleFirstOrSecondLevel

      public boolean handleFirstOrSecondLevel(ObjectName pName)
      The first two levels of this map (tree) consist of the MBean's domain name and name properties, which are independent of an MBean's meta data. If the max depth given at construction time is less or equals than 2 (and no inner path into the map is given), then a client of this map does not need to query the MBeanServer for MBeanInfo meta data.

      This method checks this condition and returns true if this is the case. As side effect it will update this map with the name part extracted from the given object name
      Parameters:
      pName - the objectname used for the first two levels
      Returns:
      true if the object name has been added.
    • addMBeanInfo

      public void addMBeanInfo(MBeanServerConnection pConn, ObjectInstance pInstance, Set<DataUpdater> customUpdaters, Set<CacheKeyProvider> cacheKeyProviders) throws InstanceNotFoundException, IntrospectionException, ReflectionException, IOException
      Add information about an MBean as obtained from an MBeanInfo descriptor. The information added can be restricted by a given path (which has already been prepared as a stack). Also, a max depth as given in the constructor restricts the size of the map from the top.
      Parameters:
      pConn - MBeanServerConnection to get MBeanInfo from (or from cache if possible)
      pInstance - the object instance of the MBean
      customUpdaters - additional set of discovered updaters to enhance the constructed MBeanInfo (JSON data)
      cacheKeyProviders - set of services that help to construct the cache of MBeanInfo
      Throws:
      InstanceNotFoundException
      IntrospectionException
      ReflectionException
      IOException
    • handleException

      public void handleException(ObjectName pName, IOException pExp) throws IOException
      Add an exception which occurred during extraction of an MBeanInfo for a certain ObjectName to this map.
      Parameters:
      pName - MBean name for which the error occurred
      pExp - exception occurred
      Throws:
      IOException - if this method decides to rethrow the execption
    • handleException

      public void handleException(ObjectName pName, IllegalStateException pExp)
      Add an exception which occurred during extraction of an MBeanInfo for a certain ObjectName to this map.
      Parameters:
      pName - MBean name for which the error occurred
      pExp - exception occurred
      Throws:
      IllegalStateException - if this method decides to rethrow the exception
    • handleException

      public void handleException(ObjectName pName, InstanceNotFoundException pExp) throws InstanceNotFoundException
      Add an exception which occurred during extraction of an MBeanInfo for a certain ObjectName to this map.
      Parameters:
      pName - MBean name for which the error occurred
      pExp - exception occurred
      Throws:
      IllegalStateException - if this method decides to rethrow the exception
      InstanceNotFoundException
    • applyPath

      public Object applyPath()
      Extract either a sub tree or a leaf value. If a path is used, then adding MBeanInfos has added them as if no path were given (i.e. in it original place in the tree) but leaves out other information not included by the path. This method then moves up the part pointed to by the path to the top of the tree hierarchy. It also takes into account the maximum depth of the tree and truncates below
      Returns:
      either a Map for a subtree or the leaf value as an object