protected RequiredModelMBean doBind(MBeanServer server, ObjectName name, Object instance, Class<?> clazz) throws JMException, InvalidTargetObjectTypeException { RequiredModelMBean mbean = new RequiredModelMBean(); mbean.setManagedResource(instance, "ObjectReference"); mbean.setModelMBeanInfo(mbeanInfoFactory.getModelMBeanInfo(clazz)); server.registerMBean(mbean, name); return mbean; }
public void register(Object obj, ObjectName name, boolean forceRegistration) throws JMException { try { registerMBeanWithServer(obj, name, forceRegistration); } catch (NotCompliantMBeanException e) { // If this is not a "normal" MBean, then try to deploy it using JMX // annotations ModelMBeanInfo mbi = assembler.getMBeanInfo(obj, name.toString()); RequiredModelMBean mbean = (RequiredModelMBean) mbeanServer.instantiate(RequiredModelMBean.class.getName()); mbean.setModelMBeanInfo(mbi); try { mbean.setManagedResource(obj, "ObjectReference"); } catch (InvalidTargetObjectTypeException itotex) { throw new JMException(itotex.getMessage()); } registerMBeanWithServer(mbean, name, forceRegistration); } }
private void register(Object obj, ObjectName name, ModelMBeanInfo mbi, boolean forceRegistration) throws JMException { RequiredModelMBean rtMBean = (RequiredModelMBean)mbs.instantiate("javax.management.modelmbean.RequiredModelMBean"); rtMBean.setModelMBeanInfo(mbi); try { rtMBean.setManagedResource(obj, "ObjectReference"); } catch (InvalidTargetObjectTypeException itotex) { throw new JMException(itotex.getMessage()); } registerMBeanWithServer(rtMBean, persist(name), forceRegistration); }
"javax.management.modelmbean.RequiredModelMBean"); rtMBean.setModelMBeanInfo(mbi);
RequiredModelMBean rtMBean = (RequiredModelMBean)mbs.instantiate("javax.management.modelmbean.RequiredModelMBean"); rtMBean.setModelMBeanInfo(mbi); try { rtMBean.setManagedResource(managedEndpoint, "ObjectReference");