Search in sources :

Example 1 with CompAttrib

use of org.opennms.netmgt.config.collectd.jmx.CompAttrib in project opennms by OpenNMS.

the class JMXDataCollectionConfigDao method getMBeanInfo.

public static Map<String, BeanInfo> getMBeanInfo(JmxCollection collection) {
    final Map<String, BeanInfo> map = new HashMap<String, BeanInfo>();
    if (collection == null) {
        return Collections.unmodifiableMap(map);
    }
    for (Mbean mbean : collection.getMbeans()) {
        BeanInfo beanInfo = new BeanInfo();
        beanInfo.setMbeanName(mbean.getName());
        beanInfo.setObjectName(mbean.getObjectname());
        beanInfo.setKeyField(mbean.getKeyfield());
        beanInfo.setExcludes(mbean.getExclude());
        beanInfo.setKeyAlias(mbean.getKeyAlias());
        List<String> attribNameList = new ArrayList<String>();
        List<String> compAttribNameList = new ArrayList<String>();
        for (CompAttrib myCa : mbean.getCompAttribList()) {
            for (CompMember myCm : myCa.getCompMemberList()) {
                attribNameList.add(myCa.getName() + "|" + myCm.getName());
                compAttribNameList.add(myCa.getName() + "|" + myCm.getName());
            }
        }
        for (Attrib myA : mbean.getAttribList()) {
            attribNameList.add(myA.getName());
        }
        beanInfo.setAttributes(attribNameList);
        beanInfo.setCompositeAttributes(compAttribNameList);
        map.put(mbean.getObjectname(), beanInfo);
    }
    return Collections.unmodifiableMap(map);
}
Also used : HashMap(java.util.HashMap) Mbean(org.opennms.netmgt.config.collectd.jmx.Mbean) ArrayList(java.util.ArrayList) CompAttrib(org.opennms.netmgt.config.collectd.jmx.CompAttrib) CompAttrib(org.opennms.netmgt.config.collectd.jmx.CompAttrib) Attrib(org.opennms.netmgt.config.collectd.jmx.Attrib) CompMember(org.opennms.netmgt.config.collectd.jmx.CompMember)

Example 2 with CompAttrib

use of org.opennms.netmgt.config.collectd.jmx.CompAttrib in project opennms by OpenNMS.

the class JMXDataCollectionConfigDao method getAttributeMap.

public static Map<String, List<Attrib>> getAttributeMap(JmxCollection collection, String aSysoid, String anAddress) {
    final Map<String, List<Attrib>> attributeMap = new HashMap<String, List<Attrib>>();
    if (aSysoid == null) {
        LOG.debug("getMibObjectList: aSysoid parameter is NULL...");
        return attributeMap;
    }
    if (collection == null) {
        return attributeMap;
    }
    for (Mbean mbean : collection.getMbeans()) {
        // Make sure to create a new ArrayList because we add to it below
        List<Attrib> list = new ArrayList<Attrib>(mbean.getAttribList());
        for (CompAttrib compAttrib : mbean.getCompAttribList()) {
            for (CompMember compMember : compAttrib.getCompMemberList()) {
                Attrib attribWrapper = new Attrib();
                attribWrapper.setName(compAttrib.getName() + "|" + compMember.getName());
                attribWrapper.setAlias(compMember.getAlias());
                attribWrapper.setType(compMember.getType());
                list.add(attribWrapper);
            }
        }
        attributeMap.put(mbean.getObjectname(), list);
    }
    return attributeMap;
}
Also used : HashMap(java.util.HashMap) Mbean(org.opennms.netmgt.config.collectd.jmx.Mbean) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) CompAttrib(org.opennms.netmgt.config.collectd.jmx.CompAttrib) CompAttrib(org.opennms.netmgt.config.collectd.jmx.CompAttrib) Attrib(org.opennms.netmgt.config.collectd.jmx.Attrib) CompMember(org.opennms.netmgt.config.collectd.jmx.CompMember)

Aggregations

ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Attrib (org.opennms.netmgt.config.collectd.jmx.Attrib)2 CompAttrib (org.opennms.netmgt.config.collectd.jmx.CompAttrib)2 CompMember (org.opennms.netmgt.config.collectd.jmx.CompMember)2 Mbean (org.opennms.netmgt.config.collectd.jmx.Mbean)2 List (java.util.List)1