Search in sources :

Example 41 with TabularType

use of javax.management.openmbean.TabularType in project tomee by apache.

the class SimpleRouter method getActiveRoutes.

@ManagedAttribute
public TabularData getActiveRoutes() {
    if (routes.length == 0) {
        return null;
    }
    final OpenType<?>[] types = new OpenType<?>[routes.length];
    final String[] keys = new String[types.length];
    final String[] values = new String[types.length];
    for (int i = 0; i < types.length; i++) {
        types[i] = SimpleType.STRING;
        keys[i] = routes[i].getOrigin().substring(prefix.length());
        values[i] = routes[i].getRawDestination().substring(prefix.length());
    }
    try {
        final CompositeType ct = new CompositeType("routes", "routes", keys, keys, types);
        final TabularType type = new TabularType("router", "routes", ct, keys);
        final TabularDataSupport data = new TabularDataSupport(type);
        final CompositeData line = new CompositeDataSupport(ct, keys, values);
        data.put(line);
        return data;
    } catch (final OpenDataException e) {
        return null;
    }
}
Also used : OpenType(javax.management.openmbean.OpenType) OpenDataException(javax.management.openmbean.OpenDataException) TabularDataSupport(javax.management.openmbean.TabularDataSupport) TabularType(javax.management.openmbean.TabularType) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) CompositeType(javax.management.openmbean.CompositeType) ManagedAttribute(javax.management.ManagedAttribute)

Aggregations

TabularType (javax.management.openmbean.TabularType)41 TabularDataSupport (javax.management.openmbean.TabularDataSupport)36 CompositeType (javax.management.openmbean.CompositeType)25 OpenDataException (javax.management.openmbean.OpenDataException)22 CompositeDataSupport (javax.management.openmbean.CompositeDataSupport)19 TabularData (javax.management.openmbean.TabularData)18 CompositeData (javax.management.openmbean.CompositeData)13 Map (java.util.Map)8 OpenType (javax.management.openmbean.OpenType)8 NotCompliantMBeanException (javax.management.NotCompliantMBeanException)6 ConcurrentMap (java.util.concurrent.ConcurrentMap)5 MBeanException (javax.management.MBeanException)5 ObjectName (javax.management.ObjectName)4 Bundle (org.osgi.framework.Bundle)4 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)3 DataSourceProxyImpl (com.alibaba.druid.proxy.jdbc.DataSourceProxyImpl)3 HashMap (java.util.HashMap)3 LinkedHashMap (java.util.LinkedHashMap)3 MBeanInfo (javax.management.MBeanInfo)3 Field (java.lang.reflect.Field)2