當前位置: 首頁>>代碼示例>>Java>>正文


Java CompositeDataSupport.getCompositeType方法代碼示例

本文整理匯總了Java中javax.management.openmbean.CompositeDataSupport.getCompositeType方法的典型用法代碼示例。如果您正苦於以下問題:Java CompositeDataSupport.getCompositeType方法的具體用法?Java CompositeDataSupport.getCompositeType怎麽用?Java CompositeDataSupport.getCompositeType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.management.openmbean.CompositeDataSupport的用法示例。


在下文中一共展示了CompositeDataSupport.getCompositeType方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mapAttribute

import javax.management.openmbean.CompositeDataSupport; //導入方法依賴的package包/類
@Override
public Optional<Map<String, Object>> mapAttribute(final Object value) {
    if (value == null) {
        return Optional.absent();
    }

    Util.checkType(value, CompositeDataSupport.class);

    CompositeDataSupport compositeData = (CompositeDataSupport) value;
    CompositeType currentType = compositeData.getCompositeType();
    CompositeType expectedType = getOpenType();

    Set<String> expectedCompositeTypeKeys = expectedType.keySet();
    Set<String> currentCompositeTypeKeys = currentType.keySet();
    Preconditions.checkArgument(expectedCompositeTypeKeys.equals(currentCompositeTypeKeys),
            "Composite type mismatch, expected composite type with attributes " + expectedCompositeTypeKeys
                    + " but was " + currentCompositeTypeKeys);

    Map<String, Object> retVal = Maps.newHashMap();

    for (String jmxName : jmxToJavaNameMapping.keySet()) {
        Optional<?> mapped = mapInnerAttribute(compositeData, jmxName, expectedType.getDescription(jmxName));
        if (mapped.isPresent()) {
            retVal.put(jmxToJavaNameMapping.get(jmxName), mapped.get());
        }
    }

    return Optional.of(retVal);
}
 
開發者ID:hashsdn,項目名稱:hashsdn-controller,代碼行數:30,代碼來源:CompositeAttributeMappingStrategy.java

示例2: report

import javax.management.openmbean.CompositeDataSupport; //導入方法依賴的package包/類
private void report(final CompositeDataSupport data, final PrintStream out) {
    CompositeType type = data.getCompositeType();
    out.print(',');
    for (Iterator it = type.keySet().iterator(); it.hasNext();) {
        String key = (String) it.next();
        if (data.containsKey(key))
            out.print(key + '=' + data.get(key));
        if (it.hasNext())
            out.print(';');
    }
}
 
開發者ID:ziccardi,項目名稱:jnrpe,代碼行數:12,代碼來源:JMXQuery.java

示例3: writeJmx

import javax.management.openmbean.CompositeDataSupport; //導入方法依賴的package包/類
/**
 * Write to JMX.
 *
 * @param type
 *            the type
 * @param key
 *            the key
 * @param value
 *            the value
 * @throws AttributeNotFoundException
 *             the attribute not found exception
 * @throws MBeanException
 *             the MBean exception
 * @throws ReflectionException
 *             the reflection exception
 * @throws InvalidAttributeValueException
 *             the invalid attribute value exception
 * @throws OpenDataException
 *             the open data exception
 */
private void writeJmx(String type, String key, long value) throws AttributeNotFoundException, MBeanException,
		ReflectionException, InvalidAttributeValueException, OpenDataException {
	final CompositeDataSupport composite = (CompositeDataSupport) reporter.getAttribute(type);
	final CompositeType compositeType = composite.getCompositeType();
	final String[] keys = composite.getCompositeType().keySet().toArray(new String[] {});
	final HashMap<String, Object> map = new HashMap<>();
	for (String k : keys) {
		if (k == key) {
			map.put(k, value);
		} else {
			map.put(k, composite.get(k));
		}
	}
	reporter.setAttribute(new Attribute(type, new CompositeDataSupport(compositeType, map)));
}
 
開發者ID:mevdschee,項目名稱:tqdev-metrics,代碼行數:36,代碼來源:JmxReporterTest.java

示例4: coreCompositeTypeToJMSCompositeType

import javax.management.openmbean.CompositeDataSupport; //導入方法依賴的package包/類
public static CompositeData coreCompositeTypeToJMSCompositeType(CompositeDataSupport data) throws Exception {
   CompositeData jmsdata = new CompositeDataSupport(data.getCompositeType(), new HashMap<String, Object>());
   return jmsdata;
}
 
開發者ID:apache,項目名稱:activemq-artemis,代碼行數:5,代碼來源:ActiveMQMessage.java


注:本文中的javax.management.openmbean.CompositeDataSupport.getCompositeType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。