MBeanServerConnection.java 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. /* MBeanServerConnection.java -- Represents a connection to a management server.
  2. Copyright (C) 2006 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. 02110-1301 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package javax.management;
  32. import java.io.IOException;
  33. import java.util.Set;
  34. /**
  35. * This interface represents a communication mechanism which may
  36. * be used to access an MBean server, whether this be local or
  37. * remote. The {@link MBeanServer} interface extends this with
  38. * additional methods that apply only to local servers.
  39. *
  40. * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
  41. * @since 1.5
  42. */
  43. public interface MBeanServerConnection
  44. {
  45. /**
  46. * Registers the supplied listener with the specified management
  47. * bean. Notifications emitted by the management bean are forwarded
  48. * to the listener via the server, which will convert any MBean
  49. * references in the source to portable {@link ObjectName}
  50. * instances. The notification is otherwise unchanged.
  51. *
  52. * @param name the name of the management bean with which the listener
  53. * should be registered.
  54. * @param listener the listener which will handle notifications from
  55. * the bean.
  56. * @param filter the filter to apply to incoming notifications, or
  57. * <code>null</code> if no filtering should be applied.
  58. * @param passback an object to be passed to the listener when a
  59. * notification is emitted.
  60. * @throws InstanceNotFoundException if the name of the management bean
  61. * could not be resolved.
  62. * @throws IOException if an I/O error occurred in communicating with
  63. * the bean server.
  64. * @see #removeNotificationListener(ObjectName, NotificationListener)
  65. * @see #removeNotificationListener(ObjectName, NotificationListener,
  66. * NotificationFilter, Object)
  67. * @see NotificationBroadcaster#addNotificationListener(NotificationListener,
  68. * NotificationFilter,
  69. * Object)
  70. */
  71. void addNotificationListener(ObjectName name, NotificationListener listener,
  72. NotificationFilter filter, Object passback)
  73. throws InstanceNotFoundException, IOException;
  74. /**
  75. * <p>
  76. * Registers the supplied listener with the specified management
  77. * bean. Notifications emitted by the management bean are forwarded
  78. * to the listener via the server, which will convert any MBean
  79. * references in the source to portable {@link ObjectName}
  80. * instances. The notification is otherwise unchanged.
  81. * </p>
  82. * <p>
  83. * The listener that receives notifications will be the one that is
  84. * registered with the given name at the time this method is called.
  85. * Even if it later unregisters and ceases to use that name, it will
  86. * still receive notifications.
  87. * </p>
  88. *
  89. * @param name the name of the management bean with which the listener
  90. * should be registered.
  91. * @param listener the name of the listener which will handle
  92. * notifications from the bean.
  93. * @param filter the filter to apply to incoming notifications, or
  94. * <code>null</code> if no filtering should be applied.
  95. * @param passback an object to be passed to the listener when a
  96. * notification is emitted.
  97. * @throws InstanceNotFoundException if the name of the management bean
  98. * could not be resolved.
  99. * @throws RuntimeOperationsException if the bean associated with the given
  100. * object name is not a
  101. * {@link NotificationListener}. This
  102. * exception wraps an
  103. * {@link IllegalArgumentException}.
  104. * @throws IOException if an I/O error occurred in communicating with
  105. * the bean server.
  106. * @see #removeNotificationListener(ObjectName, NotificationListener)
  107. * @see #removeNotificationListener(ObjectName, NotificationListener,
  108. * NotificationFilter, Object)
  109. * @see NotificationBroadcaster#addNotificationListener(NotificationListener,
  110. * NotificationFilter,
  111. * Object)
  112. */
  113. void addNotificationListener(ObjectName name, ObjectName listener,
  114. NotificationFilter filter, Object passback)
  115. throws InstanceNotFoundException, RuntimeOperationsException, IOException;
  116. /**
  117. * <p>
  118. * Instantiates a new instance of the specified management bean
  119. * using the default constructor and registers it with the server
  120. * under the supplied name. The class is loaded using the
  121. * {@link javax.management.loading.ClassLoaderRepository default
  122. * loader repository} of the server.
  123. * </p>
  124. * <p>
  125. * If the name supplied is <code>null</code>, then the bean is
  126. * expected to implement the {@link MBeanRegistration} interface.
  127. * The {@link MBeanRegistration#preRegister preRegister} method
  128. * of this interface will be used to obtain the name in this case.
  129. * </p>
  130. * <p>
  131. * This method is equivalent to calling {@link
  132. * #createMBean(String, ObjectName, Object[], String[])
  133. * <code>createMBean(className, name, (Object[]) null,
  134. * (String[]) null)</code>} with <code>null</code> parameters
  135. * and signature.
  136. * </p>
  137. *
  138. * @param className the class of the management bean, of which
  139. * an instance should be created.
  140. * @param name the name to register the new bean with.
  141. * @return an {@link ObjectInstance} containing the {@link ObjectName}
  142. * and Java class name of the created instance.
  143. * @throws ReflectionException if an exception occurs in creating
  144. * an instance of the bean.
  145. * @throws InstanceAlreadyExistsException if a matching instance
  146. * already exists.
  147. * @throws MBeanRegistrationException if an exception occurs in
  148. * calling the preRegister
  149. * method.
  150. * @throws MBeanException if the bean's constructor throws an exception.
  151. * @throws NotCompliantMBeanException if the created bean is not
  152. * compliant with the JMX specification.
  153. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  154. * is thrown by the server due to a
  155. * <code>null</code> class name or object
  156. * name or if the object name is a pattern.
  157. * @throws IOException if an I/O error occurred in communicating with
  158. * the bean server.
  159. * @see #createMBean(String, ObjectName, Object[], String[])
  160. */
  161. ObjectInstance createMBean(String className, ObjectName name)
  162. throws ReflectionException, InstanceAlreadyExistsException,
  163. MBeanRegistrationException, MBeanException,
  164. NotCompliantMBeanException, IOException;
  165. /**
  166. * <p>
  167. * Instantiates a new instance of the specified management bean
  168. * using the given constructor and registers it with the server
  169. * under the supplied name. The class is loaded using the
  170. * {@link javax.management.loading.ClassLoaderRepository default
  171. * loader repository} of the server.
  172. * </p>
  173. * <p>
  174. * If the name supplied is <code>null</code>, then the bean is
  175. * expected to implement the {@link MBeanRegistration} interface.
  176. * The {@link MBeanRegistration#preRegister preRegister} method
  177. * of this interface will be used to obtain the name in this case.
  178. * </p>
  179. *
  180. * @param className the class of the management bean, of which
  181. * an instance should be created.
  182. * @param name the name to register the new bean with.
  183. * @param params the parameters for the bean's constructor.
  184. * @param sig the signature of the constructor to use.
  185. * @return an {@link ObjectInstance} containing the {@link ObjectName}
  186. * and Java class name of the created instance.
  187. * @throws ReflectionException if an exception occurs in creating
  188. * an instance of the bean.
  189. * @throws InstanceAlreadyExistsException if a matching instance
  190. * already exists.
  191. * @throws MBeanRegistrationException if an exception occurs in
  192. * calling the preRegister
  193. * method.
  194. * @throws MBeanException if the bean's constructor throws an exception.
  195. * @throws NotCompliantMBeanException if the created bean is not
  196. * compliant with the JMX specification.
  197. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  198. * is thrown by the server due to a
  199. * <code>null</code> class name or object
  200. * name or if the object name is a pattern.
  201. * @throws IOException if an I/O error occurred in communicating with
  202. * the bean server.
  203. */
  204. ObjectInstance createMBean(String className, ObjectName name,
  205. Object[] params, String[] sig)
  206. throws ReflectionException, InstanceAlreadyExistsException,
  207. MBeanRegistrationException, MBeanException,
  208. NotCompliantMBeanException, IOException;
  209. /**
  210. * <p>
  211. * Instantiates a new instance of the specified management bean
  212. * using the default constructor and registers it with the server
  213. * under the supplied name. The class is loaded using the
  214. * given class loader. If this argument is <code>null</code>,
  215. * then the same class loader as was used to load the server
  216. * is used.
  217. * </p>
  218. * <p>
  219. * If the name supplied is <code>null</code>, then the bean is
  220. * expected to implement the {@link MBeanRegistration} interface.
  221. * The {@link MBeanRegistration#preRegister preRegister} method
  222. * of this interface will be used to obtain the name in this case.
  223. * </p>
  224. * <p>
  225. * This method is equivalent to calling {@link
  226. * #createMBean(String, ObjectName, ObjectName, Object[], String)
  227. * <code>createMBean(className, name, loaderName, (Object[]) null,
  228. * (String) null)</code>} with <code>null</code> parameters
  229. * and signature.
  230. * </p>
  231. *
  232. * @param className the class of the management bean, of which
  233. * an instance should be created.
  234. * @param name the name to register the new bean with.
  235. * @param loaderName the name of the class loader.
  236. * @return an {@link ObjectInstance} containing the {@link ObjectName}
  237. * and Java class name of the created instance.
  238. * @throws ReflectionException if an exception occurs in creating
  239. * an instance of the bean.
  240. * @throws InstanceAlreadyExistsException if a matching instance
  241. * already exists.
  242. * @throws MBeanRegistrationException if an exception occurs in
  243. * calling the preRegister
  244. * method.
  245. * @throws MBeanException if the bean's constructor throws an exception.
  246. * @throws NotCompliantMBeanException if the created bean is not
  247. * compliant with the JMX specification.
  248. * @throws InstanceNotFoundException if the specified class loader is not
  249. * registered with the server.
  250. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  251. * is thrown by the server due to a
  252. * <code>null</code> class name or object
  253. * name or if the object name is a pattern.
  254. * @throws IOException if an I/O error occurred in communicating with
  255. * the bean server.
  256. * @see #createMBean(String, ObjectName, ObjectName, Object[], String[])
  257. */
  258. ObjectInstance createMBean(String className, ObjectName name,
  259. ObjectName loaderName)
  260. throws ReflectionException, InstanceAlreadyExistsException,
  261. MBeanRegistrationException, MBeanException,
  262. NotCompliantMBeanException, InstanceNotFoundException,
  263. IOException;
  264. /**
  265. * <p>
  266. * Instantiates a new instance of the specified management bean
  267. * using the given constructor and registers it with the server
  268. * under the supplied name. The class is loaded using the
  269. * given class loader. If this argument is <code>null</code>,
  270. * then the same class loader as was used to load the server
  271. * is used.
  272. * </p>
  273. * <p>
  274. * If the name supplied is <code>null</code>, then the bean is
  275. * expected to implement the {@link MBeanRegistration} interface.
  276. * The {@link MBeanRegistration#preRegister preRegister} method
  277. * of this interface will be used to obtain the name in this case.
  278. * </p>
  279. *
  280. * @param className the class of the management bean, of which
  281. * an instance should be created.
  282. * @param name the name to register the new bean with.
  283. * @param loaderName the name of the class loader.
  284. * @param params the parameters for the bean's constructor.
  285. * @param sig the signature of the constructor to use.
  286. * @return an {@link ObjectInstance} containing the {@link ObjectName}
  287. * and Java class name of the created instance.
  288. * @throws ReflectionException if an exception occurs in creating
  289. * an instance of the bean.
  290. * @throws InstanceAlreadyExistsException if a matching instance
  291. * already exists.
  292. * @throws MBeanRegistrationException if an exception occurs in
  293. * calling the preRegister
  294. * method.
  295. * @throws MBeanException if the bean's constructor throws an exception.
  296. * @throws NotCompliantMBeanException if the created bean is not
  297. * compliant with the JMX specification.
  298. * @throws InstanceNotFoundException if the specified class loader is not
  299. * registered with the server.
  300. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  301. * is thrown by the server due to a
  302. * <code>null</code> class name or object
  303. * name or if the object name is a pattern.
  304. * @throws IOException if an I/O error occurred in communicating with
  305. * the bean server.
  306. */
  307. ObjectInstance createMBean(String className, ObjectName name,
  308. ObjectName loaderName, Object[] params,
  309. String[] sig)
  310. throws ReflectionException, InstanceAlreadyExistsException,
  311. MBeanRegistrationException, MBeanException,
  312. NotCompliantMBeanException, InstanceNotFoundException,
  313. IOException;
  314. /**
  315. * Returns the value of the supplied attribute from the specified
  316. * management bean.
  317. *
  318. * @param bean the bean to retrieve the value from.
  319. * @param name the name of the attribute to retrieve.
  320. * @return the value of the attribute.
  321. * @throws AttributeNotFoundException if the attribute could not be
  322. * accessed from the bean.
  323. * @throws MBeanException if the management bean's accessor throws
  324. * an exception.
  325. * @throws InstanceNotFoundException if the bean can not be found.
  326. * @throws ReflectionException if an exception was thrown in trying
  327. * to invoke the bean's accessor.
  328. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  329. * is thrown by the server due to a
  330. * <code>null</code> bean or attribute
  331. * name.
  332. * @throws IOException if an I/O error occurred in communicating with
  333. * the bean server.
  334. * @see DynamicMBean#getAttribute(String)
  335. */
  336. Object getAttribute(ObjectName bean, String name)
  337. throws MBeanException, AttributeNotFoundException,
  338. InstanceNotFoundException, ReflectionException,
  339. IOException;
  340. /**
  341. * Returns the values of the named attributes from the specified
  342. * management bean.
  343. *
  344. * @param bean the bean to retrieve the value from.
  345. * @param names the names of the attributes to retrieve.
  346. * @return the values of the attributes.
  347. * @throws InstanceNotFoundException if the bean can not be found.
  348. * @throws ReflectionException if an exception was thrown in trying
  349. * to invoke the bean's accessor.
  350. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  351. * is thrown by the server due to a
  352. * <code>null</code> bean or attribute
  353. * name.
  354. * @throws IOException if an I/O error occurred in communicating with
  355. * the bean server.
  356. * @see DynamicMBean#getAttributes(String[])
  357. */
  358. AttributeList getAttributes(ObjectName bean, String[] names)
  359. throws InstanceNotFoundException, ReflectionException,
  360. IOException;
  361. /**
  362. * Returns the default domain this server applies to beans that have
  363. * no specified domain.
  364. *
  365. * @return the default domain.
  366. * @throws IOException if an I/O error occurred in communicating with
  367. * the bean server.
  368. */
  369. String getDefaultDomain()
  370. throws IOException;
  371. /**
  372. * Returns an array containing all the domains used by beans registered
  373. * with this server. The ordering of the array is undefined.
  374. *
  375. * @return the list of domains.
  376. * @throws IOException if an I/O error occurred in communicating with
  377. * the bean server.
  378. * @see ObjectName#getDomain()
  379. */
  380. String[] getDomains()
  381. throws IOException;
  382. /**
  383. * Returns the number of management beans registered with this server.
  384. *
  385. * @return the number of registered beans.
  386. * @throws IOException if an I/O error occurred in communicating with
  387. * the bean server.
  388. */
  389. Integer getMBeanCount()
  390. throws IOException;
  391. /**
  392. * Returns information on the given management bean.
  393. *
  394. * @param name the name of the management bean.
  395. * @return an instance of {@link MBeanInfo} for the bean.
  396. * @throws IntrospectionException if an exception occurs in examining
  397. * the bean.
  398. * @throws InstanceNotFoundException if the bean can not be found.
  399. * @throws ReflectionException if an exception occurs when trying
  400. * to invoke {@link DynamicMBean#getMBeanInfo()}
  401. * on the bean.
  402. * @throws IOException if an I/O error occurred in communicating with
  403. * the bean server.
  404. * @see DynamicMBean#getMBeanInfo()
  405. */
  406. MBeanInfo getMBeanInfo(ObjectName name)
  407. throws InstanceNotFoundException, IntrospectionException,
  408. ReflectionException, IOException;
  409. /**
  410. * Returns the {@link ObjectInstance} created for the specified
  411. * management bean on registration.
  412. *
  413. * @param name the name of the bean.
  414. * @return the corresponding {@link ObjectInstance} instance.
  415. * @throws InstanceNotFoundException if the bean can not be found.
  416. * @throws IOException if an I/O error occurred in communicating with
  417. * the bean server.
  418. * @see #createMBean(String, ObjectName)
  419. */
  420. ObjectInstance getObjectInstance(ObjectName name)
  421. throws InstanceNotFoundException, IOException;
  422. /**
  423. * Invokes the supplied operation on the specified management
  424. * bean. The class objects specified in the signature are loaded
  425. * using the same class loader as was used for the management bean.
  426. *
  427. * @param bean the management bean whose operation should be invoked.
  428. * @param name the name of the operation to invoke.
  429. * @param params the parameters of the operation.
  430. * @param sig the signature of the operation.
  431. * @return the return value of the method.
  432. * @throws InstanceNotFoundException if the bean can not be found.
  433. * @throws MBeanException if the method invoked throws an exception.
  434. * @throws ReflectionException if an exception is thrown in invoking the
  435. * method.
  436. * @throws IOException if an I/O error occurred in communicating with
  437. * the bean server.
  438. * @see DynamicMBean#invoke(String, Object[], String[])
  439. */
  440. Object invoke(ObjectName bean, String name, Object[] params, String[] sig)
  441. throws InstanceNotFoundException, MBeanException,
  442. ReflectionException, IOException;
  443. /**
  444. * <p>
  445. * Returns true if the specified management bean is an instance
  446. * of the supplied class.
  447. * </p>
  448. * <p>
  449. * A bean, B, is an instance of a class, C, if either of the following
  450. * conditions holds:
  451. * </p>
  452. * <ul>
  453. * <li>The class name in B's {@link MBeanInfo} is equal to the supplied
  454. * name.</li>
  455. * <li>Both the class of B and C were loaded by the same class loader,
  456. * and B is assignable to C.</li>
  457. * </ul>
  458. *
  459. * @param name the name of the management bean.
  460. * @param className the name of the class to test if <code>name</code> is
  461. * an instance of.
  462. * @return true if either B is directly an instance of the named class,
  463. * or B is assignable to the class, given that both it and B's
  464. * current class were loaded using the same class loader.
  465. * @throws InstanceNotFoundException if the bean can not be found.
  466. * @throws IOException if an I/O error occurred in communicating with
  467. * the bean server.
  468. */
  469. boolean isInstanceOf(ObjectName name, String className)
  470. throws InstanceNotFoundException, IOException;
  471. /**
  472. * Returns true if the specified management bean is registered with
  473. * the server.
  474. *
  475. * @param name the name of the management bean.
  476. * @return true if the bean is registered.
  477. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  478. * is thrown by the server due to a
  479. * <code>null</code> bean name.
  480. * @throws IOException if an I/O error occurred in communicating with
  481. * the bean server.
  482. */
  483. boolean isRegistered(ObjectName name)
  484. throws IOException;
  485. /**
  486. * <p>
  487. * Returns a set of {@link ObjectInstance}s matching the specified
  488. * criteria. The full set of beans registered with the server
  489. * are passed through two filters:
  490. * </p>
  491. * <ol>
  492. * <li>Pattern matching is performed using the supplied
  493. * {@link ObjectName}.</li>
  494. * <li>The supplied query expression is applied.</li>
  495. * </ol>
  496. * <p>
  497. * If both the object name and the query expression are <code>null</code>,
  498. * or the object name has no domain and no key properties,
  499. * no filtering will be performed and all beans are returned.
  500. * </p>
  501. *
  502. * @param name an {@link ObjectName} to use as a filter.
  503. * @param query a query expression to apply to each of the beans that match
  504. * the given object name.
  505. * @return a set of {@link ObjectInstance}s matching the filtered beans.
  506. * @throws IOException if an I/O error occurred in communicating with
  507. * the bean server.
  508. */
  509. Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query)
  510. throws IOException;
  511. /**
  512. * <p>
  513. * Returns a set of {@link ObjectName}s matching the specified
  514. * criteria. The full set of beans registered with the server
  515. * are passed through two filters:
  516. * </p>
  517. * <ol>
  518. * <li>Pattern matching is performed using the supplied
  519. * {@link ObjectName}.</li>
  520. * <li>The supplied query expression is applied.</li>
  521. * </ol>
  522. * <p>
  523. * If both the object name and the query expression are <code>null</code>,
  524. * or the object name has no domain and no key properties,
  525. * no filtering will be performed and all beans are returned.
  526. * </p>
  527. *
  528. * @param name an {@link ObjectName} to use as a filter.
  529. * @param query a query expression to apply to each of the beans that match
  530. * the given object name.
  531. * @return a set of {@link ObjectName}s matching the filtered beans.
  532. * @throws IOException if an I/O error occurred in communicating with
  533. * the bean server.
  534. */
  535. Set<ObjectName> queryNames(ObjectName name, QueryExp query)
  536. throws IOException;
  537. /**
  538. * Removes the specified listener from the list of recipients
  539. * of notifications from the supplied bean. This includes all
  540. * combinations of filters and passback objects registered for
  541. * this listener. For more specific removal of listeners, see
  542. * {@link #removeNotificationListener(ObjectName,
  543. * NotificationListener,NotificationFilter,Object)}
  544. *
  545. * @param name the name of the management bean from which the
  546. * listener should be removed.
  547. * @param listener the listener to remove.
  548. * @throws InstanceNotFoundException if the bean can not be found.
  549. * @throws ListenerNotFoundException if the specified listener
  550. * is not registered with the bean.
  551. * @throws IOException if an I/O error occurred in communicating with
  552. * the bean server.
  553. * @see #addNotificationListener(NotificationListener, NotificationFilter,
  554. * java.lang.Object)
  555. * @see NotificationBroadcaster#removeNotificationListener(NotificationListener)
  556. */
  557. void removeNotificationListener(ObjectName name,
  558. NotificationListener listener)
  559. throws InstanceNotFoundException, ListenerNotFoundException,
  560. IOException;
  561. /**
  562. * Removes the specified listener from the list of recipients
  563. * of notifications from the supplied bean. Only the first instance with
  564. * the supplied filter and passback object is removed.
  565. * <code>null</code> is used as a valid value for these parameters,
  566. * rather than as a way to remove all registration instances for
  567. * the specified listener; for this behaviour instead, see
  568. * {@link #removeNotificationListener(ObjectName, NotificationListener)}.
  569. *
  570. * @param name the name of the management bean from which the
  571. * listener should be removed.
  572. * @param listener the listener to remove.
  573. * @param filter the filter of the listener to remove.
  574. * @param passback the passback object of the listener to remove.
  575. * @throws InstanceNotFoundException if the bean can not be found.
  576. * @throws ListenerNotFoundException if the specified listener
  577. * is not registered with the bean.
  578. * @throws IOException if an I/O error occurred in communicating with
  579. * the bean server.
  580. * @see #addNotificationListener(ObjectName, NotificationListener,
  581. * NotificationFilter, Object)
  582. * @see NotificationEmitter#removeNotificationListener(NotificationListener,
  583. * NotificationFilter,
  584. * Object)
  585. */
  586. void removeNotificationListener(ObjectName name,
  587. NotificationListener listener,
  588. NotificationFilter filter,
  589. Object passback)
  590. throws InstanceNotFoundException, ListenerNotFoundException,
  591. IOException;
  592. /**
  593. * Removes the specified listener from the list of recipients
  594. * of notifications from the supplied bean. This includes all
  595. * combinations of filters and passback objects registered for
  596. * this listener. For more specific removal of listeners, see
  597. * {@link #removeNotificationListener(ObjectName,
  598. * ObjectName,NotificationFilter,Object)}
  599. *
  600. * @param name the name of the management bean from which the
  601. * listener should be removed.
  602. * @param listener the name of the listener to remove.
  603. * @throws InstanceNotFoundException if a name doesn't match a registered
  604. * bean.
  605. * @throws ListenerNotFoundException if the specified listener
  606. * is not registered with the bean.
  607. * @throws IOException if an I/O error occurred in communicating with
  608. * the bean server.
  609. * @see #addNotificationListener(NotificationListener, NotificationFilter,
  610. * java.lang.Object)
  611. * @see NotificationBroadcaster#removeNotificationListener(NotificationListener)
  612. */
  613. void removeNotificationListener(ObjectName name, ObjectName listener)
  614. throws InstanceNotFoundException, ListenerNotFoundException,
  615. IOException;
  616. /**
  617. * Removes the specified listener from the list of recipients
  618. * of notifications from the supplied bean. Only the first instance with
  619. * the supplied filter and passback object is removed.
  620. * <code>null</code> is used as a valid value for these parameters,
  621. * rather than as a way to remove all registration instances for
  622. * the specified listener; for this behaviour instead, see
  623. * {@link #removeNotificationListener(ObjectName, ObjectName)}.
  624. *
  625. * @param name the name of the management bean from which the
  626. * listener should be removed.
  627. * @param listener the name of the listener to remove.
  628. * @param filter the filter of the listener to remove.
  629. * @param passback the passback object of the listener to remove.
  630. * @throws InstanceNotFoundException if a name doesn't match a registered
  631. * bean.
  632. * @throws ListenerNotFoundException if the specified listener
  633. * is not registered with the bean.
  634. * @throws IOException if an I/O error occurred in communicating with
  635. * the bean server.
  636. * @see #addNotificationListener(ObjectName, NotificationListener,
  637. * NotificationFilter, Object)
  638. * @see NotificationEmitter#removeNotificationListener(NotificationListener,
  639. * NotificationFilter,
  640. * Object)
  641. */
  642. void removeNotificationListener(ObjectName name,
  643. ObjectName listener,
  644. NotificationFilter filter,
  645. Object passback)
  646. throws InstanceNotFoundException, ListenerNotFoundException,
  647. IOException;
  648. /**
  649. * Sets the value of the specified attribute of the supplied
  650. * management bean.
  651. *
  652. * @param name the name of the management bean.
  653. * @param attribute the attribute to set.
  654. * @throws InstanceNotFoundException if the bean can not be found.
  655. * @throws AttributeNotFoundException if the attribute does not
  656. * correspond to an attribute
  657. * of the bean.
  658. * @throws InvalidAttributeValueException if the value is invalid
  659. * for this particular
  660. * attribute of the bean.
  661. * @throws MBeanException if setting the attribute causes
  662. * the bean to throw an exception (which
  663. * becomes the cause of this exception).
  664. * @throws ReflectionException if an exception occurred in trying
  665. * to use the reflection interface
  666. * to lookup the attribute. The
  667. * thrown exception is the cause of
  668. * this exception.
  669. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  670. * is thrown by the server due to a
  671. * <code>null</code> bean or attribute
  672. * name.
  673. * @throws IOException if an I/O error occurred in communicating with
  674. * the bean server.
  675. * @see #getAttribute(ObjectName, String)
  676. * @see DynamicMBean#setAttribute(Attribute)
  677. */
  678. void setAttribute(ObjectName name, Attribute attribute)
  679. throws InstanceNotFoundException, AttributeNotFoundException,
  680. InvalidAttributeValueException, MBeanException,
  681. ReflectionException, IOException;
  682. /**
  683. * Sets the value of each of the specified attributes
  684. * of the supplied management bean to that specified by
  685. * the {@link Attribute} object. The returned list contains
  686. * the attributes that were set and their new values.
  687. *
  688. * @param name the name of the management bean.
  689. * @param attributes the attributes to set.
  690. * @return a list of the changed attributes.
  691. * @throws InstanceNotFoundException if the bean can not be found.
  692. * @throws ReflectionException if an exception occurred in trying
  693. * to use the reflection interface
  694. * to lookup the attribute. The
  695. * thrown exception is the cause of
  696. * this exception.
  697. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  698. * is thrown by the server due to a
  699. * <code>null</code> bean or attribute
  700. * list.
  701. * @throws IOException if an I/O error occurred in communicating with
  702. * the bean server.
  703. * @see #getAttributes(ObjectName, String[])
  704. * @see DynamicMBean#setAttributes(AttributeList)
  705. */
  706. AttributeList setAttributes(ObjectName name, AttributeList attributes)
  707. throws InstanceNotFoundException, ReflectionException,
  708. IOException;
  709. /**
  710. * Unregisters the specified management bean. Following this operation,
  711. * the bean instance is no longer accessible from the server via this
  712. * name. Prior to unregistering the bean, the
  713. * {@link MBeanRegistration#preDeregister()} method will be called if
  714. * the bean implements the {@link MBeanRegistration} interface.
  715. *
  716. * @param name the name of the management bean.
  717. * @throws InstanceNotFoundException if the bean can not be found.
  718. * @throws MBeanRegistrationException if an exception occurs in
  719. * calling the preDeregister
  720. * method.
  721. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  722. * is thrown by the server due to a
  723. * <code>null</code> bean name or a
  724. * request being made to unregister the
  725. * {@link MBeanServerDelegate} bean.
  726. * @throws IOException if an I/O error occurred in communicating with
  727. * the bean server.
  728. */
  729. void unregisterMBean(ObjectName name)
  730. throws InstanceNotFoundException, MBeanRegistrationException,
  731. IOException;
  732. }