1 2 package org.objectweb.celtix.bus.management.jmx.export; 3 4 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedAttribute; 5 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedNotification; 6 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedNotifications; 7 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedOperation; 8 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedOperationParameter; 9 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedOperationParameters; 10 import org.objectweb.celtix.bus.management.jmx.export.annotation.ManagedResource; 11 import org.objectweb.celtix.management.Instrumentation; 12 13 14 @ManagedResource(componentName = "AnnotationTest", description = "My Managed Bean", 15 persistPolicy = "OnUpdate", currencyTimeLimit = 15 , 16 log = false , 17 logFile = "jmx.log", persistPeriod = 200, 18 persistLocation = "/local/work", persistName = "bar.jmx") 19 @ManagedNotifications({@ManagedNotification(name = "My Notification", 20 notificationTypes = {"type.foo", "type.bar" }) }) 21 public class AnnotationTestInstrumentation implements Instrumentation { 22 23 private String name; 24 25 private String nickName; 26 27 private int age; 28 29 private boolean isSuperman; 30 31 32 @ManagedAttribute(description = "The Age Attribute", currencyTimeLimit = 15) 33 public int getAge() { 34 return age; 35 } 36 37 public void setAge(int a) { 38 this.age = a; 39 } 40 41 @ManagedOperation(currencyTimeLimit = 30) 42 public long myOperation() { 43 return 1L; 44 } 45 46 @ManagedAttribute(description = "The Name Attribute", 47 currencyTimeLimit = 20, 48 defaultValue = "bar", 49 persistPolicy = "OnUpdate") 50 public void setName(String n) { 51 this.name = n; 52 } 53 54 @ManagedAttribute(defaultValue = "bar", persistPeriod = 300) 55 public String getName() { 56 return name; 57 } 58 59 @ManagedAttribute(defaultValue = "barasd", description = "The Nick Name Attribute") 60 public String getNickName() { 61 return this.nickName; 62 } 63 64 public void setNickName(String n) { 65 this.nickName = n; 66 } 67 68 @ManagedAttribute(description = "The Is Superman Attribute") 69 public void setSuperman(boolean superman) { 70 this.isSuperman = superman; 71 } 72 73 public boolean isSuperman() { 74 return isSuperman; 75 } 76 77 @ManagedOperation(description = "Add Two Numbers Together") 78 @ManagedOperationParameters({@ManagedOperationParameter( 79 name = "x", description = "Left operand"), 80 @ManagedOperationParameter( 81 name = "y", description = "Right operand") }) 82 public int add(int x, int y) { 83 return x + y; 84 } 85 86 public String getInstrumentationName() { 87 return "AnnotationTestInstrumentation"; 88 } 89 90 public Object getComponent() { 91 return this; 92 } 93 94 public String getUniqueInstrumentationName() { 95 return "AnnotationTestInstrumentation"; 96 } 97 98 } 99 | Popular Tags |