Search in sources :

Example 1 with MBeanDomain

use of org.talend.designer.runtime.visualization.internal.ui.properties.MBean.MBeanDomain in project tdi-studio-se by Talend.

the class AttributeContentProvider method refresh.

/**
     * Refreshes the content provider.
     * 
     * @param jvm The active JVM
     */
public void refresh(IActiveJvm jvm) {
    domains = new HashMap<String, MBeanDomain>();
    // add or update elements
    for (ObjectName objectName : getObjectNames(jvm)) {
        MBeanInfo mBeanInfo = getMBeanInfo(jvm, objectName);
        if (mBeanInfo == null) {
            continue;
        }
        List<AttributeNode> mBeanAttributes = new ArrayList<AttributeNode>();
        for (MBeanAttributeInfo attributeInfo : mBeanInfo.getAttributes()) {
            String attributeName = attributeInfo.getName();
            Object value = getContents(jvm, objectName, attributeName);
            addAttributeRoots(mBeanAttributes, new AttributeNode(attributeName, null, objectName), value);
        }
        for (AttributeNode node : mBeanAttributes.toArray(new AttributeNode[0])) {
            validateAttributes(node);
            if (node.getChildren().size() == 0 && !node.isValidLeaf()) {
                mBeanAttributes.remove(node);
            }
        }
        if (mBeanAttributes.size() == 0) {
            continue;
        }
        attributes.put(objectName, mBeanAttributes);
        String domainName = objectName.getDomain();
        MBeanDomain domain;
        if (domains.containsKey(domainName)) {
            domain = domains.get(domainName);
        } else {
            domain = new MBeanDomain(domainName);
        }
        domain.refresh(objectName, jvm);
        domains.put(domainName, domain);
    }
}
Also used : MBeanDomain(org.talend.designer.runtime.visualization.internal.ui.properties.MBean.MBeanDomain) MBeanInfo(javax.management.MBeanInfo) ArrayList(java.util.ArrayList) MBeanAttributeInfo(javax.management.MBeanAttributeInfo) ObjectName(javax.management.ObjectName)

Aggregations

ArrayList (java.util.ArrayList)1 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)1 MBeanInfo (javax.management.MBeanInfo)1 ObjectName (javax.management.ObjectName)1 MBeanDomain (org.talend.designer.runtime.visualization.internal.ui.properties.MBean.MBeanDomain)1