Example usage for javax.management MBeanAttributeInfo getName

List of usage examples for javax.management MBeanAttributeInfo getName

Introduction

In this page you can find the example usage for javax.management MBeanAttributeInfo getName.

Prototype

public String getName() 

Source Link

Document

Returns the name of the feature.

Usage

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

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

    for (ObjectName appName : findMBeans("*:j2eeType=WebModule,*")) {
        for (MBeanAttributeInfo mbai : mbs.getMBeanInfo(appName).getAttributes()) {
            pw.print(mbai.getName() + ",");
            pw.print(mbai.getType() + ",");
            pw.print(mbai.getDescription() + ",");
            pw.print(mbs.getAttribute(appName, mbai.getName()) + "\n");
        }//from  w w  w . j  av a2s.com
        pw.print("\n");
        for (MBeanOperationInfo mboi : mbs.getMBeanInfo(appName).getOperations()) {
            pw.print(mboi.getName() + ",");
            pw.print(mboi.getReturnType() + ",");
            pw.print(mboi.getDescription() + "\n");
        }
        pw.print("\n\n");
    }
}

From source file:org.fishwife.jrugged.spring.jmx.TestWebMBeanAdapter.java

@Test
public void testGetAttributeValues() throws Exception {
    MBeanAttributeInfo[] attributeInfoArray = new MBeanAttributeInfo[2];
    MBeanAttributeInfo mockAttributeInfo1 = createMock(MBeanAttributeInfo.class);
    MBeanAttributeInfo mockAttributeInfo2 = createMock(MBeanAttributeInfo.class);
    attributeInfoArray[0] = mockAttributeInfo1;
    attributeInfoArray[1] = mockAttributeInfo2;
    expect(mockMBeanInfo.getAttributes()).andReturn(attributeInfoArray);

    String attributeName1 = "attribute_name_1";
    String attributeName2 = "attribute_name_2";
    expect(mockAttributeInfo1.getName()).andReturn(attributeName1);
    expect(mockAttributeInfo2.getName()).andReturn(attributeName2);

    AttributeList mockAttributeList = createMock(AttributeList.class);
    expect(mockMBeanServer.getAttributes(eq(mockObjectName), anyObject(String[].class)))
            .andReturn(mockAttributeList);

    List<Attribute> attributeList = new ArrayList<Attribute>();
    Attribute mockAttribute1 = createMock(Attribute.class);
    Attribute mockAttribute2 = createMock(Attribute.class);

    attributeList.add(mockAttribute1);// w ww .jav  a2  s.c  om
    attributeList.add(mockAttribute2);

    expect(mockAttributeList.asList()).andReturn(attributeList);

    String name1 = "name 1";
    String value1 = "value 1";
    expect(mockAttribute1.getName()).andReturn(name1);
    expect(mockAttribute1.getValue()).andReturn(value1);
    expect(mockSanitizer.escapeValue(value1)).andReturn(value1);

    String name2 = "name 2";
    String value2 = "value 2";
    expect(mockAttribute2.getName()).andReturn(name2);
    expect(mockAttribute2.getValue()).andReturn(value2);
    expect(mockSanitizer.escapeValue(value2)).andReturn(value2);

    replay(mockMBeanServer, mockSanitizer, mockObjectName, mockMBeanInfo, mockAttributeInfo1,
            mockAttributeInfo2, mockAttributeList, mockAttribute1, mockAttribute2);

    Map<String, Object> attributeValueMap = webMBeanAdapter.getAttributeValues();

    assertEquals(2, attributeValueMap.size());
    assertEquals(value1, attributeValueMap.get(name1));
    assertEquals(value2, attributeValueMap.get(name2));

    verify(mockMBeanServer, mockSanitizer, mockObjectName, mockMBeanInfo, mockAttributeInfo1,
            mockAttributeInfo2, mockAttributeList, mockAttribute1, mockAttribute2);
}

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

protected void reportAllMBeanDetails(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());
    }/* w w  w. j a  v  a  2 s .  c  o m*/
    for (Object beanName : sortedBeanNames) {
        pw.print(beanName.toString() + "\n");
        ObjectName beanObjectName = new ObjectName(beanName.toString());
        for (MBeanAttributeInfo mbai : mbs.getMBeanInfo(beanObjectName).getAttributes()) {
            pw.print("  ");
            pw.print(mbai.getName() + ",");
            pw.print(mbai.getType() + ",");
            pw.print(mbai.getDescription() + ",");
            pw.print(mbs.getAttribute(beanObjectName, mbai.getName()) + "\n");
        }
        pw.print("\n");
        for (MBeanOperationInfo mboi : mbs.getMBeanInfo(beanObjectName).getOperations()) {
            pw.print("  ");
            pw.print(mboi.getReturnType() + ",");
            pw.print(mboi.getName() + "(");
            for (MBeanParameterInfo mbpi : mboi.getSignature()) {
                pw.print(mbpi.getType() + " " + mbpi.getName() + ",");
            }
            pw.print("),");
            pw.print(mboi.getDescription() + "\n");
        }
        pw.print("\n-----------------------------\n\n");
    }
}

From source file:com.jkoolcloud.tnt4j.streams.custom.kafka.interceptors.reporters.metrics.MetricsReporter.java

