Search in sources :

Example 1 with RuntimeInfoDialog

use of org.talend.designer.esb.runcontainer.ui.dialog.RuntimeInfoDialog in project tesb-studio-se by Talend.

the class OpenRuntimeInfoAction method run.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.jface.action.Action#run()
     */
@Override
public void run() {
    MBeanServerConnection mbsc;
    try {
        mbsc = JMXUtil.createJMXconnection();
        List<Map<String, String>> list = new ArrayList<Map<String, String>>();
        //$NON-NLS-1$
        String JOB_MBEAN = "TalendAgent:type=O.S. Informations";
        ObjectName objectJob = new ObjectName(JOB_MBEAN);
        MBeanInfo info = mbsc.getMBeanInfo(objectJob);
        MBeanAttributeInfo[] attrInfo = info.getAttributes();
        for (int i = 0; i < attrInfo.length; i++) {
            try {
                Map<String, String> attributeMap = new HashMap<String, String>();
                String attributeName = attrInfo[i].getName();
                //$NON-NLS-1$
                attributeMap.put("name", attributeName);
                String attributeDesc = attrInfo[i].getType();
                //$NON-NLS-1$
                attributeMap.put("desc", attributeDesc);
                String attributeValue = mbsc.getAttribute(objectJob, attributeName).toString();
                attributeMap.put(attributeName, attributeValue);
                //$NON-NLS-1$
                attributeMap.put("value", attributeValue);
                list.add(attributeMap);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        RuntimeInfoDialog dlg = new RuntimeInfoDialog(list);
        dlg.open();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : MBeanInfo(javax.management.MBeanInfo) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) MBeanAttributeInfo(javax.management.MBeanAttributeInfo) ObjectName(javax.management.ObjectName) RuntimeInfoDialog(org.talend.designer.esb.runcontainer.ui.dialog.RuntimeInfoDialog) HashMap(java.util.HashMap) Map(java.util.Map) MBeanServerConnection(javax.management.MBeanServerConnection)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 MBeanAttributeInfo (javax.management.MBeanAttributeInfo)1 MBeanInfo (javax.management.MBeanInfo)1 MBeanServerConnection (javax.management.MBeanServerConnection)1 ObjectName (javax.management.ObjectName)1 RuntimeInfoDialog (org.talend.designer.esb.runcontainer.ui.dialog.RuntimeInfoDialog)1