Example usage for javax.management.openmbean TabularDataSupport TabularDataSupport

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

Introduction

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

Prototype

public TabularDataSupport(TabularType tabularType) 

Source Link

Document

Creates an empty TabularDataSupport instance whose open-type is tabularType, and whose underlying HashMap has a default initial capacity (101) and default load factor (0.75).

Usage

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

@Test(expectedExceptions = ValueFaultHandler.AttributeFilteredException.class)
public void noMatchWithWildcardPattern()
        throws OpenDataException, MalformedObjectNameException, AttributeNotFoundException {
    TabularTypeAndJson taj = new TabularTypeAndJson(new String[] { "oName" },
            new CompositeTypeAndJson(OBJECTNAME, "oName", null));

    TabularData data = new TabularDataSupport(taj.getType());
    data.put(new CompositeDataSupport(taj.getType().getRowType(), new String[] { "oName" },
            new Object[] { new ObjectName("test:type=bundle") }));

    extract(true, data, null, "oName2");
}

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

@Test(expectedExceptions = IllegalArgumentException.class, expectedExceptionsMessageRegExp = ".*Boolean.*")
void extractTabularDataWithPathButWrongIndexType() throws OpenDataException, AttributeNotFoundException {
    TabularTypeAndJson taj = new TabularTypeAndJson(new String[] { "verein", "absteiger" },
            new CompositeTypeAndJson(STRING, "verein", null, INTEGER, "platz", null, BOOLEAN, "absteiger",
                    null));/*from   www  .  ja va2  s. c  om*/
    TabularData data = new TabularDataSupport(taj.getType());
    data.put(new CompositeDataSupport(taj.getType().getRowType(),
            new String[] { "verein", "platz", "absteiger" }, new Object[] { "fcn", 6, false }));
    extract(true, data, "fcn", "true");
}

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);/*w  ww  . jav a  2  s . c  o m*/
    assertEquals(result.size(), 0);
}

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

private TabularData getComplexTabularData() throws OpenDataException {
    CompositeTypeAndJson ctj = new CompositeTypeAndJson(STRING, "name", null, STRING, "firstname", null,
            INTEGER, "age", null, BOOLEAN, "male", null);
    TabularTypeAndJson taj = new TabularTypeAndJson(new String[] { "name", "firstname" }, ctj);
    TabularData data = new TabularDataSupport(taj.getType());
    data.put(new CompositeDataSupport(ctj.getType(), new String[] { "name", "firstname", "age", "male" },
            new Object[] { "meyer", "xaver", 12, true }));
    data.put(new CompositeDataSupport(ctj.getType(), new String[] { "name", "firstname", "age", "male" },
            new Object[] { "meyer", "zensi", 28, false }));
    data.put(new CompositeDataSupport(ctj.getType(), new String[] { "name", "firstname", "age", "male" },
            new Object[] { "huber", "erna", 18, false }));
    return data;//from   ww  w  .  j a v a  2s . co m
}

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

private TabularData getMapTabularData(OpenType keyType, Object... keyAndValues) throws OpenDataException {
    CompositeTypeAndJson ctj = new CompositeTypeAndJson(keyType, "key", null, STRING, "value", null);

    TabularTypeAndJson taj = new TabularTypeAndJson(new String[] { "key" }, ctj);
    TabularData data = new TabularDataSupport(taj.getType());

    for (int i = 0; i < keyAndValues.length; i += 2) {
        CompositeData cd = new CompositeDataSupport(ctj.getType(), new String[] { "key", "value" },
                new Object[] { keyAndValues[i], keyAndValues[i + 1] });
        data.put(cd);//from w  w  w. j a  v  a2  s .  c  o m
    }
    return data;
}

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));
    }// ww w .j  a  v a2  s  . c  o  m

    return tabularData;
}

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

@Override
public TabularData getRegisteredHttpCacheConfigs() throws OpenDataException {
    // @formatter:off
    // Exposing all google guava stats.
    final CompositeType cacheEntryType = new CompositeType(JMX_PN_HTTPCACHE_CONFIG, JMX_PN_HTTPCACHE_CONFIG,
            new String[] { JMX_PN_ORDER, JMX_PN_OSGICOMPONENT },
            new String[] { JMX_PN_ORDER, JMX_PN_OSGICOMPONENT },
            new OpenType[] { SimpleType.INTEGER, SimpleType.STRING });

    final TabularDataSupport tabularData = new TabularDataSupport(new TabularType(JMX_PN_HTTPCACHE_CONFIGS,
            JMX_PN_HTTPCACHE_CONFIGS, cacheEntryType, new String[] { JMX_PN_OSGICOMPONENT }));

    // @formatter:on

    for (HttpCacheConfig cacheConfig : this.cacheConfigs) {
        final Map<String, Object> row = new HashMap<String, Object>();

        Map<String, Object> osgiConfig = cacheConfigConfigs.get(cacheConfig);

        row.put(JMX_PN_ORDER, cacheConfig.getOrder());
        row.put(JMX_PN_OSGICOMPONENT, (String) osgiConfig.get(Constants.SERVICE_PID));

        tabularData.put(new CompositeDataSupport(cacheEntryType, row));
    }/*from w w  w .  j  a  va2 s .c  o m*/

    return tabularData;
}

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

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

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

    Enumeration<String> storeNames = cacheStoresMap.keys();
    while (storeNames.hasMoreElements()) {
        final String storeName = storeNames.nextElement();
        final Map<String, Object> row = new HashMap<String, Object>();

        row.put(JMX_PN_HTTPCACHE_STORE, storeName);
        tabularData.put(new CompositeDataSupport(cacheEntryType, row));
    }/*from   www.ja v  a  2  s .com*/

    return tabularData;
}

From source file:org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier.java

@Override
public TabularData getIndexPathMapping() {
    TabularDataSupport tds;// w  w  w .j  a v  a  2s .c o m
    try {
        TabularType tt = new TabularType(IndexMappingData.class.getName(), "Lucene Index Stats",
                IndexMappingData.TYPE, new String[] { "jcrPath" });
        tds = new TabularDataSupport(tt);
        for (LocalIndexDir indexDir : indexRootDirectory.getAllLocalIndexes()) {
            String size = humanReadableByteCount(indexDir.size());
            tds.put(new CompositeDataSupport(IndexMappingData.TYPE, IndexMappingData.FIELD_NAMES,
                    new String[] { indexDir.getJcrPath(), indexDir.getFSPath(), size }));
        }
    } catch (OpenDataException e) {
        throw new IllegalStateException(e);
    } catch (IOException e) {
        throw new IllegalStateException(e);
    }
    return tds;
}

From source file:com.cyberway.issue.crawler.Heritrix.java

protected TabularData makeJobsTabularData(List jobs) throws OpenDataException {
    if (jobs == null || jobs.size() == 0) {
        return null;
    }//from  w ww  .j a  v a 2 s.co m
    TabularData td = new TabularDataSupport(this.jobsTabularType);
    for (Iterator i = jobs.iterator(); i.hasNext();) {
        CrawlJob job = (CrawlJob) i.next();
        CompositeData cd = new CompositeDataSupport(this.jobCompositeType, JOB_KEYS,
                new String[] { job.getUID(), job.getJobName(), job.getStatus() });
        td.put(cd);
    }
    return td;
}