/**
 * Collects JMX attributes of MBeans defined by <tt>objNameStr</tt>.
 *
 * @param objNameStr/*from  w  w w .  j a v a2  s  .  c om*/
 *            MBeans object name pattern to query
 * @param mBeanServer
 *            MBean server instance to use
 * @param activity
 *            activity instance to put JMX metrics snapshots
 * @throws Exception
 *             if JMX attributes collecting fails
 */
public void collectMetricsJMX(String objNameStr, MBeanServer mBeanServer, Activity activity) throws Exception {
    ObjectName oName = new ObjectName(objNameStr);
    Set<ObjectName> metricsBeans = mBeanServer.queryNames(oName, null);

    for (ObjectName mBeanName : metricsBeans) {
        try {
            PropertySnapshot snapshot = new PropertySnapshot(mBeanName.getCanonicalName());
            MBeanInfo metricsBean = mBeanServer.getMBeanInfo(mBeanName);
            MBeanAttributeInfo[] pMetricsAttrs = metricsBean.getAttributes();
            for (MBeanAttributeInfo pMetricsAttr : pMetricsAttrs) {
                try {
                    String attrName = pMetricsAttr.getName();
                    Object attrValue = mBeanServer.getAttribute(mBeanName, attrName);
                    processAttrValue(snapshot, new PropertyNameBuilder(pMetricsAttr.getName()), attrValue);
                } catch (Exception exc) {
                    Utils.logThrowable(LOGGER, OpLevel.WARNING,
                            StreamsResources.getBundle(KafkaStreamConstants.RESOURCE_BUNDLE_NAME),
                            "MetricsReporter.bean.attr.fail", mBeanName, pMetricsAttr.getName(), exc);
                }
            }

            if (getSnapshotPropIgnoreCase(snapshot, OBJ_NAME_ENTRY_KEY) == null) {
                snapshot.add(OBJ_NAME_ENTRY_KEY, mBeanName.getCanonicalName());
            }
            if (useObjectNameProperties) {
                snapshot.add("domain", mBeanName.getDomain()); // NON-NLS
                Map<String, String> objNameProps = mBeanName.getKeyPropertyList();
                for (Map.Entry<String, String> objNameProp : objNameProps.entrySet()) {
                    String propKey = objNameProp.getKey();
                    Object mv = snapshot.get(propKey);
                    snapshot.add(propKey + (mv == null ? "" : "_"), objNameProp.getValue()); // NON-NLS
                }
            }
            activity.addSnapshot(snapshot);
        } catch (Exception exc) {
            Utils.logThrowable(LOGGER, OpLevel.WARNING,
                    StreamsResources.getBundle(KafkaStreamConstants.RESOURCE_BUNDLE_NAME),
                    "MetricsReporter.bean.info.fail", mBeanName, exc);
        }
    }
}

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);//  ww w .  j av  a2 s  .c  o 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.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  ww. j a  v a  2s . c o 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.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  ww .  j  a v  a 2s  .  c  om
    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:com.tesora.dve.tools.DVEConfigCLI.java

public void cmd_jmx_get_attributes() throws PEException {

    checkJMXConnected();//  w  ww . ja  v a  2s  . c om
    checkJMXDomain();
    checkJMXMBean();

    for (final MBeanAttributeInfo attrib : jmxMBeanInfo.getAttributes()) {
        if (attrib.isReadable()) {
            println(attrib.getName() + " = " + jmxConnector.getAttribute(jmxMBean, attrib.getName()));
        }
    }
}

From source file:de.acosix.alfresco.mtsupport.repo.sync.TenantAwareChainingUserRegistrySynchronizer.java

protected void logPluginConfig(final String id) {
    try {/*from  w w  w .  j  a  v a  2  s  .  c  o  m*/
        final StringBuilder nameBuff = new StringBuilder(200)
                .append("Alfresco:Type=Configuration,Category=Authentication,id1=managed,id2=")
                .append(URLDecoder.decode(id, "UTF-8"));
        final ObjectName name = new ObjectName(nameBuff.toString());
        if (this.mbeanServer != null && this.mbeanServer.isRegistered(name)) {
            final MBeanInfo info = this.mbeanServer.getMBeanInfo(name);
            final MBeanAttributeInfo[] attributes = info.getAttributes();
            LOGGER.debug("{} attributes:", id);
            for (final MBeanAttributeInfo attribute : attributes) {
                final Object value = this.mbeanServer.getAttribute(name, attribute.getName());
                LOGGER.debug("{} = {}", attribute.getName(), value);
            }
        }
    } catch (final MalformedObjectNameException | InstanceNotFoundException | IntrospectionException
            | AttributeNotFoundException | ReflectionException | MBeanException | IOException e) {
        LOGGER.warn("Exception during logging", e);
    }
}

From source file:com.cyberway.issue.crawler.admin.CrawlJob.java

protected void addBdbjeAttributes(final List<OpenMBeanAttributeInfo> attributes,
        final List<MBeanAttributeInfo> bdbjeAttributes, final List<String> bdbjeNamesToAdd) {
    for (MBeanAttributeInfo info : bdbjeAttributes) {
        if (bdbjeNamesToAdd.contains(info.getName())) {
            attributes.add(JmxUtils.convertToOpenMBeanAttribute(info));
        }/*from  ww w .j  av a 2 s.c  o  m*/
    }
}