Example usage for javax.management.openmbean CompositeType CompositeType

List of usage examples for javax.management.openmbean CompositeType CompositeType

Introduction

In this page you can find the example usage for javax.management.openmbean CompositeType CompositeType.

Prototype

public CompositeType(String typeName, String description, String[] itemNames, String[] itemDescriptions,
        OpenType<?>[] itemTypes) throws OpenDataException 

Source Link

Document

Constructs a CompositeType instance, checking for the validity of the given parameters.

Usage

From source file:com.adobe.acs.commons.httpcache.store.mem.impl.MemHttpCacheStoreImpl.java

@Override
@SuppressWarnings("squid:S1192")
protected CompositeType getCacheEntryType() throws OpenDataException {
    return new CompositeType(JMX_PN_CACHEENTRY, JMX_PN_CACHEENTRY,
            new String[] { JMX_PN_CACHEKEY, JMX_PN_STATUS, JMX_PN_SIZE, JMX_PN_CONTENTTYPE, JMX_PN_CHARENCODING,
                    JMX_PN_HITS, JMX_PN_TOTALSIZESERVED },
            new String[] { JMX_PN_CACHEKEY, JMX_PN_STATUS, JMX_PN_SIZE, JMX_PN_CONTENTTYPE, JMX_PN_CHARENCODING,
                    JMX_PN_HITS, JMX_PN_TOTALSIZESERVED },
            new OpenType[] { SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING,
                    SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING });

}

From source file:com.seajas.search.profiler.service.management.ManagementService.java

/**
 * {@inheritDoc}/*from  w  ww .  j  a v  a 2 s  .  com*/
 */
@Override
public CompositeData getElementCacheCount() throws OpenDataException {
    Integer count = cacheService.getCacheCounts().get("elementCache");

    // Return the compound status as the number of messages

    CompositeType compositeType = new CompositeType("managementResult", "Management result",
            new String[] { "compound", "status" }, new String[] { "Compound value", "Textual representation" },
            new OpenType[] { SimpleType.INTEGER, SimpleType.STRING });

    return new CompositeDataSupport(compositeType, new String[] { "compound", "status" },
            new Object[] { count, "The queue cache contains " + count + " entries" });
}

From source file:com.seajas.search.profiler.service.management.ManagementService.java

/**
 * {@inheritDoc}//from   w  w  w  .j a  v a 2s  . co m
 */
@Override
public CompositeData getDeleteCacheCount() throws OpenDataException {
    Integer count = cacheService.getCacheCounts().get("deleteCache");

    // Return the compound status as the number of messages

    CompositeType compositeType = new CompositeType("managementResult", "Management result",
            new String[] { "compound", "status" }, new String[] { "Compound value", "Textual representation" },
            new OpenType[] { SimpleType.INTEGER, SimpleType.STRING });

    return new CompositeDataSupport(compositeType, new String[] { "compound", "status" },
            new Object[] { count, "The delete cache contains " + count + " entries" });
}

From source file:org.wso2.andes.server.information.management.QueueManagementInformationMBean.java

/**
 * {@inheritDoc}/*ww  w .j  a  va  2s  .  c  o m*/
 */
@Override
public CompositeData getMessageCountOfQueuesAsCompositeData() {
    CompositeDataSupport support;
    try {
        Map<String, java.lang.Integer> messageCounts = getAllQueueCounts();

        OpenType[] messageCountAttributeTypes = new OpenType[messageCounts.size()];
        String[] itemNames = messageCounts.keySet().toArray(new String[0]);
        String[] itemDescriptions = messageCounts.keySet().toArray(new String[0]);
        for (int count = 0; count < messageCounts.size(); count++) {
            messageCountAttributeTypes[count] = SimpleType.INTEGER;
        }
        CompositeType messageCountCompositeType = new CompositeType("Message Count of Queues",
                "Message count of queues", itemNames, itemDescriptions, messageCountAttributeTypes);
        support = new CompositeDataSupport(messageCountCompositeType, messageCounts);
    } catch (OpenDataException e) {
        log.error("Error in accessing retrieving message count information", e);
        throw new RuntimeException("Error in accessing retrieving message count information", e);
    }
    return support;
}

From source file:org.jolokia.converter.json.TabularDataExtractorTest.java

@Test
void emptyTabularData() throws MalformedObjectNameException, OpenDataException, AttributeNotFoundException {
    CompositeType type = new CompositeType("testType", "Type for testing", new String[] { "testKey" },
            new String[] { "bla" }, new OpenType[] { STRING });
    TabularData data = new TabularDataSupport(
            new TabularType("test", "test desc", type, new String[] { "testKey" }));
    JSONObject result = (JSONObject) extract(true, data);
    assertNotNull(result);/*ww w . j  a v  a2 s  . c  o  m*/
    assertEquals(result.size(), 0);
}

