Search in sources :

Example 81 with CompositeType

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

Example 82 with CompositeType

use of javax.management.openmbean.CompositeType in project ddf by codice.

the class UndeliveredMessagesTest method createCompositeData.

private CompositeData[] createCompositeData(Object itemValue) throws OpenDataException {
    CompositeData[] compositeDatas = new CompositeDataSupport[1];
    String[] keys = { "itemName", "body" };
    /* The first 5 bytes are removed because artemis adds unreadable characters to the
           beginning of the message body. */
    Object[] values = { "itemValue", itemValue };
    CompositeType compositeType = new CompositeType("typeName", "description", keys, new String[] { "itemDescription", "messageBodyDescription" }, new OpenType[] { SimpleType.STRING, ArrayType.getPrimitiveArrayType(byte[].class) });
    compositeDatas[0] = new CompositeDataSupport(compositeType, keys, values);
    return compositeDatas;
}
Also used : CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) CompositeData(javax.management.openmbean.CompositeData) CompositeType(javax.management.openmbean.CompositeType)

Aggregations

CompositeType (javax.management.openmbean.CompositeType)82 CompositeDataSupport (javax.management.openmbean.CompositeDataSupport)55 CompositeData (javax.management.openmbean.CompositeData)50 TabularDataSupport (javax.management.openmbean.TabularDataSupport)50 TabularData (javax.management.openmbean.TabularData)47 TabularType (javax.management.openmbean.TabularType)27 OpenType (javax.management.openmbean.OpenType)23 OpenDataException (javax.management.openmbean.OpenDataException)22 Map (java.util.Map)20 ObjectName (javax.management.ObjectName)7 EndpointUtilizationStatistics (org.apache.camel.spi.EndpointUtilizationStatistics)7 MBeanServer (javax.management.MBeanServer)6 ArrayType (javax.management.openmbean.ArrayType)6 ConcurrentMap (java.util.concurrent.ConcurrentMap)5 MBeanException (javax.management.MBeanException)5 NotCompliantMBeanException (javax.management.NotCompliantMBeanException)5 DruidDataSource (com.alibaba.druid.pool.DruidDataSource)3 DataSourceProxyImpl (com.alibaba.druid.proxy.jdbc.DataSourceProxyImpl)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3