Search in sources :

Example 46 with CompositeType

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

the class ManagedDataFormat method explain.

@Override
public TabularData explain(boolean allOptions) {
    String dataFormatName = getName();
    if (dataFormatName != null) {
        try {
            TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.explainDataFormatTabularType());
            String json = camelContext.explainDataFormatJson(dataFormatName, dataFormat, allOptions);
            List<Map<String, String>> rows = JsonSchemaHelper.parseJsonSchema("properties", json, true);
            for (Map<String, String> row : rows) {
                String name = row.get("name");
                String kind = row.get("kind");
                String label = row.get("label") != null ? row.get("label") : "";
                String type = row.get("type");
                String javaType = row.get("javaType");
                String deprecated = row.get("deprecated") != null ? row.get("deprecated") : "";
                String secret = row.get("secret") != null ? row.get("secret") : "";
                String value = row.get("value") != null ? row.get("value") : "";
                String defaultValue = row.get("defaultValue") != null ? row.get("defaultValue") : "";
                String description = row.get("description") != null ? row.get("description") : "";
                CompositeType ct = CamelOpenMBeanTypes.explainDataFormatsCompositeType();
                CompositeData data = new CompositeDataSupport(ct, new String[] { "option", "kind", "label", "type", "java type", "deprecated", "secret", "value", "default value", "description" }, new Object[] { name, kind, label, type, javaType, deprecated, secret, value, defaultValue, description });
                answer.put(data);
            }
            return answer;
        } catch (Exception e) {
            throw ObjectHelper.wrapRuntimeCamelException(e);
        }
    } else {
        return null;
    }
}
Also used : TabularDataSupport(javax.management.openmbean.TabularDataSupport) CompositeData(javax.management.openmbean.CompositeData) CompositeDataSupport(javax.management.openmbean.CompositeDataSupport) Map(java.util.Map) TabularData(javax.management.openmbean.TabularData) CompositeType(javax.management.openmbean.CompositeType)

Example 47 with CompositeType

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

the class ManagedEndpoint method explain.

@Override
public TabularData explain(boolean allOptions) {
    try {
        String json = endpoint.getCamelContext().explainEndpointJson(getEndpointUri(), allOptions);
        List<Map<String, String>> rows = JsonSchemaHelper.parseJsonSchema("properties", json, true);
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.explainEndpointTabularType());
        for (Map<String, String> row : rows) {
            String name = row.get("name");
            String kind = row.get("kind");
            String group = row.get("group") != null ? row.get("group") : "";
            String label = row.get("label") != null ? row.get("label") : "";
            String type = row.get("type");
            String javaType = row.get("javaType");
            String deprecated = row.get("deprecated") != null ? row.get("deprecated") : "";
            String secret = row.get("secret") != null ? row.get("secret") : "";
            String value = row.get("value") != null ? row.get("value") : "";
            String defaultValue = row.get("defaultValue") != null ? row.get("defaultValue") : "";
            String description = row.get("description") != null ? row.get("description") : "";
            CompositeType ct = CamelOpenMBeanTypes.explainEndpointsCompositeType();
            CompositeData data = new CompositeDataSupport(ct, new String[] { "option", "kind", "group", "label", "type", "java type", "deprecated", "secret", "value", "default value", "description" }, new Object[] { name, kind, group, label, type, javaType, deprecated, secret, value, defaultValue, description });
            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) Map(java.util.Map) TabularData(javax.management.openmbean.TabularData) CompositeType(javax.management.openmbean.CompositeType)

Example 48 with CompositeType

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

the class ManagedEndpointRegistry method listEndpoints.

@SuppressWarnings("unchecked")
public TabularData listEndpoints() {
    try {
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listEndpointsTabularType());
        Collection<Endpoint> endpoints = endpointRegistry.values();
        for (Endpoint endpoint : endpoints) {
            CompositeType ct = CamelOpenMBeanTypes.listEndpointsCompositeType();
            String url = endpoint.getEndpointUri();
            if (sanitize) {
                url = URISupport.sanitizeUri(url);
            }
            boolean fromStatic = endpointRegistry.isStatic(url);
            boolean fromDynamic = endpointRegistry.isDynamic(url);
            CompositeData data = new CompositeDataSupport(ct, new String[] { "url", "static", "dynamic" }, new Object[] { url, fromStatic, fromDynamic });
            answer.put(data);
        }
        return answer;
    } catch (Exception e) {
        throw ObjectHelper.wrapRuntimeCamelException(e);
    }
}
Also used : Endpoint(org.apache.camel.Endpoint) 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 49 with CompositeType

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

the class ManagedPollEnricher 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 50 with CompositeType

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

the class ManagedProcessor method explain.

public TabularData explain(boolean allOptions) {
    try {
        String json = context.explainEipJson(id, allOptions);
        List<Map<String, String>> rows = JsonSchemaHelper.parseJsonSchema("properties", json, true);
        TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.explainEipTabularType());
        for (Map<String, String> row : rows) {
            String name = row.get("name");
            String kind = row.get("kind");
            String label = row.get("label") != null ? row.get("label") : "";
            String type = row.get("type");
            String javaType = row.get("javaType");
            String deprecated = row.get("deprecated") != null ? row.get("deprecated") : "";
            String value = row.get("value") != null ? row.get("value") : "";
            String defaultValue = row.get("defaultValue") != null ? row.get("defaultValue") : "";
            String description = row.get("description") != null ? row.get("description") : "";
            CompositeType ct = CamelOpenMBeanTypes.explainEipsCompositeType();
            CompositeData data = new CompositeDataSupport(ct, new String[] { "option", "kind", "label", "type", "java type", "deprecated", "value", "default value", "description" }, new Object[] { name, kind, label, type, javaType, deprecated, value, defaultValue, description });
            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) Map(java.util.Map) TabularData(javax.management.openmbean.TabularData) 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