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);
}
}
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);
}
}
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);
}
}
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);
}
}
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);
}
}
Aggregations