/** * Unregisters the mbean for the factory / instance * with the supplied URN. * * @param urn the module factory / instance URN. * * @throws JMException if there were errors. * @throws ModuleException if there were errors converting module URN * to object name. */ private void unregister(ModuleURN urn) throws JMException, ModuleException { unregister(urn.toObjectName()); }
/** * Registers the supplied module factory / instance with the * MBean server. * * @param inURN the module factory / instance URN. The MXBean's * object name is derived from the URI. * @param inMXBean the module factory / instance. * * @return the objectName of the registered bean * * @throws MXBeanOperationException if there were errors * registering the bean. */ private ObjectName registerMXBean(ModuleURN inURN, Object inMXBean) throws MXBeanOperationException { ObjectName objectName = inURN.toObjectName(); return registerMXBean(inMXBean, objectName); }
/** * Gets the properties for the given module. * * @param inInstance a <code>ModuleURN</code> value * @return a <code>Map<String,Object></code> value * @throws IntrospectionException if an error occurs transcribing the properties * @throws InstanceNotFoundException if an error occurs transcribing the properties * @throws ReflectionException if an error occurs transcribing the properties */ private Map<String,Object> doGetProperties(ModuleURN inInstance) throws IntrospectionException, InstanceNotFoundException, ReflectionException { failOnNullURN(inInstance); ObjectName on = inInstance.toObjectName(); MBeanServer beanServer = getMBeanServer(); List<String> attribs = Lists.newArrayList(); for(MBeanAttributeInfo info: beanServer.getMBeanInfo(on).getAttributes()) { attribs.add(info.getName()); } AttributeList values = beanServer.getAttributes(on, attribs.toArray(new String[attribs.size()])); Map<String,Object> props = Maps.newHashMap(); for(Attribute a: values.asList()) { props.put(a.getName(), a.getValue()); } return props; } /**
ObjectName on = inInstance.toObjectName(); MBeanServer beanServer = getMBeanServer(); beanServer.setAttributes(on,
ModuleState.DELETABLE_STATES.toString())); ObjectName objectName = inModuleURN.toObjectName(); try { if(getMBeanServer().isRegistered(objectName)) {