Search in sources :

Example 11 with OpenDataException

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

the class CompositeConverter method toNonNullOpenValue.

/**
   * Converts to open value
   */
Object toNonNullOpenValue(Object value) throws OpenDataException {
    CompositeType ct = (CompositeType) getOpenType();
    if (value instanceof CompositeDataView)
        return ((CompositeDataView) value).toCompositeData(ct);
    if (value == null)
        return null;
    Object[] values = new Object[getters.length];
    for (int i = 0; i < getters.length; i++) {
        try {
            Object got = getters[i].invoke(value, (Object[]) null);
            values[i] = getterConverters[i].toOpenValue(got);
        } catch (Exception e) {
            throw openDataException("Error calling getter for " + itemNames[i] + ": " + e, e);
        }
    }
    return new CompositeDataSupport(ct, itemNames, values);
}
Also used : CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) CompositeDataView(javax.management.openmbean.CompositeDataView) OpenDataException(javax.management.openmbean.OpenDataException) InvalidObjectException(java.io.InvalidObjectException) CompositeType(javax.management.openmbean.CompositeType)

Example 12 with OpenDataException

use of javax.management.openmbean.OpenDataException 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 13 with OpenDataException

use of javax.management.openmbean.OpenDataException 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 14 with OpenDataException

use of javax.management.openmbean.OpenDataException 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)

Example 15 with OpenDataException

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

the class LuceneIndexMBeanImpl method getBadPersistedIndexStats.

@Override
public TabularData getBadPersistedIndexStats() {
    TabularDataSupport tds;
    try {
        TabularType tt = new TabularType(LuceneIndexMBeanImpl.class.getName(), "Lucene Bad Persisted Index Stats", BadIndexStats.TYPE, new String[] { "path" });
        tds = new TabularDataSupport(tt);
        Set<String> indexes = indexTracker.getBadIndexTracker().getBadPersistedIndexPaths();
        for (String path : indexes) {
            BadIndexInfo info = indexTracker.getBadIndexTracker().getPersistedIndexInfo(path);
            if (info != null) {
                BadIndexStats stats = new BadIndexStats(info);
                tds.put(stats.toCompositeData());
            }
        }
    } catch (OpenDataException e) {
        throw new IllegalStateException(e);
    }
    return tds;
}
Also used : BadIndexInfo(org.apache.jackrabbit.oak.plugins.index.lucene.BadIndexTracker.BadIndexInfo) OpenDataException(javax.management.openmbean.OpenDataException) TabularDataSupport(javax.management.openmbean.TabularDataSupport) TabularType(javax.management.openmbean.TabularType)

Aggregations

OpenDataException (javax.management.openmbean.OpenDataException)51 CompositeDataSupport (javax.management.openmbean.CompositeDataSupport)24 TabularDataSupport (javax.management.openmbean.TabularDataSupport)22 TabularType (javax.management.openmbean.TabularType)22 CompositeType (javax.management.openmbean.CompositeType)21 CompositeData (javax.management.openmbean.CompositeData)17 OpenType (javax.management.openmbean.OpenType)15 ObjectName (javax.management.ObjectName)8 HashMap (java.util.HashMap)6 Map (java.util.Map)5 MBeanServer (javax.management.MBeanServer)5 TabularData (javax.management.openmbean.TabularData)5 ArrayType (javax.management.openmbean.ArrayType)4 InvalidObjectException (java.io.InvalidObjectException)3 SortedMap (java.util.SortedMap)3 JMException (javax.management.JMException)3 StandardMBean (javax.management.StandardMBean)3 IOException (java.io.IOException)2 GenericArrayType (java.lang.reflect.GenericArrayType)2 Method (java.lang.reflect.Method)2