Search in sources :

Example 26 with TabularDataSupport

use of javax.management.openmbean.TabularDataSupport in project geode by apache.

the class TableConverter method toNonNullOpenValue.

Object toNonNullOpenValue(Object value) throws OpenDataException {
    final Map<Object, Object> valueMap = (Map<Object, Object>) value;
    if (valueMap instanceof SortedMap) {
        Comparator comparator = ((SortedMap) valueMap).comparator();
        if (comparator != null) {
            final String msg = "Cannot convert SortedMap with non-null comparator: " + comparator;
            IllegalArgumentException iae = new IllegalArgumentException(msg);
            OpenDataException ode = new OpenDataException(msg);
            ode.initCause(iae);
            throw ode;
        }
    }
    final TabularType tabularType = (TabularType) getOpenType();
    final TabularData table = new TabularDataSupport(tabularType);
    final CompositeType rowType = tabularType.getRowType();
    for (Map.Entry entry : valueMap.entrySet()) {
        final Object openKey = keyConverter.toOpenValue(entry.getKey());
        final Object openValue = valueConverter.toOpenValue(entry.getValue());
        final CompositeData row;
        row = new CompositeDataSupport(rowType, keyValueArray, new Object[] { openKey, openValue });
        table.put(row);
    }
    return table;
}
Also used : TabularType(javax.management.openmbean.TabularType) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) Comparator(java.util.Comparator) TabularData(javax.management.openmbean.TabularData) OpenDataException(javax.management.openmbean.OpenDataException) TabularDataSupport(javax.management.openmbean.TabularDataSupport) SortedMap(java.util.SortedMap) Map(java.util.Map) SortedMap(java.util.SortedMap) CompositeType(javax.management.openmbean.CompositeType)

Example 27 with TabularDataSupport

use of javax.management.openmbean.TabularDataSupport in project jackrabbit-oak by apache.

the class BlobGC method getGlobalMarkStats.

@Override
public TabularData getGlobalMarkStats() {
    TabularDataSupport tds;
    try {
        TabularType tt = new TabularType(BlobGC.class.getName(), "Garbage collection global mark phase Stats", TYPE, new String[] { "repositoryId" });
        tds = new TabularDataSupport(tt);
        List<GarbageCollectionRepoStats> stats = blobGarbageCollector.getStats();
        for (GarbageCollectionRepoStats stat : stats) {
            tds.put(toCompositeData(stat));
        }
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
    return tds;
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) TabularType(javax.management.openmbean.TabularType) OpenDataException(javax.management.openmbean.OpenDataException)

Example 28 with TabularDataSupport

use of javax.management.openmbean.TabularDataSupport in project jackrabbit-oak by apache.

the class ConsolidatedListenerMBeanImpl method getObserversStats.

@Override
public TabularData getObserversStats() {
    TabularDataSupport tds;
    try {
        int id = 0;
        TabularType tt = new TabularType(ObserverStatsData.class.getName(), "Consolidated Observer Stats", ObserverStatsData.TYPE, new String[] { "index" });
        tds = new TabularDataSupport(tt);
        for (BackgroundObserverMBean o : collectNonJcrObservers()) {
            tds.put(new ObserverStatsData(++id, o).toCompositeData());
        }
    } catch (OpenDataException e) {
        throw new IllegalStateException(e);
    }
    return tds;
}
Also used : OpenDataException(javax.management.openmbean.OpenDataException) TabularDataSupport(javax.management.openmbean.TabularDataSupport) TabularType(javax.management.openmbean.TabularType) BackgroundObserverMBean(org.apache.jackrabbit.oak.spi.commit.BackgroundObserverMBean)

Example 29 with TabularDataSupport

use of javax.management.openmbean.TabularDataSupport in project jackrabbit-oak by apache.

the class IndexCopier method getIndexPathMapping.

//~------------------------------------------< CopyOnReadStatsMBean >
@Override
public TabularData getIndexPathMapping() {
    TabularDataSupport tds;
    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;
}
Also used : OpenDataException(javax.management.openmbean.OpenDataException) TabularDataSupport(javax.management.openmbean.TabularDataSupport) TabularType(javax.management.openmbean.TabularType) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) LocalIndexDir(org.apache.jackrabbit.oak.plugins.index.lucene.directory.LocalIndexDir) IOException(java.io.IOException)

Example 30 with TabularDataSupport

use of javax.management.openmbean.TabularDataSupport in project jackrabbit-oak by apache.

the class LuceneIndexMBeanImpl method getIndexStats.

@Override
public TabularData getIndexStats() throws IOException {
    TabularDataSupport tds;
    try {
        TabularType tt = new TabularType(LuceneIndexMBeanImpl.class.getName(), "Lucene Index Stats", IndexStats.TYPE, new String[] { "path" });
        tds = new TabularDataSupport(tt);
        Set<String> indexes = indexTracker.getIndexNodePaths();
        for (String path : indexes) {
            IndexNode indexNode = null;
            try {
                indexNode = indexTracker.acquireIndexNode(path);
                if (indexNode != null) {
                    IndexStats stats = new IndexStats(path, indexNode);
                    tds.put(stats.toCompositeData());
                }
            } finally {
                if (indexNode != null) {
                    indexNode.release();
                }
            }
        }
    } catch (OpenDataException e) {
        throw new IllegalStateException(e);
    }
    return tds;
}
Also used : OpenDataException(javax.management.openmbean.OpenDataException) TabularDataSupport(javax.management.openmbean.TabularDataSupport) TabularType(javax.management.openmbean.TabularType)

Aggregations

TabularDataSupport (javax.management.openmbean.TabularDataSupport)103 TabularData (javax.management.openmbean.TabularData)67 CompositeDataSupport (javax.management.openmbean.CompositeDataSupport)60 CompositeData (javax.management.openmbean.CompositeData)51 CompositeType (javax.management.openmbean.CompositeType)50 TabularType (javax.management.openmbean.TabularType)36 Map (java.util.Map)27 OpenDataException (javax.management.openmbean.OpenDataException)24 HashMap (java.util.HashMap)11 Bundle (org.osgi.framework.Bundle)10 IOException (java.io.IOException)7 ObjectName (javax.management.ObjectName)7 OpenType (javax.management.openmbean.OpenType)7 EndpointUtilizationStatistics (org.apache.camel.spi.EndpointUtilizationStatistics)7 Test (org.junit.Test)6 ConcurrentMap (java.util.concurrent.ConcurrentMap)5 MBeanException (javax.management.MBeanException)5 NotCompliantMBeanException (javax.management.NotCompliantMBeanException)5 ArrayList (java.util.ArrayList)4 Dictionary (java.util.Dictionary)4