1 22 package org.objectweb.petals.jbi.management.systemstate.mock; 23 24 import java.io.ObjectInputStream ; 25 import java.util.Set ; 26 27 import javax.management.Attribute ; 28 import javax.management.AttributeList ; 29 import javax.management.AttributeNotFoundException ; 30 import javax.management.InstanceAlreadyExistsException ; 31 import javax.management.InstanceNotFoundException ; 32 import javax.management.IntrospectionException ; 33 import javax.management.InvalidAttributeValueException ; 34 import javax.management.ListenerNotFoundException ; 35 import javax.management.MBeanException ; 36 import javax.management.MBeanInfo ; 37 import javax.management.MBeanRegistrationException ; 38 import javax.management.MBeanServer ; 39 import javax.management.NotCompliantMBeanException ; 40 import javax.management.NotificationFilter ; 41 import javax.management.NotificationListener ; 42 import javax.management.ObjectInstance ; 43 import javax.management.ObjectName ; 44 import javax.management.OperationsException ; 45 import javax.management.QueryExp ; 46 import javax.management.ReflectionException ; 47 import javax.management.loading.ClassLoaderRepository ; 48 49 54 public class MockMBeanServer implements MBeanServer { 55 56 protected boolean throwInstanceNotFoundException; 57 58 protected boolean throwMBeanException; 59 60 protected boolean throwReflectionException; 61 62 public void addNotificationListener(ObjectName name, 63 NotificationListener listener, NotificationFilter filter, 64 Object handback) throws InstanceNotFoundException { 65 } 66 67 public void addNotificationListener(ObjectName name, ObjectName listener, 68 NotificationFilter filter, Object handback) 69 throws InstanceNotFoundException { 70 } 71 72 public ObjectInstance createMBean(String className, ObjectName name) 73 throws ReflectionException , InstanceAlreadyExistsException , 74 MBeanRegistrationException , MBeanException , NotCompliantMBeanException { 75 return null; 76 } 77 78 public ObjectInstance createMBean(String className, ObjectName name, 79 Object [] params, String [] signature) throws ReflectionException , 80 InstanceAlreadyExistsException , MBeanRegistrationException , 81 MBeanException , NotCompliantMBeanException { 82 return null; 83 } 84 85 public ObjectInstance createMBean(String className, ObjectName name, 86 ObjectName loaderName) throws ReflectionException , 87 InstanceAlreadyExistsException , MBeanRegistrationException , 88 MBeanException , NotCompliantMBeanException , InstanceNotFoundException { 89 return null; 90 } 91 92 public ObjectInstance createMBean(String className, ObjectName name, 93 ObjectName loaderName, Object [] params, String [] signature) 94 throws ReflectionException , InstanceAlreadyExistsException , 95 MBeanRegistrationException , MBeanException , NotCompliantMBeanException , 96 InstanceNotFoundException { 97 return null; 98 } 99 100 public ObjectInputStream deserialize(ObjectName name, byte[] data) 101 throws InstanceNotFoundException , OperationsException { 102 return null; 103 } 104 105 public ObjectInputStream deserialize(String className, byte[] data) 106 throws OperationsException , ReflectionException { 107 return null; 108 } 109 110 public ObjectInputStream deserialize(String className, 111 ObjectName loaderName, byte[] data) throws InstanceNotFoundException , 112 OperationsException , ReflectionException { 113 return null; 114 } 115 116 public Object getAttribute(ObjectName name, String attribute) 117 throws MBeanException , AttributeNotFoundException , 118 InstanceNotFoundException , ReflectionException { 119 return null; 120 } 121 122 public AttributeList getAttributes(ObjectName name, String [] attributes) 123 throws InstanceNotFoundException , ReflectionException { 124 return null; 125 } 126 127 public ClassLoader getClassLoader(ObjectName loaderName) 128 throws InstanceNotFoundException { 129 return null; 130 } 131 132 public ClassLoader getClassLoaderFor(ObjectName mbeanName) 133 throws InstanceNotFoundException { 134 return null; 135 } 136 137 public ClassLoaderRepository getClassLoaderRepository() { 138 return null; 139 } 140 141 public String getDefaultDomain() { 142 return null; 143 } 144 145 public String [] getDomains() { 146 return null; 147 } 148 149 public Integer getMBeanCount() { 150 return null; 151 } 152 153 public MBeanInfo getMBeanInfo(ObjectName name) 154 throws InstanceNotFoundException , IntrospectionException , 155 ReflectionException { 156 return null; 157 } 158 159 public ObjectInstance getObjectInstance(ObjectName name) 160 throws InstanceNotFoundException { 161 return null; 162 } 163 164 public Object instantiate(String className) throws ReflectionException , 165 MBeanException { 166 return null; 167 } 168 169 public Object instantiate(String className, Object [] params, 170 String [] signature) throws ReflectionException , MBeanException { 171 return null; 172 } 173 174 public Object instantiate(String className, ObjectName loaderName) 175 throws ReflectionException , MBeanException , InstanceNotFoundException { 176 return null; 177 } 178 179 public Object instantiate(String className, ObjectName loaderName, 180 Object [] params, String [] signature) throws ReflectionException , 181 MBeanException , InstanceNotFoundException { 182 return null; 183 } 184 185 public Object invoke(ObjectName name, String operationName, 186 Object [] params, String [] signature) throws InstanceNotFoundException , 187 MBeanException , ReflectionException { 188 if (throwInstanceNotFoundException) { 189 throw new InstanceNotFoundException (); 190 } 191 if (throwMBeanException) { 192 throw new MBeanException (new RuntimeException ()); 193 } 194 if (throwReflectionException) { 195 throw new ReflectionException (new RuntimeException ()); 196 } 197 return null; 198 } 199 200 public boolean isInstanceOf(ObjectName name, String className) 201 throws InstanceNotFoundException { 202 return false; 203 } 204 205 public boolean isRegistered(ObjectName name) { 206 return false; 207 } 208 209 public boolean isThrowInstanceNotFoundException() { 210 return throwInstanceNotFoundException; 211 } 212 213 public boolean isThrowMBeanException() { 214 return throwMBeanException; 215 } 216 217 public boolean isThrowReflectionException() { 218 return throwReflectionException; 219 } 220 221 public Set queryMBeans(ObjectName name, QueryExp query) { 222 return null; 223 } 224 225 public Set queryNames(ObjectName name, QueryExp query) { 226 return null; 227 } 228 229 public ObjectInstance registerMBean(Object object, ObjectName name) 230 throws InstanceAlreadyExistsException , MBeanRegistrationException , 231 NotCompliantMBeanException { 232 return null; 233 } 234 235 public void removeNotificationListener(ObjectName name, 236 NotificationListener listener) throws InstanceNotFoundException , 237 ListenerNotFoundException { 238 } 239 240 public void removeNotificationListener(ObjectName name, 241 NotificationListener listener, NotificationFilter filter, 242 Object handback) throws InstanceNotFoundException , 243 ListenerNotFoundException { 244 } 245 246 public void removeNotificationListener(ObjectName name, ObjectName listener) 247 throws InstanceNotFoundException , ListenerNotFoundException { 248 } 249 250 public void removeNotificationListener(ObjectName name, 251 ObjectName listener, NotificationFilter filter, Object handback) 252 throws InstanceNotFoundException , ListenerNotFoundException { 253 } 254 255 public void setAttribute(ObjectName name, Attribute attribute) 256 throws InstanceNotFoundException , AttributeNotFoundException , 257 InvalidAttributeValueException , MBeanException , ReflectionException { 258 } 259 260 public AttributeList setAttributes(ObjectName name, AttributeList attributes) 261 throws InstanceNotFoundException , ReflectionException { 262 return null; 263 } 264 265 public void setThrowInstanceNotFoundException( 266 boolean throwInstanceNotFoundException) { 267 this.throwInstanceNotFoundException = throwInstanceNotFoundException; 268 } 269 270 public void setThrowMBeanException(boolean throwMBeanException) { 271 this.throwMBeanException = throwMBeanException; 272 } 273 274 public void setThrowReflectionException(boolean throwReflectionException) { 275 this.throwReflectionException = throwReflectionException; 276 } 277 278 public void unregisterMBean(ObjectName name) 279 throws InstanceNotFoundException , MBeanRegistrationException { 280 } 281 282 } 283 | Popular Tags |