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


Java TabularType類代碼示例

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


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

示例1: getCacheContents

import javax.management.openmbean.TabularType; //導入依賴的package包/類
@Override
public final TabularData getCacheContents() throws OpenDataException {
    final CompositeType cacheEntryType = getCacheEntryType();

    final TabularDataSupport tabularData = new TabularDataSupport(
            new TabularType("Cache Entries", "Cache Entries", cacheEntryType, new String[] { "Cache Key" }));

    ConcurrentMap<K, V> cacheAsMap = getCache().asMap();
    for (final Map.Entry<K, V> entry : cacheAsMap.entrySet()) {
        final Map<String, Object> data = new HashMap<String, Object>();
        data.put("Cache Key", entry.getKey().toString());

        V cacheObj = entry.getValue();
        if (cacheObj != null) {
            addCacheData(data, cacheObj);
        }

        tabularData.put(new CompositeDataSupport(cacheEntryType, data));
    }

    return tabularData;
}
 
開發者ID:Adobe-Consulting-Services,項目名稱:acs-aem-commons,代碼行數:23,代碼來源:AbstractGuavaCacheMBean.java

示例2: makeTabularMapping

import javax.management.openmbean.TabularType; //導入依賴的package包/類
private MXBeanMapping
    makeTabularMapping(Type objType, boolean sortedMap,
                       Type keyType, Type valueType,
                       MXBeanMappingFactory factory)
        throws OpenDataException {

    final String objTypeName = typeName(objType);
    final MXBeanMapping keyMapping = factory.mappingForType(keyType, factory);
    final MXBeanMapping valueMapping = factory.mappingForType(valueType, factory);
    final OpenType<?> keyOpenType = keyMapping.getOpenType();
    final OpenType<?> valueOpenType = valueMapping.getOpenType();
    final CompositeType rowType =
        new CompositeType(objTypeName,
                          objTypeName,
                          keyValueArray,
                          keyValueArray,
                          new OpenType<?>[] {keyOpenType, valueOpenType});
    final TabularType tabularType =
        new TabularType(objTypeName, objTypeName, rowType, keyArray);
    return new TabularMapping(objType, sortedMap, tabularType,
                                keyMapping, valueMapping);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:23,代碼來源:DefaultMXBeanMappingFactory.java

示例3: addOpenAttribute

import javax.management.openmbean.TabularType; //導入依賴的package包/類
protected void addOpenAttribute(String csDescription, Class cls, String csMethodName, TabularType tabularType)
{
	Method methodGet = MethodFinder.getMethod(cls, "get"+csMethodName);
	boolean bCanGet = true;
	if(methodGet == null)
		bCanGet = false;
	Method methodSet = MethodFinder.getMethod(cls, "set"+csMethodName, CompositeData.class);
	boolean bCanSet = true;
	if(methodSet == null)
		bCanSet = false;

	OpenMBeanAttributeInfoSupport attrOpen = new OpenMBeanAttributeInfoSupport(csMethodName, csDescription, tabularType, bCanGet, bCanSet, false); 
	OpenMBeanAttributeInfoWrapper attr = new OpenMBeanAttributeInfoWrapper(csMethodName, csDescription, attrOpen, methodGet, methodSet);
	
	if(m_arrOpenMBeanAttributeInfosWrapper == null)
		m_arrOpenMBeanAttributeInfosWrapper = new ArrayList<OpenMBeanAttributeInfoWrapper>();
	m_arrOpenMBeanAttributeInfosWrapper.add(attr);
}
 
開發者ID:costea7,項目名稱:ChronoBike,代碼行數:19,代碼來源:BaseOpenMBean.java

示例4: isTypeMatched

import javax.management.openmbean.TabularType; //導入依賴的package包/類
private static boolean isTypeMatched(OpenType<?> ot1, OpenType<?> ot2) {
    if (ot1 instanceof CompositeType) {
        if (! (ot2 instanceof CompositeType))
            return false;
        if (!isTypeMatched((CompositeType) ot1, (CompositeType) ot2))
            return false;
    } else if (ot1 instanceof TabularType) {
        if (! (ot2 instanceof TabularType))
            return false;
        if (!isTypeMatched((TabularType) ot1, (TabularType) ot2))
            return false;
    } else if (ot1 instanceof ArrayType) {
        if (! (ot2 instanceof ArrayType))
            return false;
        if (!isTypeMatched((ArrayType<?>) ot1, (ArrayType<?>) ot2)) {
            return false;
        }
    } else if (!ot1.equals(ot2)) {
        return false;
    }
    return true;
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:23,代碼來源:LazyCompositeData.java

示例5: compareTabularType

import javax.management.openmbean.TabularType; //導入依賴的package包/類
private static void compareTabularType(TabularType t1, TabularType t2) {
    if (t1.equals(t2)) {
        System.out.println("same tabular type");
        return;
    }
    if (t1.getClassName().equals(t2.getClassName()))
        System.out.println("same class name");
    if (t1.getDescription().equals(t2.getDescription()))
        System.out.println("same description");
    else {
        System.out.println("t1 description: " + t1.getDescription());
        System.out.println("t2 description: " + t2.getDescription());
    }
    if (t1.getIndexNames().equals(t2.getIndexNames()))
        System.out.println("same index names");
    if (t1.getRowType().equals(t2.getRowType()))
        System.out.println("same row type");
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:19,代碼來源:MXBeanTest.java

示例6: APIStatisticsOpenMBean

import javax.management.openmbean.TabularType; //導入依賴的package包/類
public APIStatisticsOpenMBean(APIStatistics apiStatistics) {
    API_STATISTICS = apiStatistics;

    try {
        METHOD_STATS_TYPE =
                new CompositeType("method statistics", "method statistics",
                        ITEM_NAMES, ITEM_DESCRIPTIONS, ITEM_TYPES);

        String[] index = {"methodName"};
        API_STATISTICS_TYPE = new TabularType("API statistics",
                "list of methods",
                METHOD_STATS_TYPE,
                index);
    } catch (OpenDataException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:DiscourseDB,項目名稱:discoursedb-core,代碼行數:18,代碼來源:APIStatisticsOpenMBean.java

示例7: getPhiValues

import javax.management.openmbean.TabularType; //導入依賴的package包/類
@Override
public TabularData getPhiValues() throws OpenDataException {
    final CompositeType ct = new CompositeType("Node", "Node", new String[] { "Endpoint", "PHI" },
            new String[] { "IP of the endpoint", "PHI value" },
            new OpenType[] { SimpleType.STRING, SimpleType.DOUBLE });
    final TabularDataSupport results = new TabularDataSupport(
            new TabularType("PhiList", "PhiList", ct, new String[] { "Endpoint" }));
    final JsonArray arr = client.getJsonArray("/failure_detector/endpoint_phi_values");

    for (JsonValue v : arr) {
        JsonObject o = (JsonObject) v;
        String endpoint = o.getString("endpoint");
        double phi = Double.parseDouble(o.getString("phi"));

        if (phi != Double.MIN_VALUE) {
            // returned values are scaled by PHI_FACTOR so that the are on
            // the same scale as PhiConvictThreshold
            final CompositeData data = new CompositeDataSupport(ct, new String[] { "Endpoint", "PHI" },
                    new Object[] { endpoint, phi * PHI_FACTOR });
            results.put(data);
        }
    }

    return results;
}
 
開發者ID:scylladb,項目名稱:scylla-jmx,代碼行數:26,代碼來源:FailureDetector.java

示例8: apply

import javax.management.openmbean.TabularType; //導入依賴的package包/類
@Override
public TabularData apply(InProgressSnapshot from) {
    List<OpenType<?>> types = Lists.transform(from.getColumnClasses(), CLASS_TO_OPENTYPE);

    CompositeType rowType;
    try {
        int columnCount = from.getColumnCount();
        rowType = new CompositeType("Snapshot row", "Snapshot row", from.getColumnNames()
                .toArray(new String[columnCount]), from.getColumnDescriptions().toArray(
                new String[columnCount]), types.toArray(new OpenType<?>[columnCount]));
        TabularType type = new TabularType("Snapshot", "Snapshot", rowType,
                new String[] { "Thread name" });
        TabularData data = new TabularDataSupport(type);

        for (Map<String, Object> dataRow : from.getValues()) {
            CompositeData row = new CompositeDataSupport(rowType, dataRow);
            data.put(row);
        }
        return data;
    } catch (OpenDataException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:performancecopilot,項目名稱:parfait,代碼行數:24,代碼來源:JmxInProgressMonitor.java

示例9: testSimpleTypeObject

import javax.management.openmbean.TabularType; //導入依賴的package包/類
@Test
public void testSimpleTypeObject() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.STRING);

    ModelNode node = new ModelNode();
    node.get("one").set(1L);
    node.get("two").set(2L);

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertEquals("1", tabularData.get(new Object[] {"one"}).get("value"));
    Assert.assertEquals("2", tabularData.get(new Object[] {"two"}).get("value"));

    Assert.assertEquals(node, converter.toModelNode(tabularData));

    //Allow plain map as well? Yeah why not!
    Map<String, String> map = new HashMap<String, String>();
    map.put("one", "1");
    map.put("two", "2");
    Assert.assertEquals(node, converter.toModelNode(map));
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:25,代碼來源:ExpressionTypeConverterUnitTestCase.java

示例10: testByteArrayObject

import javax.management.openmbean.TabularType; //導入依賴的package包/類
@Test
public void testByteArrayObject() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.BYTES);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, ArrayType.getPrimitiveArrayType(byte[].class));

    ModelNode node = new ModelNode();
    node.get("one").set(new byte[] {1,2});
    node.get("two").set(new byte[] {3,4});

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertTrue(Arrays.equals(new byte[] {1,2}, (byte[])tabularData.get(new Object[] {"one"}).get("value")));
    Assert.assertTrue(Arrays.equals(new byte[] {3,4}, (byte[])tabularData.get(new Object[] {"two"}).get("value")));

    //Allow plain map as well? Yeah why not!
    Map<String, byte[]> map = new HashMap<String, byte[]>();
    map.put("one", new byte[] {1,2});
    map.put("two", new byte[] {3,4});
    Assert.assertEquals(node, converter.toModelNode(map));
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:23,代碼來源:ExpressionTypeConverterUnitTestCase.java

示例11: testSimpleTypeObjectExpressions

import javax.management.openmbean.TabularType; //導入依賴的package包/類
@Test
public void testSimpleTypeObjectExpressions() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
    description.get(EXPRESSIONS_ALLOWED).set(true);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.STRING);

    ModelNode node = new ModelNode();
    node.get("one").set(new ValueExpression("${this.should.not.exist.!!!!!:1}"));
    node.get("two").set(new ValueExpression("${this.should.not.exist.!!!!!:2}"));

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertEquals("${this.should.not.exist.!!!!!:1}", tabularData.get(new Object[] {"one"}).get("value"));
    Assert.assertEquals("${this.should.not.exist.!!!!!:2}", tabularData.get(new Object[] {"two"}).get("value"));

    Assert.assertEquals(node, converter.toModelNode(tabularData));
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:20,代碼來源:ExpressionTypeConverterUnitTestCase.java

示例12: testSimpleTypeObjectEmpty

import javax.management.openmbean.TabularType; //導入依賴的package包/類
@Test
public void testSimpleTypeObjectEmpty() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.STRING);

    ModelNode node = new ModelNode();
    node.get("one").set("");
    node.get("two").set("");

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertNull(tabularData.get(new Object[] {"one"}).get("value"));
    Assert.assertNull(tabularData.get(new Object[] {"two"}).get("value"));

    ModelNode expected = new ModelNode();
    expected.get("one");
    expected.get("two");

    Assert.assertEquals(expected, converter.toModelNode(tabularData));
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:23,代碼來源:ExpressionTypeConverterUnitTestCase.java

示例13: testSimpleTypeObject

import javax.management.openmbean.TabularType; //導入依賴的package包/類
@Test
public void testSimpleTypeObject() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.LONG);

    ModelNode node = new ModelNode();
    node.get("one").set(1L);
    node.get("two").set(2L);

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertEquals((long) 1, tabularData.get(new Object[] {"one"}).get("value"));
    Assert.assertEquals((long) 2, tabularData.get(new Object[] {"two"}).get("value"));

    Assert.assertEquals(node, converter.toModelNode(tabularData));

    //Allow plain map as well? Yeah why not!
    Map<String, Long> map = new HashMap<String, Long>();
    map.put("one", 1L);
    map.put("two", 2L);
    Assert.assertEquals(node, converter.toModelNode(map));
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:25,代碼來源:LegacyTypeConverterUnitTestCase.java

示例14: testSimpleTypeObjectExpressions

import javax.management.openmbean.TabularType; //導入依賴的package包/類
@Test
public void testSimpleTypeObjectExpressions() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
    description.get(EXPRESSIONS_ALLOWED).set(true);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.LONG);

    ModelNode node = new ModelNode();
    node.get("one").set(new ValueExpression("${this.should.not.exist.!!!!!:1}"));
    node.get("two").set(new ValueExpression("${this.should.not.exist.!!!!!:2}"));

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertEquals((long) 1, tabularData.get(new Object[] {"one"}).get("value"));
    Assert.assertEquals((long) 2, tabularData.get(new Object[] {"two"}).get("value"));
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:18,代碼來源:LegacyTypeConverterUnitTestCase.java

示例15: testSimpleTypeObjectEmpty

import javax.management.openmbean.TabularType; //導入依賴的package包/類
@Test
public void testSimpleTypeObjectEmpty() throws Exception {
    ModelNode description = createDescription(ModelType.OBJECT, ModelType.LONG);
    TypeConverter converter = getConverter(description);

    assertMapType(assertCast(TabularType.class, converter.getOpenType()), SimpleType.STRING, SimpleType.LONG);

    ModelNode node = new ModelNode();
    node.get("one").set("");
    node.get("two").set("");

    TabularData tabularData = assertCast(TabularData.class, converter.fromModelNode(node));
    Assert.assertEquals(2, tabularData.size());
    Assert.assertNull(tabularData.get(new Object[] {"one"}).get("value"));
    Assert.assertNull(tabularData.get(new Object[] {"two"}).get("value"));

    ModelNode expected = new ModelNode();
    expected.get("one");
    expected.get("two");

    Assert.assertEquals(expected, converter.toModelNode(tabularData));
}
 
開發者ID:wildfly,項目名稱:wildfly-core,代碼行數:23,代碼來源:LegacyTypeConverterUnitTestCase.java


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