Example usage for javax.management ObjectInstance getObjectName

List of usage examples for javax.management ObjectInstance getObjectName

Introduction

In this page you can find the example usage for javax.management ObjectInstance getObjectName.

Prototype

public ObjectName getObjectName() 

Source Link

Document

Returns the object name part.

Usage

From source file:org.nuxeo.ecm.webapp.seam.NuxeoSeamWebGate.java

protected Set<WebConnector> fetchConnectors() {
    Set<WebConnector> connectors = new HashSet<WebConnector>();
    MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
    ObjectName names;//from w  ww  .  j a  v a2s . co m
    try {
        names = new ObjectName("Catalina:type=Connector,port=*,address=*");
    } catch (MalformedObjectNameException e) {
        log.error("Cannot query for tomcat connectors", e);
        return connectors;
    }
    Set<ObjectInstance> ois = mbs.queryMBeans(names, null);
    for (ObjectInstance oi : ois) {
        WebConnector connector = JMX.newMBeanProxy(mbs, oi.getObjectName(), WebConnector.class);
        connectors.add(connector);
    }
    return connectors;
}

From source file:org.openehealth.coala.lifecycle.FacesAppListener.java

@Override
public void processEvent(SystemEvent event) throws AbortProcessingException {

    /*/*from w  w  w .  j  a  va2  s .c o m*/
     * STARTUP PHASE - nothing yet
     */
    if (event instanceof PostConstructApplicationEvent) {
        LOG.info("PostConstructApplicationEvent is called");
    }

    /*
     * SHUTDOWN PHASE - cleaning up PDQ/XDS ipf routes (mwiesner)
     */

    if (event instanceof PreDestroyApplicationEvent) {
        LOG.info("PreDestroyApplicationEvent is called");
        MBeanServer mbserver = null;

        ArrayList<MBeanServer> mbservers = MBeanServerFactory.findMBeanServer(null);

        if (mbservers.size() > 0) {
            mbserver = (MBeanServer) mbservers.get(0);
        }

        if (mbserver != null) {
            LOG.info("Found our MBean server instance...");
        } else {
            mbserver = MBeanServerFactory.createMBeanServer();
        }

        try {
            Set<ObjectInstance> mbeans = mbserver.queryMBeans(null, null);
            for (ObjectInstance mb : mbeans) {
                if (mb.getObjectName().getCanonicalName().contains("camelContext-pdq")) {
                    LOG.info("Successfully removed MBean: " + mb.getObjectName().getCanonicalName());
                    mbserver.unregisterMBean(mb.getObjectName());
                } else if (mb.getObjectName().getCanonicalName().contains("camelContext-xds")) {
                    LOG.info("Successfully removed MBean: " + mb.getObjectName().getCanonicalName());
                    mbserver.unregisterMBean(mb.getObjectName());
                }
            }
        } catch (InstanceNotFoundException infe) {
            LOG.warn("Ignoring to unregister pdq/xds camelContext, as it was not found!?");
        } catch (Throwable e) {
            LOG.error(e.getLocalizedMessage(), e);
        }
    }
}

From source file:org.opennms.features.jmxconfiggenerator.jmxconfig.JmxDatacollectionConfiggenerator.java

