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