00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 package org.objectweb.cjdbc.controller.jmx;
00026
00027 import java.io.ObjectInputStream;
00028 import java.util.Set;
00029
00030 import javax.management.Attribute;
00031 import javax.management.AttributeList;
00032 import javax.management.AttributeNotFoundException;
00033 import javax.management.InstanceAlreadyExistsException;
00034 import javax.management.InstanceNotFoundException;
00035 import javax.management.IntrospectionException;
00036 import javax.management.InvalidAttributeValueException;
00037 import javax.management.ListenerNotFoundException;
00038 import javax.management.MBeanException;
00039 import javax.management.MBeanInfo;
00040 import javax.management.MBeanRegistrationException;
00041 import javax.management.MBeanServer;
00042 import javax.management.NotCompliantMBeanException;
00043 import javax.management.NotificationFilter;
00044 import javax.management.NotificationListener;
00045 import javax.management.ObjectInstance;
00046 import javax.management.ObjectName;
00047 import javax.management.OperationsException;
00048 import javax.management.QueryExp;
00049 import javax.management.ReflectionException;
00050 import javax.management.loading.ClassLoaderRepository;
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062 public class ChainedMBeanServer implements MBeanServer
00063
00064 {
00065 private MBeanServer mbServer;
00066
00067
00068
00069
00070
00071 public ChainedMBeanServer()
00072 {
00073 this(null);
00074 }
00075
00076
00077
00078
00079
00080
00081
00082 public ChainedMBeanServer(MBeanServer server)
00083 {
00084 setMBeanServer(server);
00085 }
00086
00087
00088
00089
00090 protected synchronized MBeanServer getMBeanServer()
00091 {
00092 return mbServer;
00093 }
00094
00095 protected synchronized void setMBeanServer(MBeanServer server)
00096 {
00097 mbServer = server;
00098 }
00099
00100
00101
00102
00103
00104
00105 public void addNotificationListener(ObjectName observed,
00106 NotificationListener listener, NotificationFilter filter, Object handback)
00107 throws InstanceNotFoundException
00108 {
00109 getMBeanServer().addNotificationListener(observed, listener, filter,
00110 handback);
00111 }
00112
00113
00114
00115
00116
00117
00118 public void addNotificationListener(ObjectName observed, ObjectName listener,
00119 NotificationFilter filter, Object handback)
00120 throws InstanceNotFoundException
00121 {
00122 getMBeanServer().addNotificationListener(observed, listener, filter,
00123 handback);
00124 }
00125
00126
00127
00128
00129
00130 public ObjectInstance createMBean(String className, ObjectName objectName)
00131 throws ReflectionException, InstanceAlreadyExistsException,
00132 MBeanRegistrationException, MBeanException, NotCompliantMBeanException
00133 {
00134 return getMBeanServer().createMBean(className, objectName);
00135 }
00136
00137
00138
00139
00140
00141 public ObjectInstance createMBean(String className, ObjectName objectName,
00142 Object[] args, String[] parameters) throws ReflectionException,
00143 InstanceAlreadyExistsException, MBeanRegistrationException,
00144 MBeanException, NotCompliantMBeanException
00145 {
00146 return getMBeanServer()
00147 .createMBean(className, objectName, args, parameters);
00148 }
00149
00150
00151
00152
00153
00154 public ObjectInstance createMBean(String className, ObjectName objectName,
00155 ObjectName loaderName) throws ReflectionException,
00156 InstanceAlreadyExistsException, MBeanRegistrationException,
00157 MBeanException, NotCompliantMBeanException, InstanceNotFoundException
00158 {
00159 return getMBeanServer().createMBean(className, objectName, loaderName);
00160 }
00161
00162
00163
00164
00165
00166
00167 public ObjectInstance createMBean(String className, ObjectName objectName,
00168 ObjectName loaderName, Object[] args, String[] parameters)
00169 throws ReflectionException, InstanceAlreadyExistsException,
00170 MBeanRegistrationException, MBeanException, NotCompliantMBeanException,
00171 InstanceNotFoundException
00172 {
00173 return getMBeanServer().createMBean(className, objectName, loaderName,
00174 args, parameters);
00175 }
00176
00177
00178
00179
00180 public ObjectInputStream deserialize(String className, byte[] bytes)
00181 throws OperationsException, ReflectionException
00182 {
00183 return getMBeanServer().deserialize(className, bytes);
00184 }
00185
00186
00187
00188
00189
00190 public ObjectInputStream deserialize(String className, ObjectName loaderName,
00191 byte[] bytes) throws InstanceNotFoundException, OperationsException,
00192 ReflectionException
00193 {
00194 return getMBeanServer().deserialize(className, loaderName, bytes);
00195 }
00196
00197
00198
00199
00200
00201 public ObjectInputStream deserialize(ObjectName objectName, byte[] bytes)
00202 throws InstanceNotFoundException, OperationsException
00203 {
00204 return getMBeanServer().deserialize(objectName, bytes);
00205 }
00206
00207
00208
00209
00210
00211 public Object getAttribute(ObjectName objectName, String attribute)
00212 throws MBeanException, AttributeNotFoundException,
00213 InstanceNotFoundException, ReflectionException
00214 {
00215 return getMBeanServer().getAttribute(objectName, attribute);
00216 }
00217
00218
00219
00220
00221
00222 public AttributeList getAttributes(ObjectName objectName, String[] attributes)
00223 throws InstanceNotFoundException, ReflectionException
00224 {
00225 return getMBeanServer().getAttributes(objectName, attributes);
00226 }
00227
00228
00229
00230
00231 public String getDefaultDomain()
00232 {
00233 return getMBeanServer().getDefaultDomain();
00234 }
00235
00236
00237
00238
00239 public String[] getDomains()
00240 {
00241 return getMBeanServer().getDomains();
00242 }
00243
00244
00245
00246
00247 public Integer getMBeanCount()
00248 {
00249 return getMBeanServer().getMBeanCount();
00250 }
00251
00252
00253
00254
00255 public MBeanInfo getMBeanInfo(ObjectName objectName)
00256 throws InstanceNotFoundException, IntrospectionException,
00257 ReflectionException
00258 {
00259 return getMBeanServer().getMBeanInfo(objectName);
00260 }
00261
00262
00263
00264
00265 public ObjectInstance getObjectInstance(ObjectName objectName)
00266 throws InstanceNotFoundException
00267 {
00268 return getMBeanServer().getObjectInstance(objectName);
00269 }
00270
00271
00272
00273
00274 public Object instantiate(String className) throws ReflectionException,
00275 MBeanException
00276 {
00277 return getMBeanServer().instantiate(className);
00278 }
00279
00280
00281
00282
00283
00284 public Object instantiate(String className, Object[] args, String[] parameters)
00285 throws ReflectionException, MBeanException
00286 {
00287 return getMBeanServer().instantiate(className, args, parameters);
00288 }
00289
00290
00291
00292
00293
00294 public Object instantiate(String className, ObjectName loaderName)
00295 throws ReflectionException, MBeanException, InstanceNotFoundException
00296 {
00297 return getMBeanServer().instantiate(className, loaderName);
00298 }
00299
00300
00301
00302
00303
00304 public Object instantiate(String className, ObjectName loaderName,
00305 Object[] args, String[] parameters) throws ReflectionException,
00306 MBeanException, InstanceNotFoundException
00307 {
00308 return getMBeanServer()
00309 .instantiate(className, loaderName, args, parameters);
00310 }
00311
00312
00313
00314
00315
00316 public Object invoke(ObjectName objectName, String methodName, Object[] args,
00317 String[] parameters) throws InstanceNotFoundException, MBeanException,
00318 ReflectionException
00319 {
00320 return getMBeanServer().invoke(objectName, methodName, args, parameters);
00321 }
00322
00323
00324
00325
00326
00327 public boolean isInstanceOf(ObjectName objectName, String className)
00328 throws InstanceNotFoundException
00329 {
00330 return getMBeanServer().isInstanceOf(objectName, className);
00331 }
00332
00333
00334
00335
00336 public boolean isRegistered(ObjectName objectname)
00337 {
00338 return getMBeanServer().isRegistered(objectname);
00339 }
00340
00341
00342
00343
00344
00345 public Set queryMBeans(ObjectName patternName, QueryExp filter)
00346 {
00347 return getMBeanServer().queryMBeans(patternName, filter);
00348 }
00349
00350
00351
00352
00353
00354 public Set queryNames(ObjectName patternName, QueryExp filter)
00355 {
00356 return getMBeanServer().queryNames(patternName, filter);
00357 }
00358
00359
00360
00361
00362
00363 public ObjectInstance registerMBean(Object mbean, ObjectName objectName)
00364 throws InstanceAlreadyExistsException, MBeanRegistrationException,
00365 NotCompliantMBeanException
00366 {
00367 return getMBeanServer().registerMBean(mbean, objectName);
00368 }
00369
00370
00371
00372
00373
00374 public void removeNotificationListener(ObjectName observed,
00375 NotificationListener listener) throws InstanceNotFoundException,
00376 ListenerNotFoundException
00377 {
00378 getMBeanServer().removeNotificationListener(observed, listener);
00379 }
00380
00381
00382
00383
00384
00385 public void removeNotificationListener(ObjectName observed,
00386 ObjectName listener) throws InstanceNotFoundException,
00387 ListenerNotFoundException
00388 {
00389 getMBeanServer().removeNotificationListener(observed, listener);
00390 }
00391
00392
00393
00394
00395
00396
00397 public void removeNotificationListener(ObjectName observed,
00398 ObjectName listener, NotificationFilter filter, Object handback)
00399 throws InstanceNotFoundException, ListenerNotFoundException
00400 {
00401 getMBeanServer().removeNotificationListener(observed, listener, filter,
00402 handback);
00403 }
00404
00405
00406
00407
00408
00409
00410 public void removeNotificationListener(ObjectName observed,
00411 NotificationListener listener, NotificationFilter filter, Object handback)
00412 throws InstanceNotFoundException, ListenerNotFoundException
00413 {
00414 getMBeanServer().removeNotificationListener(observed, listener, filter,
00415 handback);
00416 }
00417
00418
00419
00420
00421
00422 public void setAttribute(ObjectName objectName, Attribute attribute)
00423 throws InstanceNotFoundException, AttributeNotFoundException,
00424 InvalidAttributeValueException, MBeanException, ReflectionException
00425 {
00426 getMBeanServer().setAttribute(objectName, attribute);
00427 }
00428
00429
00430
00431
00432
00433 public AttributeList setAttributes(ObjectName objectName,
00434 AttributeList attributes) throws InstanceNotFoundException,
00435 ReflectionException
00436 {
00437 return getMBeanServer().setAttributes(objectName, attributes);
00438 }
00439
00440
00441
00442
00443 public void unregisterMBean(ObjectName objectName)
00444 throws InstanceNotFoundException, MBeanRegistrationException
00445 {
00446 getMBeanServer().unregisterMBean(objectName);
00447 }
00448
00449
00450
00451
00452 public ClassLoader getClassLoaderFor(ObjectName mbeanName)
00453 throws InstanceNotFoundException
00454 {
00455 return getMBeanServer().getClassLoaderFor(mbeanName);
00456 }
00457
00458
00459
00460
00461 public ClassLoader getClassLoader(ObjectName loaderName)
00462 throws InstanceNotFoundException
00463 {
00464 return getMBeanServer().getClassLoader(loaderName);
00465 }
00466
00467
00468
00469
00470 public ClassLoaderRepository getClassLoaderRepository()
00471 {
00472 return getMBeanServer().getClassLoaderRepository();
00473 }
00474
00475 }