public JmxDatacollectionConfig generateJmxConfigModel(MBeanServerConnection mBeanServerConnection,
        String serviceName, Boolean runStandardVmBeans, Boolean runWritableMBeans,
        Map<String, String> dictionary) {

    logger.debug("Startup values: \n serviceName: " + serviceName + "\n runStandardVmBeans: "
            + runStandardVmBeans + "\n runWritableMBeans: " + runWritableMBeans + "\n dictionary" + dictionary);
    nameCutter.setDictionary(dictionary);
    JmxDatacollectionConfig xmlJmxDatacollectionConfig = xmlObjectFactory.createJmxDatacollectionConfig();
    JmxCollection xmlJmxCollection = xmlObjectFactory.createJmxCollection();

    xmlJmxCollection.setName("JSR160-" + serviceName);
    xmlJmxCollection.setRrd(rrd);/*from w w w . ja  v  a2 s.co m*/
    xmlJmxDatacollectionConfig.getJmxCollection().add(xmlJmxCollection);
    xmlJmxCollection.setMbeans(xmlObjectFactory.createMbeans());

    if (runStandardVmBeans) {
        ignores.clear();
    } else {
        ignores.addAll(standardVmBeans);
    }

    try {
        String[] domains = mBeanServerConnection.getDomains();
        logger.info("Found " + domains.length + " domains");
        logger.info("domains: " + Arrays.toString(domains));
        for (String domainName : domains) {

            // just domains that are relevant for the service
            if (!ignores.contains(domainName)) {
                logger.info("domain: " + domainName);

                // for all mBeans of the actual domain
                for (ObjectInstance jmxObjectInstance : mBeanServerConnection
                        .queryMBeans(new ObjectName(domainName + ":*"), null)) {
                    Mbean xmlMbean = xmlObjectFactory.createMbean();
                    xmlMbean.setObjectname(jmxObjectInstance.getObjectName().toString());
                    String typeAndOthers = StringUtils
                            .substringAfterLast(jmxObjectInstance.getObjectName().getCanonicalName(), "=");
                    xmlMbean.setName(domainName + "." + typeAndOthers);

                    logger.debug("\t" + jmxObjectInstance.getObjectName());

                    MBeanInfo jmxMbeanInfo;
                    try {
                        jmxMbeanInfo = mBeanServerConnection.getMBeanInfo(jmxObjectInstance.getObjectName());
                    } catch (InstanceNotFoundException e) {
                        logger.error("InstanceNotFoundException skipping MBean '{}' message: '{}'",
                                jmxObjectInstance.getObjectName(), e.getMessage());
                        continue;
                    } catch (IntrospectionException e) {
                        logger.error("IntrospectionException skipping MBean '{}' message: '{}'",
                                jmxObjectInstance.getObjectName(), e.getMessage());
                        continue;
                    } catch (ReflectionException e) {
                        logger.error("ReflectionException skipping MBean '{}' message: '{}'",
                                jmxObjectInstance.getObjectName(), e.getMessage());
                        continue;
                    } catch (Throwable e) {
                        logger.error(
                                "problem during remote call to get MBeanInfo for '{}' skipping this MBean. Message '{}'",
                                jmxObjectInstance.getObjectName(), e.getMessage());
                        continue;
                    }

                    logger.debug("--- Attributes for " + jmxObjectInstance.getObjectName());

                    for (MBeanAttributeInfo jmxBeanAttributeInfo : jmxMbeanInfo.getAttributes()) {

                        // process just readable mbeans
                        if (jmxBeanAttributeInfo.isReadable()) {
                            // precess writable mbeans if run writable
                            // mbeans is set
                            if (!jmxBeanAttributeInfo.isWritable() || runWritableMBeans) {

                                logger.debug("Check mBean: '{}', attribute: '{}'",
                                        jmxObjectInstance.getObjectName().toString(),
                                        jmxBeanAttributeInfo.getName());
                                logger.debug("isWritable: '{}', type: '{}'", jmxBeanAttributeInfo.isWritable(),
                                        jmxBeanAttributeInfo.getType());

                                // check for CompositeData
                                if ("javax.management.openmbean.CompositeData"
                                        .equals(jmxBeanAttributeInfo.getType())) {
                                    logger.error("actual mBean: '{}'", jmxObjectInstance.getObjectName());
                                    CompAttrib compAttrib = createCompAttrib(mBeanServerConnection,
                                            jmxObjectInstance, jmxBeanAttributeInfo);
                                    if (compAttrib != null) {
                                        logger.debug("xmlMbean got CompAttrib");
                                        xmlMbean.getCompAttrib().add(compAttrib);
                                    }
                                }

                                if (numbers.contains(jmxBeanAttributeInfo.getType())) {
                                    Attrib xmlJmxAttribute = createAttr(jmxBeanAttributeInfo);
                                    logger.debug("Added MBean: '{}' Added attribute: '{}'",
                                            xmlMbean.getObjectname(),
                                            xmlJmxAttribute.getName() + " as " + xmlJmxAttribute.getAlias());
                                    xmlMbean.getAttrib().add(xmlJmxAttribute);
                                }
                            }
                        }
                    }

                    if (xmlMbean.getAttrib().size() > 0 || xmlMbean.getCompAttrib().size() > 0) {
                        xmlJmxCollection.getMbeans().getMbean().add(xmlMbean);
                    } else {
                        logger.debug("mbean: " + xmlMbean.getName() + " has no relavant attributes.");
                    }
                }
            } else {
                logger.debug("ignored: " + domainName);
            }
        }

    } catch (MalformedObjectNameException e) {
        logger.error("MalformedObjectNameException '{}'", e.getMessage());
    } catch (IOException e) {
        logger.error("IOException '{}'", e.getMessage());
    }
    logger.debug("finish collection!");
    return xmlJmxDatacollectionConfig;
}

