use of javax.management.openmbean.CompositeType 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.CompositeType 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);
}
}
use of javax.management.openmbean.CompositeType in project camel by apache.
the class ManagedRuntimeEndpointRegistry method endpointStatistics.
@Override
public TabularData endpointStatistics() {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listRuntimeEndpointsTabularType());
EndpointRegistry staticRegistry = getContext().getEndpointRegistry();
int index = 0;
for (RuntimeEndpointRegistry.Statistic stat : registry.getEndpointStatistics()) {
CompositeType ct = CamelOpenMBeanTypes.listRuntimeEndpointsCompositeType();
String url = stat.getUri();
Boolean isStatic = staticRegistry.isStatic(url);
Boolean isDynamic = staticRegistry.isDynamic(url);
if (sanitize) {
url = URISupport.sanitizeUri(url);
}
String routeId = stat.getRouteId();
String direction = stat.getDirection();
long hits = stat.getHits();
CompositeData data = new CompositeDataSupport(ct, new String[] { "index", "url", "routeId", "direction", "static", "dynamic", "hits" }, new Object[] { index, url, routeId, direction, isStatic, isDynamic, hits });
answer.put(data);
// use a counter as the single index in the TabularData as we do not want a multi-value index
index++;
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
use of javax.management.openmbean.CompositeType in project camel by apache.
the class ManagedTransformerRegistry method listTransformers.
@SuppressWarnings("unchecked")
public TabularData listTransformers() {
try {
TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listTransformersTabularType());
Collection<Transformer> transformers = transformerRegistry.values();
for (Transformer transformer : transformers) {
CompositeType ct = CamelOpenMBeanTypes.listTransformersCompositeType();
String scheme = transformer.getModel();
DataType from = transformer.getFrom();
DataType to = transformer.getTo();
String desc = transformer.toString();
boolean fromStatic = scheme != null ? transformerRegistry.isStatic(scheme) : transformerRegistry.isStatic(from, to);
boolean fromDynamic = scheme != null ? transformerRegistry.isDynamic(scheme) : transformerRegistry.isDynamic(from, to);
CompositeData data = new CompositeDataSupport(ct, new String[] { "scheme", "from", "to", "static", "dynamic", "description" }, new Object[] { scheme, from.toString(), to.toString(), fromStatic, fromDynamic, desc });
answer.put(data);
}
return answer;
} catch (Exception e) {
throw ObjectHelper.wrapRuntimeCamelException(e);
}
}
use of javax.management.openmbean.CompositeType in project camel by apache.
the class ManagedWireTapProcessor 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);
}
}
Aggregations