当前位置: 首页>>代码示例>>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;未经允许,请勿转载。