From source file:org.opennms.features.jmxconfiggenerator.jmxconfig.JmxDatacollectionConfiggenerator.java

private CompAttrib createCompAttrib(MBeanServerConnection jmxServerConnection, ObjectInstance jmxObjectInstance,
        MBeanAttributeInfo jmxMBeanAttributeInfo) {
    Boolean contentAdded = false;

    CompAttrib xmlCompAttrib = xmlObjectFactory.createCompAttrib();
    xmlCompAttrib.setName(jmxMBeanAttributeInfo.getName());
    xmlCompAttrib.setType("Composite");
    xmlCompAttrib.setAlias(jmxMBeanAttributeInfo.getName());

    CompositeData compositeData;/*from   w  w  w .  jav  a  2  s  .c o  m*/
    try {
        logger.debug("Try to get composite data");
        compositeData = (CompositeData) jmxServerConnection.getAttribute(jmxObjectInstance.getObjectName(),
                jmxMBeanAttributeInfo.getName());
        if (compositeData == null) {
            logger.warn(
                    "compositeData is null. jmxObjectInstance.getObjectName: '{}', jmxMBeanAttributeInfo.getName: '{}'");
        }
        if (compositeData != null) {
            logger.debug("compositeData.getCompositeType: '{}'", compositeData.getCompositeType());
            Set<String> keys = compositeData.getCompositeType().keySet();
            for (String key : keys) {
                Object compositeEntry = compositeData.get(key);
                if (numbers.contains(compositeEntry.getClass().getName())) {
                    contentAdded = true;
                    CompMember xmlCompMember = xmlObjectFactory.createCompMember();
                    xmlCompMember.setName(key);

                    logger.debug("composite member pure alias: '{}'",
                            jmxMBeanAttributeInfo.getName() + StringUtils.capitalize(key));
                    String alias = nameCutter
                            .trimByDictionary(jmxMBeanAttributeInfo.getName() + StringUtils.capitalize(key));
                    alias = createAndRegisterUniqueAlias(alias);
                    xmlCompMember.setAlias(alias);
                    logger.debug("composite member trimmed alias: '{}'", alias);

                    xmlCompMember.setType("gauge");
                    xmlCompAttrib.getCompMember().add(xmlCompMember);

                } else {
                    logger.debug("composite member key '{}' object's class '{}' was not a number.", key,
                            compositeEntry.getClass().getName());
                }
            }
        }
    } catch (Exception e) {
        logger.error("killed in action: '{}'", e.getMessage());
    }

    if (contentAdded) {
        logger.debug("xmlCompAttrib returned by createCompAttrib it's '{}'", xmlCompAttrib);
        return xmlCompAttrib;
    }
    return null;
}

From source file:org.opennms.jmxconfiggenerator.jmxconfig.JmxDatacollectionConfiggenerator.java

