1 22 package test.implementation.util.support; 23 24 import javax.management.*; 25 import javax.management.modelmbean.*; 26 27 31 public class ExtendedResource implements MyInterface2 32 { 33 private String attr = null; 34 private String attr2 = null; 35 private Object arg = null; 36 37 public void setAttributeName(String attr) 38 { 39 this.attr = attr; 40 } 41 42 public void setAttributeName2(String attr) 43 { 44 this.attr2 = attr; 45 } 46 47 public String getAttributeName2() 48 { 49 return attr2; 50 } 51 52 public void setAttribute3(Object arg) 53 { 54 this.arg = arg; 55 } 56 57 public Object getAttribute3() 58 { 59 return arg.toString(); 60 } 61 62 public Object doOperation() 63 { 64 return "doOperation"; 65 } 66 67 public String executeThis(Object arg) 68 { 69 return arg.toString(); 70 } 71 72 public Object runMe(String str) 73 { 74 return str; 75 } 76 77 public ModelMBeanInfo getMBeanInfo() 78 { 79 ModelMBeanAttributeInfo[] attributes = new ModelMBeanAttributeInfo[] 80 { 81 new ModelMBeanAttributeInfo( 82 "AttributeName", "java.lang.String", "description", 83 false, true, false 84 ), 85 new ModelMBeanAttributeInfo( 86 "AttributeName2", "java.lang.String", "description", 87 true, true, false 88 ), 89 new ModelMBeanAttributeInfo( 90 "Attribute3", "java.lang.Object", "description", 91 true, true, false 92 ) 93 }; 94 95 ModelMBeanOperationInfo[] operations = new ModelMBeanOperationInfo[] 96 { 97 new ModelMBeanOperationInfo( 98 "doOperation", "description", null, "java.lang.Object", 1 99 ), 100 new ModelMBeanOperationInfo( 101 "executeThis", "description", 102 103 new MBeanParameterInfo[] { 104 new MBeanParameterInfo( 105 "arg", "java.lang.Object", "description" 106 ) 107 }, 108 "java.lang.Object", 1 109 ), 110 new ModelMBeanOperationInfo( 111 "runMe", "description", 112 113 new MBeanParameterInfo[] { 114 new MBeanParameterInfo( 115 "arg", "java.lang.String", "description" 116 ) 117 }, 118 "java.lang.Object", 1 119 ) 120 }; 121 122 ModelMBeanInfoSupport info = new ModelMBeanInfoSupport( 123 "test.implementation.util.support.Resource", "description", 124 attributes, null, operations, null 125 ); 126 127 return info; 128 } 129 130 } 131 | Popular Tags |