Search in sources :

Example 91 with TabularDataSupport

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

the class ConsolidatedListenerMBeanImpl method getLeaderBoard.

@Override
public TabularData getLeaderBoard() {
    TabularDataSupport tds;
    try {
        int id = 0;
        TabularType tt = new TabularType(LeaderBoardData.class.getName(), "Leaderboard", LeaderBoardData.TYPE, new String[] { "index" });
        tds = new TabularDataSupport(tt);
        List<LeaderBoardData> leaderBoard = Lists.newArrayList();
        for (Map.Entry<ObjectName, EventListenerMBean> e : eventListeners.entrySet()) {
            String listenerId = getListenerId(e.getKey());
            EventListenerMBean mbean = e.getValue();
            FilterConfigMBean filterConfigMBean = null;
            for (Map.Entry<ObjectName, FilterConfigMBean> ef : filterConfigs.entrySet()) {
                if (Objects.equal(getListenerId(ef.getKey()), listenerId)) {
                    filterConfigMBean = ef.getValue();
                    break;
                }
            }
            leaderBoard.add(new LeaderBoardData(++id, mbean, filterConfigMBean));
        }
        sort(leaderBoard);
        for (LeaderBoardData data : leaderBoard) {
            tds.put(data.toCompositeData());
        }
    } catch (OpenDataException e) {
        throw new IllegalStateException(e);
    }
    return tds;
}
Also used : TabularType(javax.management.openmbean.TabularType) FilterConfigMBean(org.apache.jackrabbit.oak.plugins.observation.filter.FilterConfigMBean) ObjectName(javax.management.ObjectName) OpenDataException(javax.management.openmbean.OpenDataException) TabularDataSupport(javax.management.openmbean.TabularDataSupport) EventListenerMBean(org.apache.jackrabbit.api.jmx.EventListenerMBean) Map(java.util.Map)

Example 92 with TabularDataSupport

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

the class InstanceToTableMapper method tableFrom.

public static TabularData tableFrom(List<Instance> instances) {
    try {
        CompositeType rowType = createRowType();
        TabularType tableType = new TabularType("Instances", "Table of all Karaf instances", rowType, new String[] { InstancesMBean.INSTANCE_NAME });
        TabularDataSupport table = new TabularDataSupport(tableType);
        for (Instance instance : instances) {
            CompositeDataSupport row = mapInstance(instance, rowType);
            table.put(row);
        }
        return table;
    } catch (OpenDataException e) {
        throw new IllegalStateException("Error building instance table", e);
    }
}
Also used : Instance(org.apache.karaf.instance.core.Instance) OpenDataException(javax.management.openmbean.OpenDataException) TabularDataSupport(javax.management.openmbean.TabularDataSupport) TabularType(javax.management.openmbean.TabularType) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) CompositeType(javax.management.openmbean.CompositeType)

Example 93 with TabularDataSupport

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

the class JmxFeature method getConfigList.

static TabularData getConfigList(List<ConfigInfo> config) throws OpenDataException {
    TabularDataSupport table = new TabularDataSupport(FEATURE_CONFIG_TABLE);
    for (ConfigInfo configInfo : config) {
        String[] itemNames = FeaturesServiceMBean.FEATURE_CONFIG;
        Object[] itemValues = { configInfo.getName(), getConfigElementTable(configInfo.getProperties()), new Boolean(configInfo.isAppend()) };
        CompositeData configComposite = new CompositeDataSupport(FEATURE_CONFIG, itemNames, itemValues);
        table.put(configComposite);
    }
    return table;
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) ConfigInfo(org.apache.karaf.features.ConfigInfo)

Example 94 with TabularDataSupport

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

the class JmxFeature method getDependencyIdentifierTable.

private static TabularData getDependencyIdentifierTable(List<Dependency> features) throws OpenDataException {
    TabularDataSupport table = new TabularDataSupport(FEATURE_IDENTIFIER_TABLE);
    Set<String> featureSet = new HashSet<>();
    for (Dependency feature : features) {
        if (featureSet.contains(feature.getName() + feature.getVersion())) {
            continue;
        } else {
            featureSet.add(feature.getName() + feature.getVersion());
        }
        String[] itemNames = new String[] { FeaturesServiceMBean.FEATURE_NAME, FeaturesServiceMBean.FEATURE_VERSION };
        Object[] itemValues = new Object[] { feature.getName(), feature.getVersion() };
        CompositeData ident = new CompositeDataSupport(FEATURE_IDENTIFIER, itemNames, itemValues);
        table.put(ident);
    }
    return table;
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) Dependency(org.apache.karaf.features.Dependency) HashSet(java.util.HashSet)

Example 95 with TabularDataSupport

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

the class JmxFeature method getConfigElementTable.

static TabularData getConfigElementTable(Map<String, String> config) throws OpenDataException {
    TabularDataSupport table = new TabularDataSupport(FEATURE_CONFIG_ELEMENT_TABLE);
    for (Map.Entry<String, String> entry : config.entrySet()) {
        String[] itemNames = FeaturesServiceMBean.FEATURE_CONFIG_ELEMENT;
        Object[] itemValues = { entry.getKey(), entry.getValue() };
        CompositeData element = new CompositeDataSupport(FEATURE_CONFIG_ELEMENT, itemNames, itemValues);
        table.put(element);
    }
    return table;
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) Map(java.util.Map)

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