public JmxDatacollectionConfig generateJmxConfigModel(MBeanServerConnection mBeanServerConnection,
        String serviceName, Boolean runStandardVmBeans, Boolean runWritableMBeans,
        Map<String, String> dictionary) {

    logger.debug("Startup values: \n serviceName: " + serviceName + "\n runStandardVmBeans: "
            + runStandardVmBeans + "\n runWritableMBeans: " + runWritableMBeans + "\n dictionary" + dictionary);
    nameCutter.setDictionary(dictionary);
    JmxDatacollectionConfig xmlJmxDatacollectionConfig = xmlObjectFactory.createJmxDatacollectionConfig();
    JmxCollection xmlJmxCollection = xmlObjectFactory.createJmxCollection();

    xmlJmxCollection.setName("JSR160-" + serviceName);
    xmlJmxCollection.setRrd(rrd);//w w w. jav  a  2s . co m
    xmlJmxDatacollectionConfig.getJmxCollection().add(xmlJmxCollection);
    xmlJmxCollection.setMbeans(xmlObjectFactory.createMbeans());

    if (runStandardVmBeans) {
        ignores.clear();
    } else {
        ignores.addAll(standardVmBeans);
    }

    try {
        for (String domainName : mBeanServerConnection.getDomains()) {

            // just domains that are relevant for the service
            if (!ignores.contains(domainName)) {
                logger.debug("domain: " + domainName);

                // for all mBeans of the actual domain
                for (ObjectInstance jmxObjectInstance : mBeanServerConnection
                        .queryMBeans(new ObjectName(domainName + ":*"), null)) {
                    Mbean xmlMbean = xmlObjectFactory.createMbean();
                    xmlMbean.setObjectname(jmxObjectInstance.getObjectName().toString());
                    String typeAndOthers = StringUtils
                            .substringAfterLast(jmxObjectInstance.getObjectName().getCanonicalName(), "=");
                    xmlMbean.setName(domainName + "." + typeAndOthers);

                    logger.debug("\t" + jmxObjectInstance.getObjectName());

                    MBeanInfo jmxMbeanInfo;
                    try {
                        jmxMbeanInfo = mBeanServerConnection.getMBeanInfo(jmxObjectInstance.getObjectName());
                    } catch (InstanceNotFoundException e) {
                        logger.error("InstanceNotFoundException skipping MBean '{}' message: '{}'",
                                jmxObjectInstance.getObjectName(), e.getMessage());
                        continue;
                    } catch (IntrospectionException e) {
                        logger.error("IntrospectionException skipping MBean '{}' message: '{}'",
                                jmxObjectInstance.getObjectName(), e.getMessage());
                        continue;
                    } catch (ReflectionException e) {
                        logger.error("ReflectionException skipping MBean '{}' message: '{}'",
                                jmxObjectInstance.getObjectName(), e.getMessage());
                        continue;
                    } catch (Throwable e) {
                        logger.error(
                                "problem during remote call to get MBeanInfo for '{}' skipping this MBean. Message '{}'",
                                jmxObjectInstance.getObjectName(), e.getMessage());
                        continue;
                    }

                    logger.debug("--- Attributes for " + jmxObjectInstance.getObjectName());

                    for (MBeanAttributeInfo jmxBeanAttributeInfo : jmxMbeanInfo.getAttributes()) {

                        // process just readable mbeans
                        if (jmxBeanAttributeInfo.isReadable()) {
                            // precess writable mbeans if run writable mbeans is set
                            if (!jmxBeanAttributeInfo.isWritable() || runWritableMBeans) {

                                logger.debug("Check mBean: '{}', attribute: '{}'",
                                        jmxObjectInstance.getObjectName().toString(),
                                        jmxBeanAttributeInfo.getName());
                                logger.debug("isWritable: '{}', type: '{}'", jmxBeanAttributeInfo.isWritable(),
                                        jmxBeanAttributeInfo.getType());

                                // check for CompositeData
                                if ("javax.management.openmbean.CompositeData"
                                        .equals(jmxBeanAttributeInfo.getType())) {
                                    logger.error("actual mBean: '{}'", jmxObjectInstance.getObjectName());
                                    CompAttrib compAttrib = createCompAttrib(mBeanServerConnection,
                                            jmxObjectInstance, jmxBeanAttributeInfo);
                                    if (compAttrib != null) {
                                        logger.debug("xmlMbean got CompAttrib");
                                        xmlMbean.getCompAttrib().add(compAttrib);
                                    }
                                }

                                if (numbers.contains(jmxBeanAttributeInfo.getType())) {
                                    Attrib xmlJmxAttribute = createAttr(jmxBeanAttributeInfo);
                                    logger.debug("Added MBean: '{}' Added attribute: '{}'",
                                            xmlMbean.getObjectname(),
                                            xmlJmxAttribute.getName() + " as " + xmlJmxAttribute.getAlias());
                                    xmlMbean.getAttrib().add(xmlJmxAttribute);
                                }
                            }
                        }
                    }

                    if (xmlMbean.getAttrib().size() > 0 || xmlMbean.getCompAttrib().size() > 0) {
                        xmlJmxCollection.getMbeans().getMbean().add(xmlMbean);
                    } else {
                        logger.debug("mbean: " + xmlMbean.getName() + " has no relavant attributes.");
                    }
                }
            } else {
                logger.debug("ignored: " + domainName);
            }
        }

    } catch (MalformedObjectNameException e) {
        logger.error("MalformedObjectNameException '{}'", e.getMessage());
    } catch (IOException e) {
        logger.error("IOException '{}'", e.getMessage());
    }

    return xmlJmxDatacollectionConfig;
}