From source file:org.jolokia.converter.object.StringToOpenTypeConverterTest.java

@Test
public void multipleLevleTabularData() throws OpenDataException {
    JSONObject map = new JSONObject();
    JSONObject inner = new JSONObject();
    map.put("fcn", inner);
    JSONObject innerinner = new JSONObject();
    inner.put("franconia", innerinner);
    innerinner.put("verein", "fcn");
    innerinner.put("region", "franconia");
    innerinner.put("absteiger", false);

    TabularType type = new TabularType("soccer", "soccer",
            new CompositeType("row", "row", new String[] { "verein", "region", "absteiger" },
                    new String[] { "verein", "region", "absteiger" },
                    new OpenType[] { STRING, STRING, BOOLEAN }),
            new String[] { "verein", "region" });
    TabularData data = (TabularData) converter.convertToObject(type, map);
    CompositeData row = data.get(new Object[] { "fcn", "franconia" });
    assertNotNull(row);//from www . j a va  2  s  .  c  o m
    assertFalse((Boolean) row.get("absteiger"));
}

From source file:org.jolokia.converter.object.StringToOpenTypeConverterTest.java

private TabularType getSampleTabularTypeForComplexTabularData() throws OpenDataException {
    CompositeType keyType = new CompositeType("key", "key", new String[] { "name", "age" },
            new String[] { "name", "age" }, new OpenType[] { STRING, INTEGER });
    CompositeTypeAndJson ctj = new CompositeTypeAndJson(keyType, "user", null, STRING, "street", null,
            OBJECTNAME, "oname", null);
    return new TabularType("test", "test", ctj.getType(), new String[] { "user", "street" });
}

From source file:com.adobe.acs.commons.rewriter.impl.VersionedClientlibsTransformerFactory.java

@Override
@SuppressWarnings("squid:S1192")
protected CompositeType getCacheEntryType() throws OpenDataException {
    return new CompositeType(JMX_PN_CACHEENTRY, JMX_PN_CACHEENTRY, new String[] { JMX_PN_CACHEKEY, "Value" },
            new String[] { JMX_PN_CACHEKEY, "Value" }, new OpenType[] { SimpleType.STRING, SimpleType.STRING });
}

From source file:com.adobe.acs.commons.httpcache.store.jcr.impl.JCRHttpCacheStoreImpl.java

protected CompositeType getCacheEntryType() throws OpenDataException {
    return new CompositeType(JMX_PN_CACHEENTRY, JMX_PN_CACHEENTRY,
            new String[] { JMX_PN_CACHEKEY, JMX_PN_STATUS, JMX_PN_SIZE, JMX_PN_CONTENTTYPE,
                    JMX_PN_CHARENCODING },
            new String[] { JMX_PN_CACHEKEY, JMX_PN_STATUS, JMX_PN_SIZE, JMX_PN_CONTENTTYPE,
                    JMX_PN_CHARENCODING },
            new OpenType[] { SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING, SimpleType.STRING,
                    SimpleType.STRING });

}

From source file:com.adobe.acs.commons.httpcache.engine.impl.HttpCacheEngineImpl.java

@Override
public TabularData getRegisteredHttpCacheRules() throws OpenDataException {
    // @formatter:off
    final CompositeType cacheEntryType = new CompositeType(JMX_HTTPCACHE_HANDLING_RULE,
            JMX_HTTPCACHE_HANDLING_RULE, new String[] { JMX_HTTPCACHE_HANDLING_RULE },
            new String[] { JMX_HTTPCACHE_HANDLING_RULE }, new OpenType[] { SimpleType.STRING });

    final TabularDataSupport tabularData = new TabularDataSupport(
            new TabularType(JMX_PN_HTTPCACHE_HANDLING_RULES, JMX_PN_HTTPCACHE_HANDLING_RULES, cacheEntryType,
                    new String[] { JMX_HTTPCACHE_HANDLING_RULE }));
    // @formatter:on

    for (final Map.Entry<String, HttpCacheHandlingRule> entry : cacheHandlingRules.entrySet()) {
        final Map<String, Object> row = new HashMap<String, Object>();

        row.put(JMX_HTTPCACHE_HANDLING_RULE, entry.getValue().getClass().getName());
        tabularData.put(new CompositeDataSupport(cacheEntryType, row));
    }//w w  w  .j  a v  a2  s.  c  om

    return tabularData;
}