1 22 package test.implementation.util.support; 23 24 import javax.management.modelmbean.ModelMBeanInfo ; 25 import javax.management.modelmbean.ModelMBeanInfoSupport ; 26 import javax.management.modelmbean.ModelMBeanAttributeInfo ; 27 import javax.management.modelmbean.ModelMBeanOperationInfo ; 28 import javax.management.MBeanParameterInfo ; 29 30 37 public class ResourceOverride 38 { 39 40 42 private String state = null; 43 44 45 public ResourceOverride(String state) 47 { 48 this.state = state; 49 } 50 51 public ResourceOverride() {} 52 53 54 56 public ModelMBeanInfo getMBeanInfo() 57 { 58 ModelMBeanAttributeInfo [] attributes = new ModelMBeanAttributeInfo [] 59 { 60 new ModelMBeanAttributeInfo ( 61 "AttributeName", "java.lang.String", "description", 62 false, true, false 63 ), 64 new ModelMBeanAttributeInfo ( 65 "AttributeName2", "java.lang.String", "description", 66 true, true, false 67 ) 68 }; 69 70 ModelMBeanOperationInfo [] operations = new ModelMBeanOperationInfo [] 71 { 72 new ModelMBeanOperationInfo ( 73 "doOperation", "description", null, "java.lang.Object", 1 74 ), 75 76 new ModelMBeanOperationInfo ( 77 "toString", "toString override", null, "java.lang.String", 1 78 ), 79 80 new ModelMBeanOperationInfo ( 81 "equals", "equals override", 82 new MBeanParameterInfo [] 83 { 84 new MBeanParameterInfo ("object", "java.lang.Object", "object to compare to") 85 }, 86 "boolean", 1 87 ), 88 89 new ModelMBeanOperationInfo ( 90 "hashCode", "hashCode override in resource", null, Integer.TYPE.getName(), 1 91 ) 92 }; 93 94 ModelMBeanInfoSupport info = new ModelMBeanInfoSupport ( 95 "test.implementation.util.support.Resource", "description", 96 attributes, null, operations, null 97 ); 98 99 return info; 100 } 101 102 103 public Object doOperation() 104 { 105 return "tamppi"; 106 } 107 108 109 111 public String toString() 112 { 113 return "Resource"; 114 } 115 116 public boolean equals(Object o) 117 { 118 return true; 119 } 120 121 public int hashCode() 122 { 123 return 10; 124 } 125 } 126 127 128 129 130 | Popular Tags |