From source file:org.opennms.netmgt.vmmgr.InvokerTest.java

private static String getObjectInstanceString(ObjectInstance objectInstance) {
    return new ToStringBuilder(objectInstance).append("class", objectInstance.getClassName())
            .append("object", objectInstance.getObjectName()).toString();
}

From source file:org.opennms.tools.jmxconfiggenerator.jmxconfig.JmxDatacollectionConfiggenerator.java

public JmxDatacollectionConfig generateJmxConfigModel(MBeanServerConnection mBeanServerConnection,
        String serviceName, Boolean runStandardVmBeans, Boolean runWritableMBeans) {

    logger.debug("Startup values: \n serviceName: " + serviceName + "\n runStandardVmBeans: "
            + runStandardVmBeans + "\n runWritableMBeans: " + runWritableMBeans);
    JmxDatacollectionConfig xmlJmxDatacollectionConfig = xmlObjectFactory.createJmxDatacollectionConfig();
    JmxCollection xmlJmxCollection = xmlObjectFactory.createJmxCollection();

    xmlJmxCollection.setName("JSR160-" + serviceName);
    xmlJmxCollection.setRrd(rrd);//from  w w w  . ja  v  a2  s .com
    xmlJmxDatacollectionConfig.getJmxCollection().add(xmlJmxCollection);
    xmlJmxCollection.setMbeans(xmlObjectFactory.createMbeans());

    if (runStandardVmBeans) {
        ignores.clear();
    } else {
        ignores.addAll(standardVmBeans);
    }

    try {
        for (String domainName : mBeanServerConnection.getDomains()) {

            // just domains that are relevant for the service
            if (!ignores.contains(domainName)) {
                logger.debug("domain: " + domainName);

                // for all mBeans of the actual domain
                for (ObjectInstance jmxObjectInstance : mBeanServerConnection
                        .queryMBeans(new ObjectName(domainName + ":*"), null)) {
                    Mbean xmlMbean = xmlObjectFactory.createMbean();
                    xmlMbean.setObjectname(jmxObjectInstance.getObjectName().toString());
                    String typeAndOthers = StringUtils
                            .substringAfterLast(jmxObjectInstance.getObjectName().getCanonicalName(), "=");
                    xmlMbean.setName(domainName + "." + typeAndOthers);

                    logger.debug("\t" + jmxObjectInstance.getObjectName());

                    MBeanInfo jmxMbeanInfo;
                    try {
                        jmxMbeanInfo = mBeanServerConnection.getMBeanInfo(jmxObjectInstance.getObjectName());
                    } catch (InstanceNotFoundException e) {
                        logger.error("InstanceNotFoundException skipping MBean '{}' message: '{}'",
                                jmxObjectInstance.getObjectName(), e.getMessage());
                        continue;
                    } catch (IntrospectionException e) {
                        logger.error("IntrospectionException skipping MBean '{}' message: '{}'",
                                jmxObjectInstance.getObjectName(), e.getMessage());
                        continue;
                    } catch (ReflectionException e) {
                        logger.error("ReflectionException skipping MBean '{}' message: '{}'",
                                jmxObjectInstance.getObjectName(), e.getMessage());
                        continue;
                    } catch (Throwable e) {
                        logger.error(
                                "problem during remote call to get MBeanInfo for '{}' skipping this MBean. Message '{}'",
                                jmxObjectInstance.getObjectName(), e.getMessage());
                        continue;
                    }

                    logger.debug("--- Attributes for " + jmxObjectInstance.getObjectName());

                    for (MBeanAttributeInfo jmxBeanAttributeInfo : jmxMbeanInfo.getAttributes()) {

                        // process just readable mbeans
                        if (jmxBeanAttributeInfo.isReadable()) {
                            // precess writable mbeans if run writable mbeans is set
                            if (!jmxBeanAttributeInfo.isWritable() || runWritableMBeans) {

                                logger.debug("Check mBean: '{}', attribute: '{}'",
                                        jmxObjectInstance.getObjectName().toString(),
                                        jmxBeanAttributeInfo.getName());
                                logger.debug("isWritable: '{}', type: '{}'", jmxBeanAttributeInfo.isWritable(),
                                        jmxBeanAttributeInfo.getType());

                                // check for CompositeData
                                if ("javax.management.openmbean.CompositeData"
                                        .equals(jmxBeanAttributeInfo.getType())) {
                                    logger.error("actual mBean: '{}'", jmxObjectInstance.getObjectName());
                                    CompAttrib compAttrib = createCompAttrib(mBeanServerConnection,
                                            jmxObjectInstance, jmxBeanAttributeInfo);
                                    if (compAttrib != null) {
                                        logger.debug("xmlMbean got CompAttrib");
                                        xmlMbean.getCompAttrib().add(compAttrib);
                                    }
                                }

                                if (numbers.contains(jmxBeanAttributeInfo.getType())) {
                                    Attrib xmlJmxAttribute = createAttr(jmxBeanAttributeInfo);
                                    logger.debug("Added MBean: '{}' Added attribute: '{}'",
                                            xmlMbean.getObjectname(),
                                            xmlJmxAttribute.getName() + " as " + xmlJmxAttribute.getAlias());
                                    xmlMbean.getAttrib().add(xmlJmxAttribute);
                                }
                            }
                        }
                    }

                    if (xmlMbean.getAttrib().size() > 0 || xmlMbean.getCompAttrib().size() > 0) {
                        xmlJmxCollection.getMbeans().getMbean().add(xmlMbean);
                    } else {
                        logger.debug("mbean: " + xmlMbean.getName() + " has no relavant attributes.");
                    }
                }
            } else {
                logger.debug("ignored: " + domainName);
            }
        }

    } catch (MalformedObjectNameException e) {
        logger.error("MalformedObjectNameException '{}'", e.getMessage());
    } catch (IOException e) {
        logger.error("IOException '{}'", e.getMessage());
    }

    return xmlJmxDatacollectionConfig;
}

