List of usage examples for org.springframework.jmx.export.assembler MetadataMBeanInfoAssembler MetadataMBeanInfoAssembler
public MetadataMBeanInfoAssembler(JmxAttributeSource attributeSource)
From source file:com.brienwheeler.lib.jmx.MBeanRegistrationSupport.java
public static void registerMBean(Object mbean) { try {/*from w w w . j a v a 2 s .c o m*/ ObjectNamingStrategy namingStrategy = new IdentityNamingStrategy(); ObjectName objectName = namingStrategy.getObjectName(mbean, null); MBeanRegistrationSupport registrar = new MBeanRegistrationSupport(); registrar.setServer(JmxUtils.locateMBeanServer()); // if item qualifies as MBean, export it directly if (JmxUtils.isMBean(mbean.getClass())) { registrar.doRegister(mbean, objectName); return; } // assemble MBean info (from annotations by default) ModelMBean modelMBean = new RequiredModelMBean(); modelMBean.setManagedResource(mbean, MR_TYPE_OBJECT_REFERENCE); MBeanInfoAssembler mBeanInfoAssembler = new MetadataMBeanInfoAssembler( new AnnotationJmxAttributeSource()); modelMBean.setModelMBeanInfo(mBeanInfoAssembler.getMBeanInfo(mbean, objectName.getCanonicalName())); registrar.doRegister(modelMBean, objectName); } catch (Exception e) { throw new JmxRegisterException("error registering MBean", e); } }
From source file:admin.jmx.BatchMBeanExporter.java
public BatchMBeanExporter() { super();/*from ww w . j a va 2 s .co m*/ setAutodetect(false); setNamingStrategy(new MetadataNamingStrategy(attributeSource)); setAssembler(new MetadataMBeanInfoAssembler(attributeSource)); }
From source file:org.trpr.platform.batch.impl.spring.jmx.BatchMetricsExporter.java
/** * Constructor for this class//from w w w . j a v a2s. c o m */ public BatchMetricsExporter() { super(); setAutodetect(false); setNamingStrategy(new MetadataNamingStrategy(attributeSource)); setAssembler(new MetadataMBeanInfoAssembler(attributeSource)); }
From source file:co.paralleluniverse.common.spring.SpringContainerHelper.java
private static BeanDefinition getMBeanExporterBeanDefinition(String defaultDomain) { final AnnotationJmxAttributeSource annotationSource = new AnnotationJmxAttributeSource(); final GenericBeanDefinition bean = new GenericBeanDefinition(); bean.setBeanClass(MBeanExporter.class); MutablePropertyValues properties = new MutablePropertyValues(); properties.add("server", ManagementFactory.getPlatformMBeanServer()); properties.add("autodetectMode", MBeanExporter.AUTODETECT_ASSEMBLER); properties.add("assembler", new MetadataMBeanInfoAssembler(annotationSource)); properties.add("namingStrategy", new MBeanNamingStrategy(annotationSource).setDefaultDomain(defaultDomain)); bean.setPropertyValues(properties);//w w w . j ava2 s. c o m return bean; }