public static ModelMBean createModelMBean ( Object o ) { try { ModelMBean mbean = new RequiredModelMBean ( ) ; JmxManaged annotation = o . getClass ( ) . getAnnotation ( JmxManaged . class ) ; String description = annotation == null ? "" : annotation . description ( ) ; ModelMBeanInfo info = new ModelMBeanInfoSupport ( o . getClass ( ) . getName ( ) , description , extractAttributeInfo ( o ) , new ModelMBeanConstructorInfo [ 0 ] , extractOperationInfo ( o ) , new ModelMBeanNotificationInfo [ 0 ] ) ; mbean . setModelMBeanInfo ( info ) ; mbean . setManagedResource ( o , "ObjectReference" ) ; return mbean ; } catch ( MBeanException e ) { throw new VoldemortException ( e ) ; } catch ( InvalidTargetObjectTypeException e ) { throw new VoldemortException ( e ) ; } catch ( InstanceNotFoundException e ) { throw new VoldemortException ( e ) ; } }
Create a model mbean from an object using the description given in the Jmx annotation if present . Only operations are supported so far no attributes constructors or notifications