For this to work, InstanceClassFactory also needs a:
public MetaValue getValue(BeanInfo beanInfo, ManagedProperty property, Serializable object);
method to be able to populate the ManagedProperty values from the metadata. Since the mbean instance does not exist this needs to be take from ServiceMetaData object.
I understand why you've done this.
I think this is ok for now.
But for MBeans I thought we would do something more generic
with the ManagedObject coming from a mapping of the MBean description (MBeanInfo/descriptors)
To make this useful, the MBean description would be generated using
annotations like the ManagedObject stuff (in fact the annotations that
will appear in JMX2.0/Java7 + our extensions).
This is related to this:
I thought about just adding more annotation support to the service mbean metadata, but that is more error prone for a deployer writer who is programatically creating the mbean metadata. It would not be a big deal for those still using the legacy service.xml.
In terms of the InstanceClassFactory being part of the spi, maybe this should be pushed to the AbstractManagedObjectFactory as an implementation detail for this release.