/** * @author Juergen Hoeller */ @ManagedResource("${domain}:name=testBean5") public class FactoryCreatedAnnotationTestBean extends AnnotationTestBean { }
private static String getResourcePath(String path, Object bean) { String rpath = path; ManagedResource mr = bean.getClass().getAnnotation(ManagedResource.class); if (mr != null) { String xpath = mr.objectName(); if (xpath == null || xpath.length() == 0) xpath = mr.value(); if (xpath != null && xpath.length() > 0) { rpath = path == null ? "" : xpath.startsWith(PATH_RELATIVE) ? path + PATH_SEPARATOR : PATH_SEPARATOR + path; rpath = xpath.startsWith(PATH_RELATIVE) ? rpath + xpath.substring(PATH_RELATIVE.length()) : xpath + rpath; } } return rpath; }
@Override protected void formatBean(Object objBean) throws Exception { IdentityHashMap identityHashMap = new IdentityHashMap(); // root object Map<String, Object> json = new HashMap<String, Object>(); // set desc and type on root Class<?> clazz = objBean.getClass(); ManagedResource mr = clazz.getAnnotation(ManagedResource.class); String strHelp = mr == null ? null : mr.description(); if (strHelp != null) json.put("description", strHelp); json.put("bean", clazz.getName()); identityHashMap.put(objBean, Boolean.TRUE); // add properties and operations, recursively as needed format(objBean, json, identityHashMap); ObjectMapper mapper = new ObjectMapper(); mapper.configure(Feature.FAIL_ON_EMPTY_BEANS, false); // Output getWriter().print(mapper.writeValueAsString(json)); }
@ManagedResource(objectName = "bean:name=packagePrivate") private static class PackagePrivateTestBean { private String name; @ManagedAttribute public String getName() { return this.name; } @ManagedAttribute public void setName(String name) { this.name = name; } }
/** * A managed resource implementation to expose the total deliveries via the Control Bus * * @author Marius Bogoevici * @author David Turanski */ @ManagedResource public class Waiter { private AtomicInteger totalDeliveries = new AtomicInteger(); public Delivery prepareDelivery(List<Drink> drinks) { totalDeliveries.getAndIncrement(); return new Delivery(drinks); } @ManagedOperation public int getTotalDeliveries() { return this.totalDeliveries.get(); } }
/** * @author Stephane Nicoll */ @ManagedResource(objectName = "bean:name=interfaceTestBean", description = "My Managed Bean") public interface AnotherAnnotationTestBean { @ManagedOperation(description = "invoke foo") void foo(); @ManagedAttribute(description = "Bar description") String getBar(); void setBar(String bar); @ManagedMetric(description = "a metric", metricType = MetricType.COUNTER) int getCacheEntries(); }
@ManagedResource(description = "Connection metrics") public class ConnectionMetrics extends AbstractMonitor {
@ManagedResource(description = "Assertion Metrics") public class AssertMetrics extends AbstractMonitor {
@ManagedResource(objectName="org.broadleafcommerce:name=Log4J2Manangement", description="Logging Management", currencyTimeLimit=15) public class Log4j2ManagementBean {
@ManagedResource(description = "Memory Metrics") public class MemoryMetrics extends AbstractMonitor {
@ManagedResource(description = "Operation Counters") public class OperationCounters extends AbstractMonitor {
@ManagedResource(description = "Background Flushing Metrics") public class BackgroundFlushingMetrics extends AbstractMonitor {
@ManagedResource(description = "Server Information") public class ServerInfo extends AbstractMonitor {
@ManagedResource(description = "Btree Metrics") public class BtreeIndexCounters extends AbstractMonitor {
@ManagedResource(description = "Mongo Admin Operations") public class MongoAdmin implements MongoAdminOperations {
@ManagedResource(description = "Global Lock Metrics") public class GlobalLockMetrics extends AbstractMonitor {
@ManagedResource public class GlobalScope extends Scope implements IGlobalScope, GlobalScopeMXBean {
@ManagedResource(objectName = "org.red5.server:type=ApplicationSchedulingService,name=default") public class ApplicationSchedulingService extends QuartzSchedulingService {
@ManagedResource public class PayloadAwareTimingInterceptor implements ChannelInterceptor {
@ManagedResource public class StopWatch implements InitializingBean {