1 7 package org.jboss.test.jbossnet.jmx.server; 8 9 import javax.management.Attribute ; 10 import javax.management.AttributeList ; 11 import javax.management.AttributeNotFoundException ; 12 import javax.management.DynamicMBean ; 13 import javax.management.InvalidAttributeValueException ; 14 import javax.management.MBeanAttributeInfo ; 15 import javax.management.MBeanConstructorInfo ; 16 import javax.management.MBeanException ; 17 import javax.management.MBeanInfo ; 18 import javax.management.MBeanNotificationInfo ; 19 import javax.management.MBeanOperationInfo ; 20 import javax.management.MBeanParameterInfo ; 21 import javax.management.ReflectionException ; 22 23 31 32 public class JMXDynamicTest implements DynamicMBean 33 { 34 35 36 private String testString = "JMX_TEST_STRING"; 37 38 41 public Object getAttribute(String attribute) 42 throws AttributeNotFoundException , MBeanException , ReflectionException 43 { 44 return testString; 45 } 46 47 50 public void setAttribute(Attribute attribute) 51 throws 52 AttributeNotFoundException , 53 InvalidAttributeValueException , 54 MBeanException , 55 ReflectionException 56 { 57 testString = (String ) attribute.getValue(); 58 } 59 60 63 public AttributeList getAttributes(String [] attributes) 64 { 65 return null; 66 } 67 68 71 public AttributeList setAttributes(AttributeList attributes) 72 { 73 return null; 74 } 75 76 79 public Object invoke(String actionName, Object [] params, String [] signature) 80 throws MBeanException , ReflectionException 81 { 82 return null; 83 } 84 85 88 public MBeanInfo getMBeanInfo() 89 { 90 MBeanAttributeInfo [] attrs = 91 new MBeanAttributeInfo [] { 92 new MBeanAttributeInfo ( 93 "TestString", 94 "java.lang.String", 95 "shit", 96 true, 97 true, 98 false)}; 99 MBeanOperationInfo [] ops = 100 new MBeanOperationInfo [] { 101 new MBeanOperationInfo ( 102 "noopOperation", 103 "shit", 104 new MBeanParameterInfo [0], 105 "void", 106 MBeanOperationInfo.UNKNOWN)}; 107 MBeanInfo result = 108 new MBeanInfo ( 109 getClass().getName(), 110 "shit", 111 attrs, 112 new MBeanConstructorInfo [0], 113 ops, 114 new MBeanNotificationInfo [0]); 115 return result; 116 } 117 } 118 | Popular Tags |