use of javax.management.openmbean.TabularData in project jdk8u_jdk by JetBrains.
the class TabularDataOrderTest method makeTable.
private static TabularData makeTable() throws OpenDataException {
TabularData td = new TabularDataSupport(tt);
for (Map.Entry<String, Integer> entry : stringToValue.entrySet()) {
CompositeData cd = new CompositeDataSupport(ct, new String[] { "name", "int" }, new Object[] { entry.getKey(), entry.getValue() });
td.put(cd);
}
return td;
}
use of javax.management.openmbean.TabularData in project jdk8u_jdk by JetBrains.
the class ValidateOpenTypes method checkMap.
private static void checkMap() throws Exception {
// Add new system properties
System.setProperty(KEY1, VALUE1);
System.setProperty(KEY2, VALUE2);
TabularData props1 = (TabularData) server.getAttribute(runtime, "SystemProperties");
String value1 = getProperty(props1, KEY1);
if (value1 == null || !value1.equals(VALUE1)) {
throw new RuntimeException("TEST FAILED: " + KEY1 + " property found" + " with value = " + value1 + " but expected to be " + VALUE1);
}
String value2 = getProperty(props1, KEY2);
if (value2 == null || !value2.equals(VALUE2)) {
throw new RuntimeException("TEST FAILED: " + KEY2 + " property found" + " with value = " + value2 + " but expected to be " + VALUE2);
}
String value3 = getProperty(props1, KEY3);
if (value3 != null) {
throw new RuntimeException("TEST FAILED: " + KEY3 + " property found" + " but should not exist");
}
}
use of javax.management.openmbean.TabularData in project tdi-studio-se by Talend.
the class AttributeParser method refreshTabularData.
/**
* Refreshes the tabular data.
*
* @param node
* The attribute node
*/
private void refreshTabularData(AttributeNode node) {
List<AttributeNode> children = new ArrayList<AttributeNode>();
TabularData tabularData = (TabularData) node.getValue();
for (Object keyList : tabularData.keySet()) {
@SuppressWarnings("unchecked") Object[] keys = ((List<Object>) keyList).toArray(new Object[0]);
AttributeNode attribute = null;
for (AttributeNode child : node.getChildren()) {
if (child.getName().equals(String.valueOf(keys[0]))) {
attribute = child;
attribute.setValue(tabularData.get(keys));
break;
}
}
if (attribute == null) {
attribute = new AttributeNode(String.valueOf(keys[0]), node, tabularData.get(keys));
}
children.add(attribute);
}
node.removeChildren();
for (AttributeNode child : children) {
node.addChild(child);
refreshAttribute(child);
}
}
use of javax.management.openmbean.TabularData in project tdi-studio-se by Talend.
the class DumpHprofAction method getInitialFileName.
/**
* Gets the initial file name.
*
* @param jvm The active JVM
* @return The file name, or <tt>null</tt> if file name is specified
* @throws JvmCoreException
*/
String getInitialFileName(IActiveJvm jvm) throws JvmCoreException {
ObjectName objectName;
try {
objectName = new ObjectName(ManagementFactory.RUNTIME_MXBEAN_NAME);
} catch (MalformedObjectNameException e) {
throw new JvmCoreException(IStatus.ERROR, e.getMessage(), e);
} catch (NullPointerException e) {
throw new JvmCoreException(IStatus.ERROR, e.getMessage(), e);
}
//$NON-NLS-1$
TabularData initialName = (TabularData) jvm.getMBeanServer().getAttribute(objectName, "SystemProperties");
//$NON-NLS-1$
CompositeData compisiteData = initialName.get(new Object[] { "user.home" });
String home = compisiteData.values().toArray(new String[0])[1];
StringBuffer initialFileName = new StringBuffer(home);
initialFileName.append(File.separator).append(new Date().getTime()).append('.').append(SnapshotType.Hprof.getExtension());
return initialFileName.toString();
}
use of javax.management.openmbean.TabularData in project tdi-studio-se by Talend.
the class AttributeContentProvider method addAttributeItems.
/**
* Adds the attribute to the given list.
*
* @param parent The parent attribute
* @param value The value
*/
private void addAttributeItems(AttributeNode parent, Object value) {
if (value instanceof CompositeData) {
CompositeData compositeData = (CompositeData) value;
CompositeType type = compositeData.getCompositeType();
for (String key : type.keySet()) {
AttributeNode attribute = new AttributeNode(key, parent);
parent.addChild(attribute);
addAttributeItems(attribute, compositeData.get(key));
}
} else if (value instanceof TabularData) {
TabularData tabularData = (TabularData) value;
for (Object keyList : tabularData.keySet()) {
@SuppressWarnings("unchecked") Object[] keys = ((List<Object>) keyList).toArray(new Object[0]);
AttributeNode attribute = new AttributeNode(String.valueOf(keys[0]), parent);
parent.addChild(attribute);
addAttributeItems(attribute, tabularData.get(keys));
}
} else if (value instanceof Long || value instanceof Integer || value instanceof Double) {
parent.setRgb(getRGB(parent.getQualifiedName()));
parent.setValidLeaf(true);
}
}
Aggregations