From source file:org.opennms.tools.jmxconfiggenerator.jmxconfig.JmxDatacollectionConfiggenerator.java

private CompAttrib createCompAttrib(MBeanServerConnection jmxServerConnection, ObjectInstance jmxObjectInstance,
        MBeanAttributeInfo jmxMBeanAttributeInfo) {
    Boolean contentAdded = false;

    CompAttrib xmlCompAttrib = xmlObjectFactory.createCompAttrib();
    xmlCompAttrib.setName(jmxMBeanAttributeInfo.getName());
    xmlCompAttrib.setType("Composite");
    xmlCompAttrib.setAlias(jmxMBeanAttributeInfo.getName());

    CompositeData compositeData;//from  w w w  .  j a v a2 s. c o  m
    try {
        logger.debug("Try to get composite data");
        compositeData = (CompositeData) jmxServerConnection.getAttribute(jmxObjectInstance.getObjectName(),
                jmxMBeanAttributeInfo.getName());
        if (compositeData == null)
            logger.warn(
                    "compositeData is null. jmxObjectInstance.getObjectName: '{}', jmxMBeanAttributeInfo.getName: '{}'");
        if (compositeData != null) {
            logger.debug("compositeData.getCompositeType: '{}'", compositeData.getCompositeType());
            Set<String> keys = compositeData.getCompositeType().keySet();
            for (String key : keys) {
                Object compositeEntry = compositeData.get(key);
                if (numbers.contains(compositeEntry.getClass().getName())) {
                    contentAdded = true;
                    CompMember xmlCompMember = xmlObjectFactory.createCompMember();
                    xmlCompMember.setName(key);

                    logger.debug("composite member pure alias: '{}'",
                            jmxMBeanAttributeInfo.getName() + StringUtils.capitalize(key));
                    String alias = NameTools
                            .trimByDictionary(jmxMBeanAttributeInfo.getName() + StringUtils.capitalize(key));
                    alias = createAndRegisterUniceAlias(alias);
                    xmlCompMember.setAlias(alias);
                    logger.debug("composite member trimmed alias: '{}'", alias);

                    xmlCompMember.setType("gauge");
                    xmlCompAttrib.getCompMember().add(xmlCompMember);

                } else {
                    logger.debug("composite member key '{}' object's class '{}' was not a number.", key,
                            compositeEntry.getClass().getName());
                }
            }
        }
    } catch (Exception e) {
        logger.error("killed in action: '{}'", e.getMessage());
    }

    if (contentAdded) {
        logger.debug("xmlCompAttrib returned by createCompAttrib it's '{}'", xmlCompAttrib);
        return xmlCompAttrib;
    }
    return null;
}

