I am writing my own persistence manager for my model mbeans. Obviously, you need some sort of unique name to associate with each set of attributes for each MBean. My intent was to use the MBean name, since it is there and already unique. So, in my PersistenceManager.load(ModelMBeanInvoker, MBeanInfo) method, I need a way to get at the MBean name.
Based on the sun docs, it looked like the way to get it was from ModelMBeanInfo.getMBeanDescriptor().getFieldValue("name")
However, in my method, when I make the calls:
ModelMBeanInfo modelMBeanInfo = (ModelMBeanInfo)mbeanInfo; Descriptor modelMBeanDescriptor = modelMBeanInfo.getMBeanDescriptor(); String mbeanName = (String)modelMBeanDescriptor.getFieldValue(ModelMBeanConstants.NAME);
Yes, the name field of the mbean descriptor is the class name. There is no access to the JMX ObjectName under which the mbean is registered available through the ModelMBeanInfo. We could look to add this via a custom descriptor field.