Search in sources :

Example 1 with FilterConfigMBean

use of org.apache.jackrabbit.oak.plugins.observation.filter.FilterConfigMBean 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)

Aggregations

Map (java.util.Map)1 ObjectName (javax.management.ObjectName)1 OpenDataException (javax.management.openmbean.OpenDataException)1 TabularDataSupport (javax.management.openmbean.TabularDataSupport)1 TabularType (javax.management.openmbean.TabularType)1 EventListenerMBean (org.apache.jackrabbit.api.jmx.EventListenerMBean)1 FilterConfigMBean (org.apache.jackrabbit.oak.plugins.observation.filter.FilterConfigMBean)1