MBeanServer.java 61 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200
  1. /* MBeanServer.java -- Represents 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.ObjectInputStream;
  33. import java.util.Set;
  34. import javax.management.loading.ClassLoaderRepository;
  35. /**
  36. * <p>
  37. * This interface represents a server for management beans,
  38. * providing facilities for the creation, registration and
  39. * removal of such beans. This interface is central to the
  40. * Java management architecture. Users do not usually implement
  41. * this class. Instead, implementations of this class
  42. * may be obtained using an {@link MBeanServerFactory}.
  43. * </p>
  44. * <p>
  45. * Registering a bean with the server makes its attributes and
  46. * operations accessible via the server. Only JMX compliant
  47. * beans may be registered with the server. When a bean
  48. * is registered or unregistered, an {@link MBeanServerNotification}
  49. * is emitted by the server's {@link MBeanServerDelegate}.
  50. * Listeners may be registered with this bean in order to
  51. * obtain such notifications. It has the {@link ObjectName}
  52. * <code>JMImplementation:type=MBeanServerDelegate</code>.
  53. * </p>
  54. * <p>
  55. * Security checks are applied on the methods of the server,
  56. * as detailed below, if it is obtained using the
  57. * {@link MBeanServerFactory#createMBeanServer()} or
  58. * {@link MBeanServerFactory#newMBeanServer()} methods and
  59. * {@link System.getSecurityManager()} returns a non-<code>null</code>
  60. * value. If a check fails, a {@link SecurityException}
  61. * is thrown. Note than the class name used in the exception
  62. * is that of the bean, and thus, as a result, an
  63. * {@link InstanceNotFoundException}
  64. * precludes these security checks, due to the class name
  65. * that would be used in the exception being unavailable.
  66. * </p>
  67. *
  68. * @author Andrew John Hughes (gnu_andrew@member.fsf.org)
  69. * @since 1.5
  70. */
  71. public interface MBeanServer
  72. extends MBeanServerConnection
  73. {
  74. /**
  75. * Registers the supplied listener with the specified management
  76. * bean. Notifications emitted by the management bean are forwarded
  77. * to the listener via the server, which will convert any MBean
  78. * references in the source to portable {@link ObjectName}
  79. * instances. The notification is otherwise unchanged.
  80. *
  81. * @param name the name of the management bean with which the listener
  82. * should be registered.
  83. * @param listener the listener which will handle notifications from
  84. * the bean.
  85. * @param filter the filter to apply to incoming notifications, or
  86. * <code>null</code> if no filtering should be applied.
  87. * @param passback an object to be passed to the listener when a
  88. * notification is emitted.
  89. * @throws InstanceNotFoundException if the name of the management bean
  90. * could not be resolved.
  91. * @throws SecurityException if a security manager exists and the
  92. * caller's permissions don't imply {@link
  93. * MBeanPermission(String,String,ObjectName,String)
  94. * <code>MBeanPermission(className, null, name,
  95. * "addNotificationListener")</code>}.
  96. * @see #removeNotificationListener(ObjectName, NotificationListener)
  97. * @see #removeNotificationListener(ObjectName, NotificationListener,
  98. * NotificationFilter, Object)
  99. * @see NotificationBroadcaster#addNotificationListener(NotificationListener,
  100. * NotificationFilter,
  101. * Object)
  102. */
  103. void addNotificationListener(ObjectName name, NotificationListener listener,
  104. NotificationFilter filter, Object passback)
  105. throws InstanceNotFoundException;
  106. /**
  107. * <p>
  108. * Registers the supplied listener with the specified management
  109. * bean. Notifications emitted by the management bean are forwarded
  110. * to the listener via the server, which will convert any MBean
  111. * references in the source to portable {@link ObjectName}
  112. * instances. The notification is otherwise unchanged.
  113. * </p>
  114. * <p>
  115. * The listener that receives notifications will be the one that is
  116. * registered with the given name at the time this method is called.
  117. * Even if it later unregisters and ceases to use that name, it will
  118. * still receive notifications.
  119. * </p>
  120. *
  121. * @param name the name of the management bean with which the listener
  122. * should be registered.
  123. * @param listener the name of the listener which will handle
  124. * notifications from the bean.
  125. * @param filter the filter to apply to incoming notifications, or
  126. * <code>null</code> if no filtering should be applied.
  127. * @param passback an object to be passed to the listener when a
  128. * notification is emitted.
  129. * @throws InstanceNotFoundException if the name of the management bean
  130. * could not be resolved.
  131. * @throws RuntimeOperationsException if the bean associated with the given
  132. * object name is not a
  133. * {@link NotificationListener}. This
  134. * exception wraps an
  135. * {@link IllegalArgumentException}.
  136. * @throws SecurityException if a security manager exists and the
  137. * caller's permissions don't imply {@link
  138. * MBeanPermission(String,String,ObjectName,String)
  139. * <code>MBeanPermission(className, null, name,
  140. * "addNotificationListener")</code>}.
  141. * @see #removeNotificationListener(ObjectName, NotificationListener)
  142. * @see #removeNotificationListener(ObjectName, NotificationListener,
  143. * NotificationFilter, Object)
  144. * @see NotificationBroadcaster#addNotificationListener(NotificationListener,
  145. * NotificationFilter,
  146. * Object)
  147. */
  148. void addNotificationListener(ObjectName name, ObjectName listener,
  149. NotificationFilter filter, Object passback)
  150. throws InstanceNotFoundException;
  151. /**
  152. * <p>
  153. * Instantiates a new instance of the specified management bean
  154. * using the default constructor and registers it with the server
  155. * under the supplied name. The class is loaded using the
  156. * {@link javax.management.loading.ClassLoaderRepository default
  157. * loader repository} of the server.
  158. * </p>
  159. * <p>
  160. * If the name supplied is <code>null</code>, then the bean is
  161. * expected to implement the {@link MBeanRegistration} interface.
  162. * The {@link MBeanRegistration#preRegister preRegister} method
  163. * of this interface will be used to obtain the name in this case.
  164. * </p>
  165. * <p>
  166. * This method is equivalent to calling {@link
  167. * #createMBean(String, ObjectName, Object[], String[])
  168. * <code>createMBean(className, name, (Object[]) null,
  169. * (String[]) null)</code>} with <code>null</code> parameters
  170. * and signature.
  171. * </p>
  172. *
  173. * @param className the class of the management bean, of which
  174. * an instance should be created.
  175. * @param name the name to register the new bean with.
  176. * @return an {@link ObjectInstance} containing the {@link ObjectName}
  177. * and Java class name of the created instance.
  178. * @throws ReflectionException if an exception occurs in creating
  179. * an instance of the bean.
  180. * @throws InstanceAlreadyExistsException if a matching instance
  181. * already exists.
  182. * @throws MBeanRegistrationException if an exception occurs in
  183. * calling the preRegister
  184. * method.
  185. * @throws MBeanException if the bean's constructor throws an exception.
  186. * @throws NotCompliantMBeanException if the created bean is not
  187. * compliant with the JMX specification.
  188. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  189. * is thrown by the server due to a
  190. * <code>null</code> class name or object
  191. * name or if the object name is a pattern.
  192. * @throws SecurityException if a security manager exists and the
  193. * caller's permissions don't imply the
  194. * use of the <code>instantiate</code>
  195. * and <code>registerMBean</code> methods.
  196. * @see #createMBean(String, ObjectName, Object[], String[])
  197. */
  198. ObjectInstance createMBean(String className, ObjectName name)
  199. throws ReflectionException, InstanceAlreadyExistsException,
  200. MBeanRegistrationException, MBeanException,
  201. NotCompliantMBeanException;
  202. /**
  203. * <p>
  204. * Instantiates a new instance of the specified management bean
  205. * using the given constructor and registers it with the server
  206. * under the supplied name. The class is loaded using the
  207. * {@link javax.management.loading.ClassLoaderRepository default
  208. * loader repository} of the server.
  209. * </p>
  210. * <p>
  211. * If the name supplied is <code>null</code>, then the bean is
  212. * expected to implement the {@link MBeanRegistration} interface.
  213. * The {@link MBeanRegistration#preRegister preRegister} method
  214. * of this interface will be used to obtain the name in this case.
  215. * </p>
  216. *
  217. * @param className the class of the management bean, of which
  218. * an instance should be created.
  219. * @param name the name to register the new bean with.
  220. * @param params the parameters for the bean's constructor.
  221. * @param sig the signature of the constructor to use.
  222. * @return an {@link ObjectInstance} containing the {@link ObjectName}
  223. * and Java class name of the created instance.
  224. * @throws ReflectionException if an exception occurs in creating
  225. * an instance of the bean.
  226. * @throws InstanceAlreadyExistsException if a matching instance
  227. * already exists.
  228. * @throws MBeanRegistrationException if an exception occurs in
  229. * calling the preRegister
  230. * method.
  231. * @throws MBeanException if the bean's constructor throws an exception.
  232. * @throws NotCompliantMBeanException if the created bean is not
  233. * compliant with the JMX specification.
  234. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  235. * is thrown by the server due to a
  236. * <code>null</code> class name or object
  237. * name or if the object name is a pattern.
  238. * @throws SecurityException if a security manager exists and the
  239. * caller's permissions don't imply the
  240. * use of the <code>instantiate</code>
  241. * and <code>registerMBean</code> methods.
  242. */
  243. ObjectInstance createMBean(String className, ObjectName name,
  244. Object[] params, String[] sig)
  245. throws ReflectionException, InstanceAlreadyExistsException,
  246. MBeanRegistrationException, MBeanException,
  247. NotCompliantMBeanException;
  248. /**
  249. * <p>
  250. * Instantiates a new instance of the specified management bean
  251. * using the default constructor and registers it with the server
  252. * under the supplied name. The class is loaded using the
  253. * given class loader. If this argument is <code>null</code>,
  254. * then the same class loader as was used to load the server
  255. * is used.
  256. * </p>
  257. * <p>
  258. * If the name supplied is <code>null</code>, then the bean is
  259. * expected to implement the {@link MBeanRegistration} interface.
  260. * The {@link MBeanRegistration#preRegister preRegister} method
  261. * of this interface will be used to obtain the name in this case.
  262. * </p>
  263. * <p>
  264. * This method is equivalent to calling {@link
  265. * #createMBean(String, ObjectName, ObjectName, Object[], String)
  266. * <code>createMBean(className, name, loaderName, (Object[]) null,
  267. * (String) null)</code>} with <code>null</code> parameters
  268. * and signature.
  269. * </p>
  270. *
  271. * @param className the class of the management bean, of which
  272. * an instance should be created.
  273. * @param name the name to register the new bean with.
  274. * @param loaderName the name of the class loader.
  275. * @return an {@link ObjectInstance} containing the {@link ObjectName}
  276. * and Java class name of the created instance.
  277. * @throws ReflectionException if an exception occurs in creating
  278. * an instance of the bean.
  279. * @throws InstanceAlreadyExistsException if a matching instance
  280. * already exists.
  281. * @throws MBeanRegistrationException if an exception occurs in
  282. * calling the preRegister
  283. * method.
  284. * @throws MBeanException if the bean's constructor throws an exception.
  285. * @throws NotCompliantMBeanException if the created bean is not
  286. * compliant with the JMX specification.
  287. * @throws InstanceNotFoundException if the specified class loader is not
  288. * registered with the server.
  289. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  290. * is thrown by the server due to a
  291. * <code>null</code> class name or object
  292. * name or if the object name is a pattern.
  293. * @throws SecurityException if a security manager exists and the
  294. * caller's permissions don't imply the
  295. * use of the <code>instantiate</code>
  296. * and <code>registerMBean</code> methods.
  297. * @see #createMBean(String, ObjectName, ObjectName, Object[], String[])
  298. */
  299. ObjectInstance createMBean(String className, ObjectName name,
  300. ObjectName loaderName)
  301. throws ReflectionException, InstanceAlreadyExistsException,
  302. MBeanRegistrationException, MBeanException,
  303. NotCompliantMBeanException, InstanceNotFoundException;
  304. /**
  305. * <p>
  306. * Instantiates a new instance of the specified management bean
  307. * using the given constructor and registers it with the server
  308. * under the supplied name. The class is loaded using the
  309. * given class loader. If this argument is <code>null</code>,
  310. * then the same class loader as was used to load the server
  311. * is used.
  312. * </p>
  313. * <p>
  314. * If the name supplied is <code>null</code>, then the bean is
  315. * expected to implement the {@link MBeanRegistration} interface.
  316. * The {@link MBeanRegistration#preRegister preRegister} method
  317. * of this interface will be used to obtain the name in this case.
  318. * </p>
  319. *
  320. * @param className the class of the management bean, of which
  321. * an instance should be created.
  322. * @param name the name to register the new bean with.
  323. * @param loaderName the name of the class loader.
  324. * @param params the parameters for the bean's constructor.
  325. * @param sig the signature of the constructor to use.
  326. * @return an {@link ObjectInstance} containing the {@link ObjectName}
  327. * and Java class name of the created instance.
  328. * @throws ReflectionException if an exception occurs in creating
  329. * an instance of the bean.
  330. * @throws InstanceAlreadyExistsException if a matching instance
  331. * already exists.
  332. * @throws MBeanRegistrationException if an exception occurs in
  333. * calling the preRegister
  334. * method.
  335. * @throws MBeanException if the bean's constructor throws an exception.
  336. * @throws NotCompliantMBeanException if the created bean is not
  337. * compliant with the JMX specification.
  338. * @throws InstanceNotFoundException if the specified class loader is not
  339. * registered with the server.
  340. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  341. * is thrown by the server due to a
  342. * <code>null</code> class name or object
  343. * name or if the object name is a pattern.
  344. * @throws SecurityException if a security manager exists and the
  345. * caller's permissions don't imply the
  346. * use of the <code>instantiate</code>
  347. * and <code>registerMBean</code> methods.
  348. */
  349. ObjectInstance createMBean(String className, ObjectName name,
  350. ObjectName loaderName, Object[] params,
  351. String[] sig)
  352. throws ReflectionException, InstanceAlreadyExistsException,
  353. MBeanRegistrationException, MBeanException,
  354. NotCompliantMBeanException, InstanceNotFoundException;
  355. /**
  356. * Deserializes a byte array using the class loader of the specified
  357. * management bean as its context.
  358. *
  359. * @param name the name of the bean whose class loader should be used.
  360. * @param data the byte array to be deserialized.
  361. * @return the deserialized object stream.
  362. * @deprecated {@link #getClassLoaderFor(ObjectName)} should be used
  363. * to obtain the class loader of the bean, which can then
  364. * be used to perform deserialization in the user's code.
  365. * @throws InstanceNotFoundException if the specified bean is not
  366. * registered with the server.
  367. * @throws OperationsException if any I/O error is thrown by the
  368. * deserialization process.
  369. * @throws SecurityException if a security manager exists and the
  370. * caller's permissions don't imply {@link
  371. * MBeanPermission(String,String,ObjectName,String)
  372. * <code>MBeanPermission(className, null, name,
  373. * "getClassLoaderFor")</code>
  374. */
  375. ObjectInputStream deserialize(ObjectName name, byte[] data)
  376. throws InstanceNotFoundException, OperationsException;
  377. /**
  378. * Deserializes a byte array using the same class loader for its context
  379. * as was used to load the given class. This class loader is obtained by
  380. * loading the specified class using the {@link
  381. * javax.management.loading.ClassLoaderRepository Class Loader Repository}
  382. * and then using the class loader of the resulting {@link Class} instance.
  383. *
  384. * @param name the name of the class which should be loaded to obtain the
  385. * class loader.
  386. * @param data the byte array to be deserialized.
  387. * @return the deserialized object stream.
  388. * @deprecated {@link #getClassLoaderRepository} should be used
  389. * to obtain the class loading repository, which can then
  390. * be used to obtain the {@link Class} instance and deserialize
  391. * the array using its class loader.
  392. * @throws OperationsException if any I/O error is thrown by the
  393. * deserialization process.
  394. * @throws ReflectionException if an error occurs in obtaining the
  395. * {@link Class} instance.
  396. * @throws SecurityException if a security manager exists and the
  397. * caller's permissions don't imply {@link
  398. * MBeanPermission(String,String,ObjectName,String)
  399. * <code>MBeanPermission(null, null, null,
  400. * "getClassLoaderRepository")</code>
  401. */
  402. ObjectInputStream deserialize(String name, byte[] data)
  403. throws OperationsException, ReflectionException;
  404. /**
  405. * Deserializes a byte array using the same class loader for its context
  406. * as was used to load the given class. The name of the class loader to
  407. * be used is supplied, and may be <code>null</code> if the server's
  408. * class loader should be used instead.
  409. *
  410. * @param name the name of the class which should be loaded to obtain the
  411. * class loader.
  412. * @param loader the name of the class loader to use, or <code>null</code>
  413. * if the class loader of the server should be used.
  414. * @param data the byte array to be deserialized.
  415. * @return the deserialized object stream.
  416. * @deprecated {@link #getClassLoader(ObjectName} can be used to obtain
  417. * the named class loader and deserialize the array.
  418. * @throws InstanceNotFoundException if the specified class loader is not
  419. * registered with the server.
  420. * @throws OperationsException if any I/O error is thrown by the
  421. * deserialization process.
  422. * @throws ReflectionException if an error occurs in obtaining the
  423. * {@link Class} instance.
  424. * @throws SecurityException if a security manager exists and the
  425. * caller's permissions don't imply {@link
  426. * MBeanPermission(String,String,ObjectName,String)
  427. * <code>MBeanPermission(className, null, loader,
  428. * "getClassLoader")</code>
  429. */
  430. ObjectInputStream deserialize(String name, ObjectName loader, byte[] data)
  431. throws InstanceNotFoundException, ReflectionException,
  432. OperationsException;
  433. /**
  434. * Returns the value of the supplied attribute from the specified
  435. * management bean.
  436. *
  437. * @param bean the bean to retrieve the value from.
  438. * @param name the name of the attribute to retrieve.
  439. * @return the value of the attribute.
  440. * @throws AttributeNotFoundException if the attribute could not be
  441. * accessed from the bean.
  442. * @throws MBeanException if the management bean's accessor throws
  443. * an exception.
  444. * @throws InstanceNotFoundException if the bean can not be found.
  445. * @throws ReflectionException if an exception was thrown in trying
  446. * to invoke the bean's accessor.
  447. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  448. * is thrown by the server due to a
  449. * <code>null</code> bean or attribute
  450. * name.
  451. * @throws SecurityException if a security manager exists and the
  452. * caller's permissions don't imply {@link
  453. * MBeanPermission(String,String,ObjectName,String)
  454. * <code>MBeanPermission(className, name, bean,
  455. * "getAttribute")</code>}.
  456. * @see DynamicMBean#getAttribute(String)
  457. */
  458. Object getAttribute(ObjectName bean, String name)
  459. throws MBeanException, AttributeNotFoundException,
  460. InstanceNotFoundException, ReflectionException;
  461. /**
  462. * Returns the values of the named attributes from the specified
  463. * management bean.
  464. *
  465. * @param bean the bean to retrieve the value from.
  466. * @param names the names of the attributes to retrieve.
  467. * @return the values of the attributes.
  468. * @throws InstanceNotFoundException if the bean can not be found.
  469. * @throws ReflectionException if an exception was thrown in trying
  470. * to invoke the bean's accessor.
  471. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  472. * is thrown by the server due to a
  473. * <code>null</code> bean or attribute
  474. * name.
  475. * @throws SecurityException if a security manager exists and the
  476. * caller's permissions don't imply {@link
  477. * MBeanPermission(String,String,ObjectName,String)
  478. * <code>MBeanPermission(className, null, bean,
  479. * "getAttribute")</code>}. Additionally,
  480. * for an attribute name, <code>n</code>, the
  481. * caller's permission must imply {@link
  482. * MBeanPermission(String,String,ObjectName,String)
  483. * <code>MBeanPermission(className, n, bean,
  484. * "getAttribute")</code>} or that attribute will
  485. * not be included.
  486. *
  487. * @see DynamicMBean#getAttributes(String[])
  488. */
  489. AttributeList getAttributes(ObjectName bean, String[] names)
  490. throws InstanceNotFoundException, ReflectionException;
  491. /**
  492. * Returns the specified class loader. If the specified value is
  493. * <code>null</code>, then the class loader of the server will be
  494. * returned. If <code>l</code> is the requested class loader,
  495. * and <code>r</code> is the actual class loader returned, then
  496. * either <code>l</code> and <code>r</code> will be identical,
  497. * or they will at least return the same class from
  498. * {@link ClassLoader#loadClass(String)} for any given string.
  499. * They may not be identical due to one or the other
  500. * being wrapped in another class loader (e.g. for security).
  501. *
  502. * @param name the name of the class loader to return.
  503. * @return the class loader.
  504. * @throws InstanceNotFoundException if the class loader can not
  505. * be found.
  506. * @throws SecurityException if a security manager exists and the
  507. * caller's permissions don't imply {@link
  508. * MBeanPermission(String,String,ObjectName,String)
  509. * <code>MBeanPermission(className, null, name,
  510. * "getClassLoader")</code>
  511. */
  512. ClassLoader getClassLoader(ObjectName name)
  513. throws InstanceNotFoundException;
  514. /**
  515. * Returns the class loader of the specified management bean. If
  516. * <code>l</code> is the requested class loader, and <code>r</code>
  517. * is the actual class loader returned, then either <code>l</code>
  518. * and <code>r</code> will be identical, or they will at least
  519. * return the same class from {@link ClassLoader#loadClass(String)}
  520. * for any given string. They may not be identical due to one or
  521. * the other being wrapped in another class loader (e.g. for
  522. * security).
  523. *
  524. * @param name the name of the bean whose class loader should be
  525. * returned.
  526. * @return the class loader.
  527. * @throws InstanceNotFoundException if the bean is not registered
  528. * with the server.
  529. * @throws SecurityException if a security manager exists and the
  530. * caller's permissions don't imply {@link
  531. * MBeanPermission(String,String,ObjectName,String)
  532. * <code>MBeanPermission(className, null, name,
  533. * "getClassLoaderFor")</code>
  534. */
  535. ClassLoader getClassLoaderFor(ObjectName name)
  536. throws InstanceNotFoundException;
  537. /**
  538. * Returns the class loader repository used by this server.
  539. *
  540. * @return the class loader repository.
  541. * @throws SecurityException if a security manager exists and the
  542. * caller's permissions don't imply {@link
  543. * MBeanPermission(String,String,ObjectName,String)
  544. * <code>MBeanPermission(null, null, null,
  545. * "getClassLoaderRepository")</code>
  546. */
  547. ClassLoaderRepository getClassLoaderRepository();
  548. /**
  549. * Returns the default domain this server applies to beans that have
  550. * no specified domain.
  551. *
  552. * @return the default domain.
  553. */
  554. String getDefaultDomain();
  555. /**
  556. * Returns an array containing all the domains used by beans registered
  557. * with this server. The ordering of the array is undefined.
  558. *
  559. * @return the list of domains.
  560. * @throws SecurityException if a security manager exists and the
  561. * caller's permissions don't imply {@link
  562. * MBeanPermission(String,String,ObjectName,String)
  563. * <code>MBeanPermission(null, null, name,
  564. * "getDomains")</code>}. Additionally,
  565. * for an domain, <code>d</code>, the
  566. * caller's permission must imply {@link
  567. * MBeanPermission(String,String,ObjectName,String)
  568. * <code>MBeanPermission(null, null,
  569. * new ObjectName("d:x=x"), "getDomains")</code>}
  570. * or that domain will not be included. Note
  571. * that "x=x" is an arbitrary key-value pair
  572. * provided to satisfy the constructor.
  573. * @see ObjectName#getDomain()
  574. */
  575. String[] getDomains();
  576. /**
  577. * Returns the number of management beans registered with this server.
  578. * This may be less than the real number if the caller's access is
  579. * restricted.
  580. *
  581. * @return the number of registered beans.
  582. */
  583. Integer getMBeanCount();
  584. /**
  585. * Returns information on the given management bean.
  586. *
  587. * @param name the name of the management bean.
  588. * @return an instance of {@link MBeanInfo} for the bean.
  589. * @throws IntrospectionException if an exception occurs in examining
  590. * the bean.
  591. * @throws InstanceNotFoundException if the bean can not be found.
  592. * @throws ReflectionException if an exception occurs when trying
  593. * to invoke {@link DynamicMBean#getMBeanInfo()}
  594. * on the bean.
  595. * @throws SecurityException if a security manager exists and the
  596. * caller's permissions don't imply {@link
  597. * MBeanPermission(String,String,ObjectName,String)
  598. * <code>MBeanPermission(className, null, name,
  599. * "getMBeanInfo")</code>}.
  600. * @see DynamicMBean#getMBeanInfo()
  601. */
  602. MBeanInfo getMBeanInfo(ObjectName name)
  603. throws InstanceNotFoundException, IntrospectionException,
  604. ReflectionException;
  605. /**
  606. * Returns the {@link ObjectInstance} created for the specified
  607. * management bean on registration.
  608. *
  609. * @param name the name of the bean.
  610. * @return the corresponding {@link ObjectInstance} instance.
  611. * @throws InstanceNotFoundException if the bean can not be found.
  612. * @throws SecurityException if a security manager exists and the
  613. * caller's permissions don't imply {@link
  614. * MBeanPermission(String,String,ObjectName,String)
  615. * <code>MBeanPermission(className, null, name,
  616. * "getObjectInstance")</code>
  617. * @see #createMBean(String, ObjectName)
  618. */
  619. ObjectInstance getObjectInstance(ObjectName name)
  620. throws InstanceNotFoundException;
  621. /**
  622. * <p>
  623. * Creates an instance of the specified class using the list of
  624. * class loaders from the {@link
  625. * javax.management.loading.ClassLoaderRepository Class Loader
  626. * Repository}. The class should have a public constructor
  627. * with no arguments. A reference to the new instance is returned,
  628. * but the instance is not yet registered with the server.
  629. * </p>
  630. * <p>
  631. * This method is equivalent to calling {@link
  632. * #instantiate(String, Object[], String[])
  633. * <code>instantiate(name, (Object[]) null, (String[]) null)</code>}
  634. * with <code>null</code> parameters and signature.
  635. * </p>
  636. *
  637. * @param name the name of the class of bean to be instantiated.
  638. * @return an instance of the given class.
  639. * @throws ReflectionException if an exception is thrown during
  640. * loading the class or calling the
  641. * constructor.
  642. * @throws MBeanException if the constructor throws an exception.
  643. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  644. * is thrown by the server due to a
  645. * <code>null</code> name.
  646. * @throws SecurityException if a security manager exists and the
  647. * caller's permissions don't imply {@link
  648. * MBeanPermission(String,String,ObjectName,String)
  649. * <code>MBeanPermission(className, null, null,
  650. * "instantiate")</code>}.
  651. * @see #instantiate(String, Object[], String[])
  652. */
  653. Object instantiate(String name)
  654. throws ReflectionException, MBeanException;
  655. /**
  656. * Creates an instance of the specified class using the list of
  657. * class loaders from the {@link
  658. * javax.management.loading.ClassLoaderRepository Class Loader
  659. * Repository}. The class should have a public constructor
  660. * matching the supplied signature. A reference to the new
  661. * instance is returned, but the instance is not yet
  662. * registered with the server.
  663. *
  664. * @param name the name of the class of bean to be instantiated.
  665. * @param params the parameters for the constructor.
  666. * @param sig the signature of the constructor.
  667. * @return an instance of the given class.
  668. * @throws ReflectionException if an exception is thrown during
  669. * loading the class or calling the
  670. * constructor.
  671. * @throws MBeanException if the constructor throws an exception.
  672. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  673. * is thrown by the server due to a
  674. * <code>null</code> name.
  675. * @throws SecurityException if a security manager exists and the
  676. * caller's permissions don't imply {@link
  677. * MBeanPermission(String,String,ObjectName,String)
  678. * <code>MBeanPermission(className, null, null,
  679. * "instantiate")</code>}.
  680. */
  681. Object instantiate(String name, Object[] params, String[] sig)
  682. throws ReflectionException, MBeanException;
  683. /**
  684. * <p>
  685. * Creates an instance of the specified class using the supplied
  686. * class loader. If the class loader given is <code>null</code>,
  687. * then the class loader of the server will be used. The class
  688. * should have a public constructor with no arguments. A reference
  689. * to the new instance is returned, but the instance is not yet
  690. * registered with the server.
  691. * </p>
  692. * <p>
  693. * This method is equivalent to calling {@link
  694. * #instantiate(String, ObjectName, Object[], String[])
  695. * <code>instantiate(name, loaderName, (Object[]) null,
  696. * (String[]) null)</code>} with <code>null</code> parameters
  697. * and signature.
  698. * </p>
  699. *
  700. * @param name the name of the class of bean to be instantiated.
  701. * @param loaderName the name of the class loader to use.
  702. * @return an instance of the given class.
  703. * @throws InstanceNotFoundException if the class loader is not
  704. * registered with the server.
  705. * @throws ReflectionException if an exception is thrown during
  706. * loading the class or calling the
  707. * constructor.
  708. * @throws MBeanException if the constructor throws an exception.
  709. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  710. * is thrown by the server due to a
  711. * <code>null</code> name.
  712. * @throws SecurityException if a security manager exists and the
  713. * caller's permissions don't imply {@link
  714. * MBeanPermission(String,String,ObjectName,String)
  715. * <code>MBeanPermission(className, null, null,
  716. * "instantiate")</code>}.
  717. * @see #instantiate(String, Object[], String[])
  718. */
  719. Object instantiate(String name, ObjectName loaderName)
  720. throws InstanceNotFoundException, ReflectionException,
  721. MBeanException;
  722. /**
  723. * Creates an instance of the specified class using the supplied
  724. * class loader. If the class loader given is <code>null</code>,
  725. * then the class loader of the server will be used. The class
  726. * should have a public constructor matching the supplied
  727. * signature. A reference to the new instance is returned,
  728. * but the instance is not yet registered with the server.
  729. *
  730. * @param name the name of the class of bean to be instantiated.
  731. * @param loaderName the name of the class loader to use.
  732. * @param params the parameters for the constructor.
  733. * @param sig the signature of the constructor.
  734. * @return an instance of the given class.
  735. * @throws InstanceNotFoundException if the class loader is not
  736. * registered with the server.
  737. * @throws ReflectionException if an exception is thrown during
  738. * loading the class or calling the
  739. * constructor.
  740. * @throws MBeanException if the constructor throws an exception.
  741. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  742. * is thrown by the server due to a
  743. * <code>null</code> name.
  744. * @throws SecurityException if a security manager exists and the
  745. * caller's permissions don't imply {@link
  746. * MBeanPermission(String,String,ObjectName,String)
  747. * <code>MBeanPermission(className, null, null,
  748. * "instantiate")</code>}.
  749. */
  750. Object instantiate(String name, ObjectName loaderName,
  751. Object[] params, String[] sig)
  752. throws InstanceNotFoundException, ReflectionException,
  753. MBeanException;
  754. /**
  755. * Invokes the supplied operation on the specified management
  756. * bean. The class objects specified in the signature are loaded
  757. * using the same class loader as was used for the management bean.
  758. *
  759. * @param bean the management bean whose operation should be invoked.
  760. * @param name the name of the operation to invoke.
  761. * @param params the parameters of the operation.
  762. * @param sig the signature of the operation.
  763. * @return the return value of the method.
  764. * @throws InstanceNotFoundException if the bean can not be found.
  765. * @throws MBeanException if the method invoked throws an exception.
  766. * @throws ReflectionException if an exception is thrown in invoking the
  767. * method.
  768. * @throws SecurityException if a security manager exists and the
  769. * caller's permissions don't imply {@link
  770. * MBeanPermission(String,String,ObjectName,String)
  771. * <code>MBeanPermission(className, name, bean,
  772. * "invoke")</code>}.
  773. * @see DynamicMBean#invoke(String, Object[], String[])
  774. */
  775. Object invoke(ObjectName bean, String name, Object[] params, String[] sig)
  776. throws InstanceNotFoundException, MBeanException,
  777. ReflectionException;
  778. /**
  779. * <p>
  780. * Returns true if the specified management bean is an instance
  781. * of the supplied class.
  782. * </p>
  783. * <p>
  784. * A bean, B, is an instance of a class, C, if either of the following
  785. * conditions holds:
  786. * </p>
  787. * <ul>
  788. * <li>The class name in B's {@link MBeanInfo} is equal to the supplied
  789. * name.</li>
  790. * <li>Both the class of B and C were loaded by the same class loader,
  791. * and B is assignable to C.</li>
  792. * </ul>
  793. *
  794. * @param name the name of the management bean.
  795. * @param className the name of the class to test if <code>name</code> is
  796. * an instance of.
  797. * @return true if either B is directly an instance of the named class,
  798. * or B is assignable to the class, given that both it and B's
  799. * current class were loaded using the same class loader.
  800. * @throws InstanceNotFoundException if the bean can not be found.
  801. * @throws SecurityException if a security manager exists and the
  802. * caller's permissions don't imply {@link
  803. * MBeanPermission(String,String,ObjectName,String)
  804. * <code>MBeanPermission(className, null, name,
  805. * "isInstanceOf")</code>
  806. */
  807. boolean isInstanceOf(ObjectName name, String className)
  808. throws InstanceNotFoundException;
  809. /**
  810. * Returns true if the specified management bean is registered with
  811. * the server.
  812. *
  813. * @param name the name of the management bean.
  814. * @return true if the bean is registered.
  815. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  816. * is thrown by the server due to a
  817. * <code>null</code> bean name.
  818. */
  819. boolean isRegistered(ObjectName name);
  820. /**
  821. * <p>
  822. * Returns a set of {@link ObjectInstance}s matching the specified
  823. * criteria. The full set of beans registered with the server
  824. * are passed through two filters:
  825. * </p>
  826. * <ol>
  827. * <li>Pattern matching is performed using the supplied
  828. * {@link ObjectName}.</li>
  829. * <li>The supplied query expression is applied.</li>
  830. * </ol>
  831. * <p>
  832. * If both the object name and the query expression are <code>null</code>,
  833. * or the object name has no domain and no key properties,
  834. * no filtering will be performed and all beans are returned.
  835. * </p>
  836. *
  837. * @param name an {@link ObjectName} to use as a filter.
  838. * @param query a query expression to apply to each of the beans that match
  839. * the given object name.
  840. * @return a set of {@link ObjectInstance}s matching the filtered beans.
  841. * @throws SecurityException if a security manager exists and the
  842. * caller's permissions don't imply {@link
  843. * MBeanPermission(String,String,ObjectName,String)
  844. * <code>MBeanPermission(null, null, name,
  845. * "queryMBeans")</code>}. Additionally,
  846. * for an bean, <code>b</code>, the
  847. * caller's permission must imply {@link
  848. * MBeanPermission(String,String,ObjectName,String)
  849. * <code>MBeanPermission(className, b, name,
  850. * "queryMBeans")</code>} or that bean will
  851. * not be included. Such an exception may also
  852. * arise from the execution of the query, in which
  853. * case that particular bean will again be excluded.
  854. */
  855. Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query);
  856. /**
  857. * <p>
  858. * Returns a set of {@link ObjectName}s matching the specified
  859. * criteria. The full set of beans registered with the server
  860. * are passed through two filters:
  861. * </p>
  862. * <ol>
  863. * <li>Pattern matching is performed using the supplied
  864. * {@link ObjectName}.</li>
  865. * <li>The supplied query expression is applied.</li>
  866. * </ol>
  867. * <p>
  868. * If both the object name and the query expression are <code>null</code>,
  869. * or the object name has no domain and no key properties,
  870. * no filtering will be performed and all beans are returned.
  871. * </p>
  872. *
  873. * @param name an {@link ObjectName} to use as a filter.
  874. * @param query a query expression to apply to each of the beans that match
  875. * the given object name.
  876. * @return a set of {@link ObjectName}s matching the filtered beans.
  877. * @throws SecurityException if a security manager exists and the
  878. * caller's permissions don't imply {@link
  879. * MBeanPermission(String,String,ObjectName,String)
  880. * <code>MBeanPermission(null, null, name,
  881. * "queryNames")</code>}. Additionally,
  882. * for an name, <code>n</code>, the
  883. * caller's permission must imply {@link
  884. * MBeanPermission(String,String,ObjectName,String)
  885. * <code>MBeanPermission(className, n, name,
  886. * "queryNames")</code>} or that name will
  887. * not be included. Such an exception may also
  888. * arise from the execution of the query, in which
  889. * case that particular bean will again be excluded.
  890. * Note that these permissions are implied if the
  891. * <code>queryMBeans</code> permissions are available.
  892. */
  893. Set<ObjectName> queryNames(ObjectName name, QueryExp query);
  894. /**
  895. * Registers the supplied instance with the server, using the specified
  896. * {@link ObjectName}. If the name given is <code>null</code>, then
  897. * the bean supplied is expected to implement the {@link MBeanRegistration}
  898. * interface and provide the name via the
  899. * {@link MBeanRegistration#preRegister preRegister} method
  900. * of this interface.
  901. *
  902. * @param obj the object to register with the server.
  903. * @param name the name under which to register the object,
  904. * or <code>null</code> if the {@link MBeanRegistration}
  905. * interface should be used.
  906. * @throws InstanceAlreadyExistsException if a matching instance
  907. * already exists.
  908. * @throws MBeanRegistrationException if an exception occurs in
  909. * calling the preRegister
  910. * method.
  911. * @throws NotCompliantMBeanException if the created bean is not
  912. * compliant with the JMX specification.
  913. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  914. * is thrown by the server due to a
  915. * <code>null</code> object.
  916. * @throws SecurityException if a security manager exists and the
  917. * caller's permissions don't imply {@link
  918. * MBeanPermission(String,String,ObjectName,String)
  919. * <code>MBeanPermission(className, null, name,
  920. * "registerMBean")</code>}. <code>className</code>
  921. * here corresponds to the result of
  922. * {@link MBeanInfo#getClassName()} for objects of
  923. * this class. If this check succeeds, a check
  924. * is also made on its
  925. * {@link java.security.ProtectionDomain} to ensure
  926. * it implies {@link MBeanTrustPermission(String)
  927. * <code>MBeanTrustPermission("register")</code>}.
  928. * The use of the {@link MBeanRegistration} interface
  929. * results in another {@link MBeanPermission} check
  930. * being made on the returned {@link ObjectName}.
  931. */
  932. ObjectInstance registerMBean(Object obj, ObjectName name)
  933. throws InstanceAlreadyExistsException, MBeanRegistrationException,
  934. NotCompliantMBeanException;
  935. /**
  936. * Removes the specified listener from the list of recipients
  937. * of notifications from the supplied bean. This includes all
  938. * combinations of filters and passback objects registered for
  939. * this listener. For more specific removal of listeners, see
  940. * {@link #removeNotificationListener(ObjectName,
  941. * NotificationListener,NotificationFilter,Object)}
  942. *
  943. * @param name the name of the management bean from which the
  944. * listener should be removed.
  945. * @param listener the listener to remove.
  946. * @throws InstanceNotFoundException if the bean can not be found.
  947. * @throws ListenerNotFoundException if the specified listener
  948. * is not registered with the bean.
  949. * @throws SecurityException if a security manager exists and the
  950. * caller's permissions don't imply {@link
  951. * MBeanPermission(String,String,ObjectName,String)
  952. * <code>MBeanPermission(className, null, name,
  953. * "removeNotificationListener")</code>}.
  954. * @see #addNotificationListener(NotificationListener, NotificationFilter,
  955. * java.lang.Object)
  956. * @see NotificationBroadcaster#removeNotificationListener(NotificationListener)
  957. */
  958. void removeNotificationListener(ObjectName name,
  959. NotificationListener listener)
  960. throws InstanceNotFoundException, ListenerNotFoundException;
  961. /**
  962. * Removes the specified listener from the list of recipients
  963. * of notifications from the supplied bean. Only the first instance with
  964. * the supplied filter and passback object is removed.
  965. * <code>null</code> is used as a valid value for these parameters,
  966. * rather than as a way to remove all registration instances for
  967. * the specified listener; for this behaviour instead, see
  968. * {@link #removeNotificationListener(ObjectName, NotificationListener)}.
  969. *
  970. * @param name the name of the management bean from which the
  971. * listener should be removed.
  972. * @param listener the listener to remove.
  973. * @param filter the filter of the listener to remove.
  974. * @param passback the passback object of the listener to remove.
  975. * @throws InstanceNotFoundException if the bean can not be found.
  976. * @throws ListenerNotFoundException if the specified listener
  977. * is not registered with the bean.
  978. * @throws SecurityException if a security manager exists and the
  979. * caller's permissions don't imply {@link
  980. * MBeanPermission(String,String,ObjectName,String)
  981. * <code>MBeanPermission(className, null, name,
  982. * "removeNotificationListener")</code>}.
  983. * @see #addNotificationListener(ObjectName, NotificationListener,
  984. * NotificationFilter, Object)
  985. * @see NotificationEmitter#removeNotificationListener(NotificationListener,
  986. * NotificationFilter,
  987. * Object)
  988. */
  989. void removeNotificationListener(ObjectName name,
  990. NotificationListener listener,
  991. NotificationFilter filter,
  992. Object passback)
  993. throws InstanceNotFoundException, ListenerNotFoundException;
  994. /**
  995. * Removes the specified listener from the list of recipients
  996. * of notifications from the supplied bean. This includes all
  997. * combinations of filters and passback objects registered for
  998. * this listener. For more specific removal of listeners, see
  999. * {@link #removeNotificationListener(ObjectName,
  1000. * ObjectName,NotificationFilter,Object)}
  1001. *
  1002. * @param name the name of the management bean from which the
  1003. * listener should be removed.
  1004. * @param listener the name of the listener to remove.
  1005. * @throws InstanceNotFoundException if a name doesn't match a registered
  1006. * bean.
  1007. * @throws ListenerNotFoundException if the specified listener
  1008. * is not registered with the bean.
  1009. * @throws SecurityException if a security manager exists and the
  1010. * caller's permissions don't imply {@link
  1011. * MBeanPermission(String,String,ObjectName,String)
  1012. * <code>MBeanPermission(className, null, name,
  1013. * "removeNotificationListener")</code>}.
  1014. * @see #addNotificationListener(NotificationListener, NotificationFilter,
  1015. * java.lang.Object)
  1016. * @see NotificationBroadcaster#removeNotificationListener(NotificationListener)
  1017. */
  1018. void removeNotificationListener(ObjectName name, ObjectName listener)
  1019. throws InstanceNotFoundException, ListenerNotFoundException;
  1020. /**
  1021. * Removes the specified listener from the list of recipients
  1022. * of notifications from the supplied bean. Only the first instance with
  1023. * the supplied filter and passback object is removed.
  1024. * <code>null</code> is used as a valid value for these parameters,
  1025. * rather than as a way to remove all registration instances for
  1026. * the specified listener; for this behaviour instead, see
  1027. * {@link #removeNotificationListener(ObjectName, ObjectName)}.
  1028. *
  1029. * @param name the name of the management bean from which the
  1030. * listener should be removed.
  1031. * @param listener the name of the listener to remove.
  1032. * @param filter the filter of the listener to remove.
  1033. * @param passback the passback object of the listener to remove.
  1034. * @throws InstanceNotFoundException if a name doesn't match a registered
  1035. * bean.
  1036. * @throws ListenerNotFoundException if the specified listener
  1037. * is not registered with the bean.
  1038. * @throws SecurityException if a security manager exists and the
  1039. * caller's permissions don't imply {@link
  1040. * MBeanPermission(String,String,ObjectName,String)
  1041. * <code>MBeanPermission(className, null, name,
  1042. * "removeNotificationListener")</code>}.
  1043. * @see #addNotificationListener(ObjectName, NotificationListener,
  1044. * NotificationFilter, Object)
  1045. * @see NotificationEmitter#removeNotificationListener(NotificationListener,
  1046. * NotificationFilter,
  1047. * Object)
  1048. */
  1049. void removeNotificationListener(ObjectName name,
  1050. ObjectName listener,
  1051. NotificationFilter filter,
  1052. Object passback)
  1053. throws InstanceNotFoundException, ListenerNotFoundException;
  1054. /**
  1055. * Sets the value of the specified attribute of the supplied
  1056. * management bean.
  1057. *
  1058. * @param name the name of the management bean.
  1059. * @param attribute the attribute to set.
  1060. * @throws InstanceNotFoundException if the bean can not be found.
  1061. * @throws AttributeNotFoundException if the attribute does not
  1062. * correspond to an attribute
  1063. * of the bean.
  1064. * @throws InvalidAttributeValueException if the value is invalid
  1065. * for this particular
  1066. * attribute of the bean.
  1067. * @throws MBeanException if setting the attribute causes
  1068. * the bean to throw an exception (which
  1069. * becomes the cause of this exception).
  1070. * @throws ReflectionException if an exception occurred in trying
  1071. * to use the reflection interface
  1072. * to lookup the attribute. The
  1073. * thrown exception is the cause of
  1074. * this exception.
  1075. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  1076. * is thrown by the server due to a
  1077. * <code>null</code> bean or attribute
  1078. * name.
  1079. * @throws SecurityException if a security manager exists and the
  1080. * caller's permissions don't imply {@link
  1081. * MBeanPermission(String,String,ObjectName,String)
  1082. * <code>MBeanPermission(className, name, bean,
  1083. * "setAttribute")</code>}.
  1084. * @see #getAttribute(ObjectName, String)
  1085. * @see DynamicMBean#setAttribute(Attribute)
  1086. */
  1087. void setAttribute(ObjectName name, Attribute attribute)
  1088. throws InstanceNotFoundException, AttributeNotFoundException,
  1089. InvalidAttributeValueException, MBeanException,
  1090. ReflectionException;
  1091. /**
  1092. * Sets the value of each of the specified attributes
  1093. * of the supplied management bean to that specified by
  1094. * the {@link Attribute} object. The returned list contains
  1095. * the attributes that were set and their new values.
  1096. *
  1097. * @param name the name of the management bean.
  1098. * @param attributes the attributes to set.
  1099. * @return a list of the changed attributes.
  1100. * @throws InstanceNotFoundException if the bean can not be found.
  1101. * @throws ReflectionException if an exception occurred in trying
  1102. * to use the reflection interface
  1103. * to lookup the attribute. The
  1104. * thrown exception is the cause of
  1105. * this exception.
  1106. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  1107. * is thrown by the server due to a
  1108. * <code>null</code> bean or attribute
  1109. * list.
  1110. * @throws SecurityException if a security manager exists and the
  1111. * caller's permissions don't imply {@link
  1112. * MBeanPermission(String,String,ObjectName,String)
  1113. * <code>MBeanPermission(className, null, bean,
  1114. * "setAttribute")</code>}. Additionally,
  1115. * for an attribute name, <code>n</code>, the
  1116. * caller's permission must imply {@link
  1117. * MBeanPermission(String,String,ObjectName,String)
  1118. * <code>MBeanPermission(className, n, bean,
  1119. * "setAttribute")</code>} or that attribute will
  1120. * not be included.
  1121. * @see #getAttributes(ObjectName, String[])
  1122. * @see DynamicMBean#setAttributes(AttributeList)
  1123. */
  1124. AttributeList setAttributes(ObjectName name, AttributeList attributes)
  1125. throws InstanceNotFoundException, ReflectionException;
  1126. /**
  1127. * Unregisters the specified management bean. Following this operation,
  1128. * the bean instance is no longer accessible from the server via this
  1129. * name. Prior to unregistering the bean, the
  1130. * {@link MBeanRegistration#preDeregister()} method will be called if
  1131. * the bean implements the {@link MBeanRegistration} interface.
  1132. *
  1133. * @param name the name of the management bean.
  1134. * @throws InstanceNotFoundException if the bean can not be found.
  1135. * @throws MBeanRegistrationException if an exception occurs in
  1136. * calling the preDeregister
  1137. * method.
  1138. * @throws RuntimeOperationsException if an {@link IllegalArgumentException}
  1139. * is thrown by the server due to a
  1140. * <code>null</code> bean name or a
  1141. * request being made to unregister the
  1142. * {@link MBeanServerDelegate} bean.
  1143. * @throws SecurityException if a security manager exists and the
  1144. * caller's permissions don't imply {@link
  1145. * MBeanPermission(String,String,ObjectName,String)
  1146. * <code>MBeanPermission(className, null, name,
  1147. * "unregisterMBean")</code>}.
  1148. */
  1149. void unregisterMBean(ObjectName name)
  1150. throws InstanceNotFoundException, MBeanRegistrationException;
  1151. }