Search in sources :

Example 1 with CompositeData

use of javax.management.openmbean.CompositeData in project camel by apache.

the class ManagedRoutingSlip method extendedInformation.

@Override
public TabularData extendedInformation() {
    try {
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.endpointsUtilizationTabularType());
        EndpointUtilizationStatistics stats = processor.getEndpointUtilizationStatistics();
        if (stats != null) {
            for (Map.Entry<String, Long> entry : stats.getStatistics().entrySet()) {
                CompositeType ct = CamelOpenMBeanTypes.endpointsUtilizationCompositeType();
                String url = entry.getKey();
                if (sanitize) {
                    url = URISupport.sanitizeUri(url);
                }
                Long hits = entry.getValue();
                if (hits == null) {
                    hits = 0L;
                }
                CompositeData data = new CompositeDataSupport(ct, new String[] { "url", "hits" }, new Object[] { url, hits });
                answer.put(data);
            }
        }
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) EndpointUtilizationStatistics(org.apache.camel.spi.EndpointUtilizationStatistics) Map(java.util.Map) TabularData(javax.management.openmbean.TabularData) CompositeType(javax.management.openmbean.CompositeType)

Example 2 with CompositeData

use of javax.management.openmbean.CompositeData in project camel by apache.

the class ManagedSendDynamicProcessor method extendedInformation.

@Override
public TabularData extendedInformation() {
    try {
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.endpointsUtilizationTabularType());
        EndpointUtilizationStatistics stats = processor.getEndpointUtilizationStatistics();
        if (stats != null) {
            for (Map.Entry<String, Long> entry : stats.getStatistics().entrySet()) {
                CompositeType ct = CamelOpenMBeanTypes.endpointsUtilizationCompositeType();
                String url = entry.getKey();
                if (sanitize) {
                    url = URISupport.sanitizeUri(url);
                }
                Long hits = entry.getValue();
                if (hits == null) {
                    hits = 0L;
                }
                CompositeData data = new CompositeDataSupport(ct, new String[] { "url", "hits" }, new Object[] { url, hits });
                answer.put(data);
            }
        }
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) EndpointUtilizationStatistics(org.apache.camel.spi.EndpointUtilizationStatistics) Map(java.util.Map) TabularData(javax.management.openmbean.TabularData) CompositeType(javax.management.openmbean.CompositeType)

Example 3 with CompositeData

use of javax.management.openmbean.CompositeData in project camel by apache.

the class ManagedSendProcessor method extendedInformation.

@Override
public TabularData extendedInformation() {
    try {
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.endpointsUtilizationTabularType());
        // we only have 1 endpoint
        CompositeType ct = CamelOpenMBeanTypes.endpointsUtilizationCompositeType();
        String url = getDestination();
        Long hits = processor.getCounter();
        CompositeData data = new CompositeDataSupport(ct, new String[] { "url", "hits" }, new Object[] { url, hits });
        answer.put(data);
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) TabularData(javax.management.openmbean.TabularData) CompositeType(javax.management.openmbean.CompositeType)

Example 4 with CompositeData

use of javax.management.openmbean.CompositeData in project camel by apache.

the class ManagedTypeConverterRegistry method listTypeConverters.

public TabularData listTypeConverters() {
    try {
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listTypeConvertersTabularType());
        List<Class<?>[]> converters = registry.listAllTypeConvertersFromTo();
        for (Class<?>[] entry : converters) {
            CompositeType ct = CamelOpenMBeanTypes.listTypeConvertersCompositeType();
            String from = entry[0].getCanonicalName();
            String to = entry[1].getCanonicalName();
            CompositeData data = new CompositeDataSupport(ct, new String[] { "from", "to" }, new Object[] { from, to });
            answer.put(data);
        }
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) TabularData(javax.management.openmbean.TabularData) CompositeType(javax.management.openmbean.CompositeType)

Example 5 with CompositeData

use of javax.management.openmbean.CompositeData in project camel by apache.

the class ManagedValidatorRegistry method listValidators.

@SuppressWarnings("unchecked")
public TabularData listValidators() {
    try {
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listValidatorsTabularType());
        Collection<Validator> validators = validatorRegistry.values();
        for (Validator validator : validators) {
            CompositeType ct = CamelOpenMBeanTypes.listValidatorsCompositeType();
            DataType type = validator.getType();
            String desc = validator.toString();
            boolean isStatic = validatorRegistry.isStatic(type);
            boolean isDynamic = validatorRegistry.isDynamic(type);
            CompositeData data = new CompositeDataSupport(ct, new String[] { "type", "static", "dynamic", "description" }, new Object[] { type.toString(), isStatic, isDynamic, desc });
            answer.put(data);
        }
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) DataType(org.apache.camel.spi.DataType) Validator(org.apache.camel.spi.Validator) TabularData(javax.management.openmbean.TabularData) CompositeType(javax.management.openmbean.CompositeType)

Aggregations

CompositeData (javax.management.openmbean.CompositeData)229 TabularData (javax.management.openmbean.TabularData)91 Test (org.junit.Test)73 CompositeDataSupport (javax.management.openmbean.CompositeDataSupport)68 TabularDataSupport (javax.management.openmbean.TabularDataSupport)51 CompositeType (javax.management.openmbean.CompositeType)50 HashMap (java.util.HashMap)31 ArrayList (java.util.ArrayList)27 Map (java.util.Map)27 Bundle (org.osgi.framework.Bundle)24 ObjectName (javax.management.ObjectName)21 OpenDataException (javax.management.openmbean.OpenDataException)18 IOException (java.io.IOException)17 Collection (java.util.Collection)16 AbstractIntegrationTest (org.apache.aries.jmx.AbstractIntegrationTest)16 AuditEvent (org.nhindirect.common.audit.AuditEvent)15 TabularType (javax.management.openmbean.TabularType)13 MBeanServer (javax.management.MBeanServer)12 DefaultAuditContext (org.nhindirect.common.audit.DefaultAuditContext)11 MBeanException (javax.management.MBeanException)8