use of javax.management.openmbean.TabularDataSupport 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);
}
}
use of javax.management.openmbean.TabularDataSupport 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);
}
}
use of javax.management.openmbean.TabularDataSupport 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);
}
}
use of javax.management.openmbean.TabularDataSupport in project camel by apache.
the class ManagedRecipientList 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);
}
}
use of javax.management.openmbean.TabularDataSupport in project camel by apache.
the class ManagedRestRegistry method listRestServices.
@Override
public TabularData listRestServices() {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listRestServicesTabularType());
List<RestRegistry.RestService> services = registry.listAllRestServices();
for (RestRegistry.RestService entry : services) {
CompositeType ct = CamelOpenMBeanTypes.listRestServicesCompositeType();
String url = entry.getUrl();
String baseUrl = entry.getBaseUrl();
String basePath = entry.getBasePath();
String uriTemplate = entry.getUriTemplate();
String method = entry.getMethod();
String consumes = entry.getConsumes();
String produces = entry.getProduces();
String state = entry.getState();
String inType = entry.getInType();
String outType = entry.getOutType();
String routeId = entry.getRouteId();
String description = entry.getDescription();
CompositeData data = new CompositeDataSupport(ct, new String[] { "url", "baseUrl", "basePath", "uriTemplate", "method", "consumes", "produces", "inType", "outType", "state", "routeId", "description" }, new Object[] { url, baseUrl, basePath, uriTemplate, method, consumes, produces, inType, outType, state, routeId, description });
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
Aggregations