1. /*
  2. * @(#)MBeanServerInterceptor.java 1.16 03/12/19
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package com.sun.jmx.interceptor;
  8. import java.util.Set;
  9. // RI import
  10. import javax.management.DynamicMBean;
  11. import javax.management.AttributeNotFoundException;
  12. import javax.management.MBeanException;
  13. import javax.management.ReflectionException;
  14. import javax.management.MBeanAttributeInfo;
  15. import javax.management.MBeanInfo;
  16. import javax.management.QueryExp;
  17. import javax.management.NotificationListener;
  18. import javax.management.NotificationFilter;
  19. import javax.management.ListenerNotFoundException;
  20. import javax.management.IntrospectionException;
  21. import javax.management.OperationsException;
  22. import javax.management.MBeanNotificationInfo;
  23. import javax.management.JMRuntimeException;
  24. import javax.management.InstanceNotFoundException;
  25. import javax.management.NotCompliantMBeanException;
  26. import javax.management.MBeanRegistrationException;
  27. import javax.management.InstanceAlreadyExistsException;
  28. import javax.management.InvalidAttributeValueException;
  29. import javax.management.ObjectName;
  30. import javax.management.ObjectInstance;
  31. import javax.management.Attribute;
  32. import javax.management.AttributeList;
  33. import javax.management.RuntimeOperationsException;
  34. import javax.management.MBeanServerConnection;
  35. import javax.management.MBeanServerDelegate;
  36. import javax.management.loading.ClassLoaderRepository;
  37. /**
  38. * <p>This interface specifies the behavior to be implemented by an
  39. * MBean Server Interceptor. An MBean Server Interceptor has
  40. * essentially the same interface as an MBean Server. An MBean Server
  41. * forwards received requests to its default interceptor, which may
  42. * handle them itself or forward them to other interceptors. The
  43. * default interceptor may be changed via the {@link
  44. * com.sun.jmx.mbeanserver.SunJmxMBeanServer#setMBeanServerInterceptor}
  45. * method.</p>
  46. *
  47. * <p>The initial default interceptor provides the standard MBean
  48. * Server behaviour. It handles a collection of named MBeans, each
  49. * represented by a Java object. A replacement default interceptor
  50. * may build on this behaviour, for instance by adding logging or
  51. * security checks, before forwarding requests to the initial default
  52. * interceptor. Or, it may route each request to one of a number of
  53. * sub-interceptors, for instance based on the {@link ObjectName} in
  54. * the request.</p>
  55. *
  56. * <p>An interceptor, default or not, need not implement MBeans as
  57. * Java objects, in the way that the initial default interceptor does.
  58. * It may instead implement <em>virtual MBeans</em>, which do not
  59. * exist as Java objects when they are not in use. For example, these
  60. * MBeans could be implemented by forwarding requests to a database,
  61. * or to a remote MBean server, or by performing system calls to query
  62. * or modify system resources.</p>
  63. *
  64. * @since 1.5
  65. */
  66. public interface MBeanServerInterceptor extends MBeanServerConnection {
  67. /**
  68. * Instantiates and registers an MBean in the MBean server. The
  69. * MBean server will use its {@link
  70. * javax.management.loading.ClassLoaderRepository Default Loader
  71. * Repository} to load the class of the MBean. An object name is
  72. * associated to the MBean. If the object name given is null, the
  73. * MBean must provide its own name by implementing the {@link
  74. * javax.management.MBeanRegistration MBeanRegistration} interface
  75. * and returning the name from the {@link
  76. * javax.management.MBeanRegistration#preRegister preRegister} method.
  77. *
  78. * @param className The class name of the MBean to be instantiated.
  79. * @param name The object name of the MBean. May be null.
  80. * @param params An array containing the parameters of the
  81. * constructor to be invoked.
  82. * @param signature An array containing the signature of the
  83. * constructor to be invoked.
  84. *
  85. * @return An <CODE>ObjectInstance</CODE>, containing the
  86. * <CODE>ObjectName</CODE> and the Java class name of the newly
  87. * instantiated MBean.
  88. *
  89. * @exception ReflectionException Wraps a
  90. * <CODE>java.lang.ClassNotFoundException</CODE> or a
  91. * <CODE>java.lang.Exception</CODE> that occurred when trying to
  92. * invoke the MBean's constructor.
  93. * @exception InstanceAlreadyExistsException The MBean is already
  94. * under the control of the MBean server.
  95. * @exception MBeanRegistrationException The
  96. * <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>
  97. * interface) method of the MBean has thrown an exception. The
  98. * MBean will not be registered.
  99. * @exception MBeanException The constructor of the MBean has
  100. * thrown an exception
  101. * @exception RuntimeOperationsException Wraps a
  102. * <CODE>java.lang.IllegalArgumentException</CODE>: The className
  103. * passed in parameter is null, the <CODE>ObjectName</CODE> passed
  104. * in parameter contains a pattern or no <CODE>ObjectName</CODE>
  105. * is specified for the MBean.
  106. */
  107. public ObjectInstance createMBean(String className, ObjectName name,
  108. Object params[], String signature[])
  109. throws ReflectionException, InstanceAlreadyExistsException,
  110. MBeanRegistrationException, MBeanException,
  111. NotCompliantMBeanException;
  112. /**
  113. * Instantiates and registers an MBean in the MBean server. The
  114. * class loader to be used is identified by its object name. An
  115. * object name is associated to the MBean. If the object name of
  116. * the loader is not specified, the ClassLoader that loaded the
  117. * MBean server will be used. If the MBean object name given is
  118. * null, the MBean must provide its own name by implementing the
  119. * {@link javax.management.MBeanRegistration MBeanRegistration}
  120. * interface and returning the name from the {@link
  121. * javax.management.MBeanRegistration#preRegister preRegister} method.
  122. *
  123. * @param className The class name of the MBean to be instantiated.
  124. * @param name The object name of the MBean. May be null.
  125. * @param params An array containing the parameters of the
  126. * constructor to be invoked.
  127. * @param signature An array containing the signature of the
  128. * constructor to be invoked.
  129. * @param loaderName The object name of the class loader to be used.
  130. *
  131. * @return An <CODE>ObjectInstance</CODE>, containing the
  132. * <CODE>ObjectName</CODE> and the Java class name of the newly
  133. * instantiated MBean.
  134. *
  135. * @exception ReflectionException Wraps a
  136. * <CODE>java.lang.ClassNotFoundException</CODE> or a
  137. * <CODE>java.lang.Exception</CODE> that occurred when trying to
  138. * invoke the MBean's constructor.
  139. * @exception InstanceAlreadyExistsException The MBean is already
  140. * under the control of the MBean server.
  141. * @exception MBeanRegistrationException The
  142. * <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>
  143. * interface) method of the MBean has thrown an exception. The
  144. * MBean will not be registered.
  145. * @exception MBeanException The constructor of the MBean has
  146. * thrown an exception
  147. * @exception InstanceNotFoundException The specified class loader
  148. * is not registered in the MBean server.
  149. * @exception RuntimeOperationsException Wraps a
  150. * <CODE>java.lang.IllegalArgumentException</CODE>: The className
  151. * passed in parameter is null, the <CODE>ObjectName</CODE> passed
  152. * in parameter contains a pattern or no <CODE>ObjectName</CODE>
  153. * is specified for the MBean.
  154. *
  155. */
  156. public ObjectInstance createMBean(String className, ObjectName name,
  157. ObjectName loaderName, Object params[],
  158. String signature[])
  159. throws ReflectionException, InstanceAlreadyExistsException,
  160. MBeanRegistrationException, MBeanException,
  161. NotCompliantMBeanException, InstanceNotFoundException;
  162. /**
  163. * Registers a pre-existing object as an MBean with the MBean
  164. * server. If the object name given is null, the MBean must
  165. * provide its own name by implementing the {@link
  166. * javax.management.MBeanRegistration MBeanRegistration} interface
  167. * and returning the name from the {@link
  168. * javax.management.MBeanRegistration#preRegister preRegister} method.
  169. *
  170. * @param object The MBean to be registered as an MBean.
  171. * @param name The object name of the MBean. May be null.
  172. *
  173. * @return The <CODE>ObjectInstance</CODE> for the MBean that has
  174. * been registered.
  175. *
  176. * @exception InstanceAlreadyExistsException The MBean is already
  177. * under the control of the MBean server.
  178. * @exception MBeanRegistrationException The
  179. * <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>
  180. * interface) method of the MBean has thrown an exception. The
  181. * MBean will not be registered.
  182. * @exception NotCompliantMBeanException This object is not a JMX
  183. * compliant MBean
  184. * @exception RuntimeOperationsException Wraps a
  185. * <CODE>java.lang.IllegalArgumentException</CODE>: The object
  186. * passed in parameter is null or no object name is specified.
  187. */
  188. public ObjectInstance registerMBean(Object object, ObjectName name)
  189. throws InstanceAlreadyExistsException, MBeanRegistrationException,
  190. NotCompliantMBeanException;
  191. /**
  192. * Unregisters an MBean from the MBean server. The MBean is
  193. * identified by its object name. Once the method has been
  194. * invoked, the MBean may no longer be accessed by its object
  195. * name.
  196. *
  197. * @param name The object name of the MBean to be unregistered.
  198. *
  199. * @exception InstanceNotFoundException The MBean specified is not
  200. * registered in the MBean server.
  201. * @exception MBeanRegistrationException The preDeregister
  202. * ((<CODE>MBeanRegistration</CODE> interface) method of the MBean
  203. * has thrown an exception.
  204. * @exception RuntimeOperationsException Wraps a
  205. * <CODE>java.lang.IllegalArgumentException</CODE>: The object
  206. * name in parameter is null or the MBean you are when trying to
  207. * unregister is the {@link javax.management.MBeanServerDelegate
  208. * MBeanServerDelegate} MBean.
  209. *
  210. */
  211. public void unregisterMBean(ObjectName name)
  212. throws InstanceNotFoundException, MBeanRegistrationException;
  213. /**
  214. * Gets the <CODE>ObjectInstance</CODE> for a given MBean
  215. * registered with the MBean server.
  216. *
  217. * @param name The object name of the MBean.
  218. *
  219. * @return The <CODE>ObjectInstance</CODE> associated to the MBean
  220. * specified by <VAR>name</VAR>.
  221. *
  222. * @exception InstanceNotFoundException The MBean specified is not
  223. * registered in the MBean server.
  224. */
  225. public ObjectInstance getObjectInstance(ObjectName name)
  226. throws InstanceNotFoundException;
  227. /**
  228. * Gets MBeans controlled by the MBean server. This method allows
  229. * any of the following to be obtained: All MBeans, a set of
  230. * MBeans specified by pattern matching on the
  231. * <CODE>ObjectName</CODE> and/or a Query expression, a specific
  232. * MBean. When the object name is null or no domain and key
  233. * properties are specified, all objects are to be selected (and
  234. * filtered if a query is specified). It returns the set of
  235. * <CODE>ObjectInstance</CODE> objects (containing the
  236. * <CODE>ObjectName</CODE> and the Java Class name) for the
  237. * selected MBeans.
  238. *
  239. * @param name The object name pattern identifying the MBeans to
  240. * be retrieved. If null or no domain and key properties are
  241. * specified, all the MBeans registered will be retrieved.
  242. * @param query The query expression to be applied for selecting
  243. * MBeans. If null no query expression will be applied for
  244. * selecting MBeans.
  245. *
  246. * @return A set containing the <CODE>ObjectInstance</CODE>
  247. * objects for the selected MBeans. If no MBean satisfies the
  248. * query an empty list is returned.
  249. */
  250. public Set queryMBeans(ObjectName name, QueryExp query);
  251. /**
  252. * Gets the names of MBeans controlled by the MBean server. This
  253. * method enables any of the following to be obtained: The names
  254. * of all MBeans, the names of a set of MBeans specified by
  255. * pattern matching on the <CODE>ObjectName</CODE> and/or a Query
  256. * expression, a specific MBean name (equivalent to testing
  257. * whether an MBean is registered). When the object name is null
  258. * or no domain and key properties are specified, all objects are
  259. * selected (and filtered if a query is specified). It returns the
  260. * set of ObjectNames for the MBeans selected.
  261. *
  262. * @param name The object name pattern identifying the MBean names
  263. * to be retrieved. If null oror no domain and key properties are
  264. * specified, the name of all registered MBeans will be retrieved.
  265. * @param query The query expression to be applied for selecting
  266. * MBeans. If null no query expression will be applied for
  267. * selecting MBeans.
  268. *
  269. * @return A set containing the ObjectNames for the MBeans
  270. * selected. If no MBean satisfies the query, an empty list is
  271. * returned.
  272. */
  273. public Set queryNames(ObjectName name, QueryExp query);
  274. /**
  275. * Checks whether an MBean, identified by its object name, is
  276. * already registered with the MBean server.
  277. *
  278. * @param name The object name of the MBean to be checked.
  279. *
  280. * @return True if the MBean is already registered in the MBean
  281. * server, false otherwise.
  282. *
  283. * @exception RuntimeOperationsException Wraps a
  284. * <CODE>java.lang.IllegalArgumentException</CODE>: The object
  285. * name in parameter is null.
  286. */
  287. public boolean isRegistered(ObjectName name);
  288. /**
  289. * Returns the number of MBeans registered in the MBean server.
  290. */
  291. public Integer getMBeanCount();
  292. /**
  293. * Gets the value of a specific attribute of a named MBean. The MBean
  294. * is identified by its object name.
  295. *
  296. * @param name The object name of the MBean from which the
  297. * attribute is to be retrieved.
  298. * @param attribute A String specifying the name of the attribute
  299. * to be retrieved.
  300. *
  301. * @return The value of the retrieved attribute.
  302. *
  303. * @exception AttributeNotFoundException The attribute specified
  304. * is not accessible in the MBean.
  305. * @exception MBeanException Wraps an exception thrown by the
  306. * MBean's getter.
  307. * @exception InstanceNotFoundException The MBean specified is not
  308. * registered in the MBean server.
  309. * @exception ReflectionException Wraps a
  310. * <CODE>java.lang.Exception</CODE> thrown when trying to invoke
  311. * the setter.
  312. * @exception RuntimeOperationsException Wraps a
  313. * <CODE>java.lang.IllegalArgumentException</CODE>: The object
  314. * name in parameter is null or the attribute in parameter is
  315. * null.
  316. */
  317. public Object getAttribute(ObjectName name, String attribute)
  318. throws MBeanException, AttributeNotFoundException,
  319. InstanceNotFoundException, ReflectionException;
  320. /**
  321. * Enables the values of several attributes of a named MBean. The MBean
  322. * is identified by its object name.
  323. *
  324. * @param name The object name of the MBean from which the
  325. * attributes are retrieved.
  326. * @param attributes A list of the attributes to be retrieved.
  327. *
  328. * @return The list of the retrieved attributes.
  329. *
  330. * @exception InstanceNotFoundException The MBean specified is not
  331. * registered in the MBean server.
  332. * @exception ReflectionException An exception occurred when
  333. * trying to invoke the getAttributes method of a Dynamic MBean.
  334. * @exception RuntimeOperationsException Wrap a
  335. * <CODE>java.lang.IllegalArgumentException</CODE>: The object
  336. * name in parameter is null or attributes in parameter is null.
  337. */
  338. public AttributeList getAttributes(ObjectName name, String[] attributes)
  339. throws InstanceNotFoundException, ReflectionException;
  340. /**
  341. * Sets the value of a specific attribute of a named MBean. The MBean
  342. * is identified by its object name.
  343. *
  344. * @param name The name of the MBean within which the attribute is
  345. * to be set.
  346. * @param attribute The identification of the attribute to be set
  347. * and the value it is to be set to.
  348. *
  349. * @return The value of the attribute that has been set.
  350. *
  351. * @exception InstanceNotFoundException The MBean specified is not
  352. * registered in the MBean server.
  353. * @exception AttributeNotFoundException The attribute specified
  354. * is not accessible in the MBean.
  355. * @exception InvalidAttributeValueException The value specified
  356. * for the attribute is not valid.
  357. * @exception MBeanException Wraps an exception thrown by the
  358. * MBean's setter.
  359. * @exception ReflectionException Wraps a
  360. * <CODE>java.lang.Exception</CODE> thrown when trying to invoke
  361. * the setter.
  362. * @exception RuntimeOperationsException Wraps a
  363. * <CODE>java.lang.IllegalArgumentException</CODE>: The object
  364. * name in parameter is null or the attribute in parameter is
  365. * null.
  366. */
  367. public void setAttribute(ObjectName name, Attribute attribute)
  368. throws InstanceNotFoundException, AttributeNotFoundException,
  369. InvalidAttributeValueException, MBeanException,
  370. ReflectionException;
  371. /**
  372. * Sets the values of several attributes of a named MBean. The MBean is
  373. * identified by its object name.
  374. *
  375. * @param name The object name of the MBean within which the
  376. * attributes are to be set.
  377. * @param attributes A list of attributes: The identification of
  378. * the attributes to be set and the values they are to be set to.
  379. *
  380. * @return The list of attributes that were set, with their new
  381. * values.
  382. *
  383. * @exception InstanceNotFoundException The MBean specified is not
  384. * registered in the MBean server.
  385. * @exception ReflectionException An exception occurred when
  386. * trying to invoke the getAttributes method of a Dynamic MBean.
  387. * @exception RuntimeOperationsException Wraps a
  388. * <CODE>java.lang.IllegalArgumentException</CODE>: The object
  389. * name in parameter is null or attributes in parameter is null.
  390. */
  391. public AttributeList setAttributes(ObjectName name,
  392. AttributeList attributes)
  393. throws InstanceNotFoundException, ReflectionException;
  394. /**
  395. * Invokes an operation on an MBean.
  396. *
  397. * @param name The object name of the MBean on which the method is
  398. * to be invoked.
  399. * @param operationName The name of the operation to be invoked.
  400. * @param params An array containing the parameters to be set when
  401. * the operation is invoked
  402. * @param signature An array containing the signature of the
  403. * operation. The class objects will be loaded using the same
  404. * class loader as the one used for loading the MBean on which the
  405. * operation was invoked.
  406. *
  407. * @return The object returned by the operation, which represents
  408. * the result ofinvoking the operation on the MBean specified.
  409. *
  410. * @exception InstanceNotFoundException The MBean specified is not
  411. * registered in the MBean server.
  412. * @exception MBeanException Wraps an exception thrown by the
  413. * MBean's invoked method.
  414. * @exception ReflectionException Wraps a
  415. * <CODE>java.lang.Exception</CODE> thrown while trying to invoke
  416. * the method.
  417. */
  418. public Object invoke(ObjectName name, String operationName,
  419. Object params[], String signature[])
  420. throws InstanceNotFoundException, MBeanException,
  421. ReflectionException;
  422. /**
  423. * Returns the default domain used for naming the MBean.
  424. * The default domain name is used as the domain part in the ObjectName
  425. * of MBeans if no domain is specified by the user.
  426. */
  427. public String getDefaultDomain();
  428. /**
  429. * Returns the list of domains in which any MBean is currently
  430. * registered.
  431. */
  432. public String[] getDomains();
  433. /**
  434. * <p>Adds a listener to a registered MBean.</p>
  435. *
  436. * <P> A notification emitted by an MBean will be forwarded by the
  437. * MBeanServer to the listener. If the source of the notification
  438. * is a reference to an MBean object, the MBean server will replace it
  439. * by that MBean's ObjectName. Otherwise the source is unchanged.
  440. *
  441. * @param name The name of the MBean on which the listener should
  442. * be added.
  443. * @param listener The listener object which will handle the
  444. * notifications emitted by the registered MBean.
  445. * @param filter The filter object. If filter is null, no
  446. * filtering will be performed before handling notifications.
  447. * @param handback The context to be sent to the listener when a
  448. * notification is emitted.
  449. *
  450. * @exception InstanceNotFoundException The MBean name provided
  451. * does not match any of the registered MBeans.
  452. */
  453. public void addNotificationListener(ObjectName name,
  454. NotificationListener listener,
  455. NotificationFilter filter,
  456. Object handback)
  457. throws InstanceNotFoundException;
  458. /**
  459. * <p>Adds a listener to a registered MBean.</p>
  460. *
  461. * <p>A notification emitted by an MBean will be forwarded by the
  462. * MBeanServer to the listener. If the source of the notification
  463. * is a reference to an MBean object, the MBean server will
  464. * replace it by that MBean's ObjectName. Otherwise the source is
  465. * unchanged.</p>
  466. *
  467. * <p>The listener object that receives notifications is the one
  468. * that is registered with the given name at the time this method
  469. * is called. Even if it is subsequently unregistered, it will
  470. * continue to receive notifications.</p>
  471. *
  472. * @param name The name of the MBean on which the listener should
  473. * be added.
  474. * @param listener The object name of the listener which will
  475. * handle the notifications emitted by the registered MBean.
  476. * @param filter The filter object. If filter is null, no
  477. * filtering will be performed before handling notifications.
  478. * @param handback The context to be sent to the listener when a
  479. * notification is emitted.
  480. *
  481. * @exception InstanceNotFoundException The MBean name of the
  482. * notification listener or of the notification broadcaster does
  483. * not match any of the registered MBeans.
  484. * @exception RuntimeOperationsException Wraps an {@link
  485. * IllegalArgumentException}. The MBean named by
  486. * <code>listener</code> exists but does not implement the {@link
  487. * NotificationListener} interface.
  488. * @exception IOException A communication problem occurred when
  489. * talking to the MBean server.
  490. */
  491. public void addNotificationListener(ObjectName name,
  492. ObjectName listener,
  493. NotificationFilter filter,
  494. Object handback)
  495. throws InstanceNotFoundException;
  496. /**
  497. * Removes a listener from a registered MBean.
  498. *
  499. * <P> If the listener is registered more than once, perhaps with
  500. * different filters or callbacks, this method will remove all
  501. * those registrations.
  502. *
  503. * @param name The name of the MBean on which the listener should
  504. * be removed.
  505. * @param listener The object name of the listener to be removed.
  506. *
  507. * @exception InstanceNotFoundException The MBean name provided
  508. * does not match any of the registered MBeans.
  509. * @exception ListenerNotFoundException The listener is not
  510. * registered in the MBean.
  511. */
  512. public void removeNotificationListener(ObjectName name,
  513. ObjectName listener)
  514. throws InstanceNotFoundException, ListenerNotFoundException;
  515. /**
  516. * <p>Removes a listener from a registered MBean.</p>
  517. *
  518. * <p>The MBean must have a listener that exactly matches the
  519. * given <code>listener</code>, <code>filter</code>, and
  520. * <code>handback</code> parameters. If there is more than one
  521. * such listener, only one is removed.</p>
  522. *
  523. * <p>The <code>filter</code> and <code>handback</code> parameters
  524. * may be null if and only if they are null in a listener to be
  525. * removed.</p>
  526. *
  527. * @param name The name of the MBean on which the listener should
  528. * be removed.
  529. * @param listener A listener that was previously added to this
  530. * MBean.
  531. * @param filter The filter that was specified when the listener
  532. * was added.
  533. * @param handback The handback that was specified when the
  534. * listener was added.
  535. *
  536. * @exception InstanceNotFoundException The MBean name provided
  537. * does not match any of the registered MBeans.
  538. * @exception ListenerNotFoundException The listener is not
  539. * registered in the MBean, or it is not registered with the given
  540. * filter and handback.
  541. */
  542. public void removeNotificationListener(ObjectName name,
  543. ObjectName listener,
  544. NotificationFilter filter,
  545. Object handback)
  546. throws InstanceNotFoundException, ListenerNotFoundException;
  547. /**
  548. * <p>Removes a listener from a registered MBean.</p>
  549. *
  550. * <P> If the listener is registered more than once, perhaps with
  551. * different filters or callbacks, this method will remove all
  552. * those registrations.
  553. *
  554. * @param name The name of the MBean on which the listener should
  555. * be removed.
  556. * @param listener The listener object which will handle the
  557. * notifications emitted by the registered MBean.
  558. *
  559. * @exception InstanceNotFoundException The MBean name provided
  560. * does not match any of the registered MBeans.
  561. * @exception ListenerNotFoundException The listener is not
  562. * registered in the MBean.
  563. */
  564. public void removeNotificationListener(ObjectName name,
  565. NotificationListener listener)
  566. throws InstanceNotFoundException, ListenerNotFoundException;
  567. /**
  568. * <p>Removes a listener from a registered MBean.</p>
  569. *
  570. * <p>The MBean must have a listener that exactly matches the
  571. * given <code>listener</code>, <code>filter</code>, and
  572. * <code>handback</code> parameters. If there is more than one
  573. * such listener, only one is removed.</p>
  574. *
  575. * <p>The <code>filter</code> and <code>handback</code> parameters
  576. * may be null if and only if they are null in a listener to be
  577. * removed.</p>
  578. *
  579. * @param name The name of the MBean on which the listener should
  580. * be removed.
  581. * @param listener A listener that was previously added to this
  582. * MBean.
  583. * @param filter The filter that was specified when the listener
  584. * was added.
  585. * @param handback The handback that was specified when the
  586. * listener was added.
  587. *
  588. * @exception InstanceNotFoundException The MBean name provided
  589. * does not match any of the registered MBeans.
  590. * @exception ListenerNotFoundException The listener is not
  591. * registered in the MBean, or it is not registered with the given
  592. * filter and handback.
  593. */
  594. public void removeNotificationListener(ObjectName name,
  595. NotificationListener listener,
  596. NotificationFilter filter,
  597. Object handback)
  598. throws InstanceNotFoundException, ListenerNotFoundException;
  599. /**
  600. * This method discovers the attributes and operations that an
  601. * MBean exposes for management.
  602. *
  603. * @param name The name of the MBean to analyze
  604. *
  605. * @return An instance of <CODE>MBeanInfo</CODE> allowing the
  606. * retrieval of all attributes and operations of this MBean.
  607. *
  608. * @exception IntrospectionException An exception occured during
  609. * introspection.
  610. * @exception InstanceNotFoundException The MBean specified was
  611. * not found.
  612. * @exception ReflectionException An exception occurred when
  613. * trying to invoke the getMBeanInfo of a Dynamic MBean.
  614. */
  615. public MBeanInfo getMBeanInfo(ObjectName name)
  616. throws InstanceNotFoundException, IntrospectionException,
  617. ReflectionException;
  618. /**
  619. * Returns true if the MBean specified is an instance of the
  620. * specified class, false otherwise.
  621. *
  622. * @param name The <CODE>ObjectName</CODE> of the MBean.
  623. * @param className The name of the class.
  624. *
  625. * @return true if the MBean specified is an instance of the
  626. * specified class, false otherwise.
  627. *
  628. * @exception InstanceNotFoundException The MBean specified is not
  629. * registered in the MBean server.
  630. */
  631. public boolean isInstanceOf(ObjectName name, String className)
  632. throws InstanceNotFoundException;
  633. /**
  634. * <p>Return the {@link java.lang.ClassLoader} that was used for
  635. * loading the class of the named MBean.
  636. * @param mbeanName The ObjectName of the MBean.
  637. * @return The ClassLoader used for that MBean.
  638. * @exception InstanceNotFoundException if the named MBean is not found.
  639. */
  640. public ClassLoader getClassLoaderFor(ObjectName mbeanName)
  641. throws InstanceNotFoundException;
  642. /**
  643. * <p>Return the named {@link java.lang.ClassLoader}.
  644. * @param loaderName The ObjectName of the ClassLoader.
  645. * @return The named ClassLoader.
  646. * @exception InstanceNotFoundException if the named ClassLoader is
  647. * not found.
  648. */
  649. public ClassLoader getClassLoader(ObjectName loaderName)
  650. throws InstanceNotFoundException;
  651. }