From source file:org.ops4j.gaderian.management.impl.MBeanRegistryImpl.java

/**
 * Unregisters all registered MBeans//from  w w  w .  ja v a  2s .  c  o m
 */
public void registryDidShutdown() {
    // Unregister objects in reversed order. Otherwise the
    // Jsr 160 connector gets problems after the namingservice is unregistered
    for (int i = _objectInstances.size() - 1; i >= 0; i--) {
        ObjectInstance objectInstance = (ObjectInstance) _objectInstances.get(i);
        try {
            _beanServer.unregisterMBean(objectInstance.getObjectName());
        } catch (JMException e) {
            // Uncritical error, just warn
            _log.warn(ManagementMessages.errorUnregisteringMBean(objectInstance.getObjectName(), e));
        }
    }
}

From source file:org.sakaiproject.status.StatusServlet.java

protected void reportAllMBeans(HttpServletResponse response) throws Exception {
    PrintWriter pw = response.getWriter();

    Set<ObjectInstance> allBeans = mbs.queryMBeans(null, null);
    SortedSet sortedBeanNames = new TreeSet();
    for (ObjectInstance bean : allBeans) {
        sortedBeanNames.add(bean.getObjectName().toString());
    }/*from   ww  w .  java2  s. co m*/
    for (Object beanName : sortedBeanNames) {
        pw.print(beanName + "\n");
    }
}