001: /* JFox, the OpenSource J2EE Application Server
002: *
003: * Copyright (C) 2002 huihoo.com
004: * Distributable under GNU LGPL license
005: * See the GNU Lesser General Public License for more details.
006: */
007:
008: package javax.management;
009:
010: import java.io.IOException;
011: import java.util.Set;
012:
013: /**
014: * This interface represents a way to talk to an MBean server, whether
015: * local or remote. The {@link MBeanServer} interface, representing a
016: * local MBean server, extends this interface.
017: *
018: * @author <a href="mailto:young_yy@hotmail.com">Young Yang</a>
019: */
020:
021: public interface MBeanServerConnection {
022: /**
023: * <p>Instantiates and registers an MBean in the MBean server. The
024: * MBean server will use its {@link
025: * javax.management.loading.ClassLoaderRepository Default Loader
026: * Repository} to load the class of the MBean. An object name is
027: * associated to the MBean. If the object name given is null, the
028: * MBean must provide its own name by implementing the {@link
029: * javax.management.MBeanRegistration MBeanRegistration} interface
030: * and returning the name from the {@link
031: * MBeanRegistration#preRegister preRegister} method.</p>
032: *
033: * <p>This method is equivalent to {@link
034: * #createMBean(String,ObjectName,Object[],String[])
035: * createMBean(className, name, (Object[]) null, (String[])
036: * null)}.</p>
037: *
038: * @param className The class name of the MBean to be instantiated.
039: * @param name The object name of the MBean. May be null.
040: *
041: * @return An <CODE>ObjectInstance</CODE>, containing the
042: * <CODE>ObjectName</CODE> and the Java class name of the newly
043: * instantiated MBean. If the contained <code>ObjectName</code>
044: * is <code>n</code>, the contained Java class name is
045: * <code>{@link #getMBeanInfo getMBeanInfo(n)}.getClassName()</code>.
046: *
047: * @exception ReflectionException Wraps a
048: * <CODE>java.lang.ClassNotFoundException</CODE> or a
049: * <CODE><CODE>java.lang.Exception</CODE></CODE> that occurred
050: * when trying to invoke the MBean's constructor.
051: * @exception InstanceAlreadyExistsException The MBean is already
052: * under the control of the MBean server.
053: * @exception MBeanRegistrationException The
054: * <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>
055: * interface) method of the MBean has thrown an exception. The
056: * MBean will not be registered.
057: * @exception MBeanException The constructor of the MBean has
058: * thrown an exception
059: * @exception NotCompliantMBeanException This class is not a JMX
060: * compliant MBean
061: * @exception RuntimeOperationsException Wraps a
062: * <CODE>java.lang.IllegalArgumentException</CODE>: The className
063: * passed in parameter is null, the <CODE>ObjectName</CODE> passed
064: * in parameter contains a pattern or no <CODE>ObjectName</CODE>
065: * is specified for the MBean.
066: * @exception IOException A communication problem occurred when
067: * talking to the MBean server.
068: *
069: */
070: public ObjectInstance createMBean(String className, ObjectName name)
071: throws ReflectionException, InstanceAlreadyExistsException,
072: MBeanRegistrationException, MBeanException,
073: NotCompliantMBeanException, IOException;
074:
075: /**
076: * <p>Instantiates and registers an MBean in the MBean server. The
077: * class loader to be used is identified by its object name. An
078: * object name is associated to the MBean. If the object name of
079: * the loader is null, the ClassLoader that loaded the MBean
080: * server will be used. If the MBean's object name given is null,
081: * the MBean must provide its own name by implementing the {@link
082: * javax.management.MBeanRegistration MBeanRegistration} interface
083: * and returning the name from the {@link
084: * MBeanRegistration#preRegister preRegister} method.</p>
085: *
086: * <p>This method is equivalent to {@link
087: * #createMBean(String,ObjectName,ObjectName,Object[],String[])
088: * createMBean(className, name, loaderName, (Object[]) null,
089: * (String[]) null)}.</p>
090: *
091: * @param className The class name of the MBean to be instantiated.
092: * @param name The object name of the MBean. May be null.
093: * @param loaderName The object name of the class loader to be used.
094: *
095: * @return An <CODE>ObjectInstance</CODE>, containing the
096: * <CODE>ObjectName</CODE> and the Java class name of the newly
097: * instantiated MBean. If the contained <code>ObjectName</code>
098: * is <code>n</code>, the contained Java class name is
099: * <code>{@link #getMBeanInfo getMBeanInfo(n)}.getClassName()</code>.
100: *
101: * @exception ReflectionException Wraps a
102: * <CODE>java.lang.ClassNotFoundException</CODE> or a
103: * <CODE>java.lang.Exception</CODE> that occurred when trying to
104: * invoke the MBean's constructor.
105: * @exception InstanceAlreadyExistsException The MBean is already
106: * under the control of the MBean server.
107: * @exception MBeanRegistrationException The
108: * <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>
109: * interface) method of the MBean has thrown an exception. The
110: * MBean will not be registered.
111: * @exception MBeanException The constructor of the MBean has
112: * thrown an exception
113: * @exception NotCompliantMBeanException This class is not a JMX
114: * compliant MBean
115: * @exception InstanceNotFoundException The specified class loader
116: * is not registered in the MBean server.
117: * @exception RuntimeOperationsException Wraps a
118: * <CODE>java.lang.IllegalArgumentException</CODE>: The className
119: * passed in parameter is null, the <CODE>ObjectName</CODE> passed
120: * in parameter contains a pattern or no <CODE>ObjectName</CODE>
121: * is specified for the MBean.
122: * @exception IOException A communication problem occurred when
123: * talking to the MBean server.
124: */
125: public ObjectInstance createMBean(String className,
126: ObjectName name, ObjectName loaderName)
127: throws ReflectionException, InstanceAlreadyExistsException,
128: MBeanRegistrationException, MBeanException,
129: NotCompliantMBeanException, InstanceNotFoundException,
130: IOException;
131:
132: /**
133: * Instantiates and registers an MBean in the MBean server. The
134: * MBean server will use its {@link
135: * javax.management.loading.ClassLoaderRepository Default Loader
136: * Repository} to load the class of the MBean. An object name is
137: * associated to the MBean. If the object name given is null, the
138: * MBean must provide its own name by implementing the {@link
139: * javax.management.MBeanRegistration MBeanRegistration} interface
140: * and returning the name from the {@link
141: * MBeanRegistration#preRegister preRegister} method.
142: *
143: * @param className The class name of the MBean to be instantiated.
144: * @param name The object name of the MBean. May be null.
145: * @param params An array containing the parameters of the
146: * constructor to be invoked.
147: * @param signature An array containing the signature of the
148: * constructor to be invoked.
149: *
150: * @return An <CODE>ObjectInstance</CODE>, containing the
151: * <CODE>ObjectName</CODE> and the Java class name of the newly
152: * instantiated MBean. If the contained <code>ObjectName</code>
153: * is <code>n</code>, the contained Java class name is
154: * <code>{@link #getMBeanInfo getMBeanInfo(n)}.getClassName()</code>.
155: *
156: * @exception ReflectionException Wraps a
157: * <CODE>java.lang.ClassNotFoundException</CODE> or a
158: * <CODE>java.lang.Exception</CODE> that occurred when trying to
159: * invoke the MBean's constructor.
160: * @exception InstanceAlreadyExistsException The MBean is already
161: * under the control of the MBean server.
162: * @exception MBeanRegistrationException The
163: * <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>
164: * interface) method of the MBean has thrown an exception. The
165: * MBean will not be registered.
166: * @exception MBeanException The constructor of the MBean has
167: * thrown an exception
168: * @exception NotCompliantMBeanException This class is not a JMX
169: * compliant MBean
170: * @exception RuntimeOperationsException Wraps a
171: * <CODE>java.lang.IllegalArgumentException</CODE>: The className
172: * passed in parameter is null, the <CODE>ObjectName</CODE> passed
173: * in parameter contains a pattern or no <CODE>ObjectName</CODE>
174: * is specified for the MBean.
175: * @exception IOException A communication problem occurred when
176: * talking to the MBean server.
177: *
178: */
179: public ObjectInstance createMBean(String className,
180: ObjectName name, Object params[], String signature[])
181: throws ReflectionException, InstanceAlreadyExistsException,
182: MBeanRegistrationException, MBeanException,
183: NotCompliantMBeanException, IOException;
184:
185: /**
186: * Instantiates and registers an MBean in the MBean server. The
187: * class loader to be used is identified by its object name. An
188: * object name is associated to the MBean. If the object name of
189: * the loader is not specified, the ClassLoader that loaded the
190: * MBean server will be used. If the MBean object name given is
191: * null, the MBean must provide its own name by implementing the
192: * {@link javax.management.MBeanRegistration MBeanRegistration}
193: * interface and returning the name from the {@link
194: * MBeanRegistration#preRegister preRegister} method.
195: *
196: * @param className The class name of the MBean to be instantiated.
197: * @param name The object name of the MBean. May be null.
198: * @param params An array containing the parameters of the
199: * constructor to be invoked.
200: * @param signature An array containing the signature of the
201: * constructor to be invoked.
202: * @param loaderName The object name of the class loader to be used.
203: *
204: * @return An <CODE>ObjectInstance</CODE>, containing the
205: * <CODE>ObjectName</CODE> and the Java class name of the newly
206: * instantiated MBean. If the contained <code>ObjectName</code>
207: * is <code>n</code>, the contained Java class name is
208: * <code>{@link #getMBeanInfo getMBeanInfo(n)}.getClassName()</code>.
209: *
210: * @exception ReflectionException Wraps a
211: * <CODE>java.lang.ClassNotFoundException</CODE> or a
212: * <CODE>java.lang.Exception</CODE> that occurred when trying to
213: * invoke the MBean's constructor.
214: * @exception InstanceAlreadyExistsException The MBean is already
215: * under the control of the MBean server.
216: * @exception MBeanRegistrationException The
217: * <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE>
218: * interface) method of the MBean has thrown an exception. The
219: * MBean will not be registered.
220: * @exception MBeanException The constructor of the MBean has
221: * thrown an exception
222: * @exception NotCompliantMBeanException This class is not a JMX
223: * compliant MBean
224: * @exception InstanceNotFoundException The specified class loader
225: * is not registered in the MBean server.
226: * @exception RuntimeOperationsException Wraps a
227: * <CODE>java.lang.IllegalArgumentException</CODE>: The className
228: * passed in parameter is null, the <CODE>ObjectName</CODE> passed
229: * in parameter contains a pattern or no <CODE>ObjectName</CODE>
230: * is specified for the MBean.
231: * @exception IOException A communication problem occurred when
232: * talking to the MBean server.
233: *
234: */
235: public ObjectInstance createMBean(String className,
236: ObjectName name, ObjectName loaderName, Object params[],
237: String signature[]) throws ReflectionException,
238: InstanceAlreadyExistsException, MBeanRegistrationException,
239: MBeanException, NotCompliantMBeanException,
240: InstanceNotFoundException, IOException;
241:
242: /**
243: * Unregisters an MBean from the MBean server. The MBean is
244: * identified by its object name. Once the method has been
245: * invoked, the MBean may no longer be accessed by its object
246: * name.
247: *
248: * @param name The object name of the MBean to be unregistered.
249: *
250: * @exception InstanceNotFoundException The MBean specified is not
251: * registered in the MBean server.
252: * @exception MBeanRegistrationException The preDeregister
253: * ((<CODE>MBeanRegistration</CODE> interface) method of the MBean
254: * has thrown an exception.
255: * @exception RuntimeOperationsException Wraps a
256: * <CODE>java.lang.IllegalArgumentException</CODE>: The object
257: * name in parameter is null or the MBean you are when trying to
258: * unregister is the {@link javax.management.MBeanServerDelegate
259: * MBeanServerDelegate} MBean.
260: * @exception IOException A communication problem occurred when
261: * talking to the MBean server.
262: *
263: */
264: public void unregisterMBean(ObjectName name)
265: throws InstanceNotFoundException,
266: MBeanRegistrationException, IOException;
267:
268: /**
269: * Gets the <CODE>ObjectInstance</CODE> for a given MBean
270: * registered with the MBean server.
271: *
272: * @param name The object name of the MBean.
273: *
274: * @return The <CODE>ObjectInstance</CODE> associated with the MBean
275: * specified by <VAR>name</VAR>. The contained <code>ObjectName</code>
276: * is <code>name</code> and the contained class name is
277: * <code>{@link #getMBeanInfo getMBeanInfo(name)}.getClassName()</code>.
278: *
279: * @exception InstanceNotFoundException The MBean specified is not
280: * registered in the MBean server.
281: * @exception IOException A communication problem occurred when
282: * talking to the MBean server.
283: */
284: public ObjectInstance getObjectInstance(ObjectName name)
285: throws InstanceNotFoundException, IOException;
286:
287: /**
288: * Gets MBeans controlled by the MBean server. This method allows
289: * any of the following to be obtained: All MBeans, a set of
290: * MBeans specified by pattern matching on the
291: * <CODE>ObjectName</CODE> and/or a Query expression, a specific
292: * MBean. When the object name is null or no domain and key
293: * properties are specified, all objects are to be selected (and
294: * filtered if a query is specified). It returns the set of
295: * <CODE>ObjectInstance</CODE> objects (containing the
296: * <CODE>ObjectName</CODE> and the Java Class name) for the
297: * selected MBeans.
298: *
299: * @param name The object name pattern identifying the MBeans to
300: * be retrieved. If null or no domain and key properties are
301: * specified, all the MBeans registered will be retrieved.
302: * @param query The query expression to be applied for selecting
303: * MBeans. If null no query expression will be applied for
304: * selecting MBeans.
305: *
306: * @return A set containing the <CODE>ObjectInstance</CODE>
307: * objects for the selected MBeans. If no MBean satisfies the
308: * query an empty list is returned.
309: *
310: * @exception IOException A communication problem occurred when
311: * talking to the MBean server.
312: */
313: public Set queryMBeans(ObjectName name, QueryExp query)
314: throws IOException;
315:
316: /**
317: * Gets the names of MBeans controlled by the MBean server. This
318: * method enables any of the following to be obtained: The names
319: * of all MBeans, the names of a set of MBeans specified by
320: * pattern matching on the <CODE>ObjectName</CODE> and/or a Query
321: * expression, a specific MBean name (equivalent to testing
322: * whether an MBean is registered). When the object name is null
323: * or no domain and key properties are specified, all objects are
324: * selected (and filtered if a query is specified). It returns the
325: * set of ObjectNames for the MBeans selected.
326: *
327: * @param name The object name pattern identifying the MBean names
328: * to be retrieved. If null oror no domain and key properties are
329: * specified, the name of all registered MBeans will be retrieved.
330: * @param query The query expression to be applied for selecting
331: * MBeans. If null no query expression will be applied for
332: * selecting MBeans.
333: *
334: * @return A set containing the ObjectNames for the MBeans
335: * selected. If no MBean satisfies the query, an empty list is
336: * returned.
337: *
338: * @exception IOException A communication problem occurred when
339: * talking to the MBean server.
340: */
341: public Set queryNames(ObjectName name, QueryExp query)
342: throws IOException;
343:
344: /**
345: * Checks whether an MBean, identified by its object name, is
346: * already registered with the MBean server.
347: *
348: * @param name The object name of the MBean to be checked.
349: *
350: * @return True if the MBean is already registered in the MBean
351: * server, false otherwise.
352: *
353: * @exception RuntimeOperationsException Wraps a
354: * <CODE>java.lang.IllegalArgumentException</CODE>: The object
355: * name in parameter is null.
356: * @exception IOException A communication problem occurred when
357: * talking to the MBean server.
358: */
359: public boolean isRegistered(ObjectName name) throws IOException;
360:
361: /**
362: * Returns the number of MBeans registered in the MBean server.
363: *
364: * @return the number of MBeans registered.
365: *
366: * @exception IOException A communication problem occurred when
367: * talking to the MBean server.
368: */
369: public Integer getMBeanCount() throws IOException;
370:
371: /**
372: * Gets the value of a specific attribute of a named MBean. The MBean
373: * is identified by its object name.
374: *
375: * @param name The object name of the MBean from which the
376: * attribute is to be retrieved.
377: * @param attribute A String specifying the name of the attribute
378: * to be retrieved.
379: *
380: * @return The value of the retrieved attribute.
381: *
382: * @exception AttributeNotFoundException The attribute specified
383: * is not accessible in the MBean.
384: * @exception MBeanException Wraps an exception thrown by the
385: * MBean's getter.
386: * @exception InstanceNotFoundException The MBean specified is not
387: * registered in the MBean server.
388: * @exception ReflectionException Wraps a
389: * <CODE>java.lang.Exception</CODE> thrown when trying to invoke
390: * the setter.
391: * @exception RuntimeOperationsException Wraps a
392: * <CODE>java.lang.IllegalArgumentException</CODE>: The object
393: * name in parameter is null or the attribute in parameter is
394: * null.
395: * @exception IOException A communication problem occurred when
396: * talking to the MBean server.
397: *
398: * @see #setAttribute
399: */
400: public Object getAttribute(ObjectName name, String attribute)
401: throws MBeanException, AttributeNotFoundException,
402: InstanceNotFoundException, ReflectionException, IOException;
403:
404: /**
405: * Enables the values of several attributes of a named MBean. The MBean
406: * is identified by its object name.
407: *
408: * @param name The object name of the MBean from which the
409: * attributes are retrieved.
410: * @param attributes A list of the attributes to be retrieved.
411: *
412: * @return The list of the retrieved attributes.
413: *
414: * @exception InstanceNotFoundException The MBean specified is not
415: * registered in the MBean server.
416: * @exception ReflectionException An exception occurred when
417: * trying to invoke the getAttributes method of a Dynamic MBean.
418: * @exception RuntimeOperationsException Wrap a
419: * <CODE>java.lang.IllegalArgumentException</CODE>: The object
420: * name in parameter is null or attributes in parameter is null.
421: * @exception IOException A communication problem occurred when
422: * talking to the MBean server.
423: *
424: * @see #setAttributes
425: */
426: public AttributeList getAttributes(ObjectName name,
427: String[] attributes) throws InstanceNotFoundException,
428: ReflectionException, IOException;
429:
430: /**
431: * Sets the value of a specific attribute of a named MBean. The MBean
432: * is identified by its object name.
433: *
434: * @param name The name of the MBean within which the attribute is
435: * to be set.
436: * @param attribute The identification of the attribute to be set
437: * and the value it is to be set to.
438: *
439: * @exception InstanceNotFoundException The MBean specified is not
440: * registered in the MBean server.
441: * @exception AttributeNotFoundException The attribute specified
442: * is not accessible in the MBean.
443: * @exception InvalidAttributeValueException The value specified
444: * for the attribute is not valid.
445: * @exception MBeanException Wraps an exception thrown by the
446: * MBean's setter.
447: * @exception ReflectionException Wraps a
448: * <CODE>java.lang.Exception</CODE> thrown when trying to invoke
449: * the setter.
450: * @exception RuntimeOperationsException Wraps a
451: * <CODE>java.lang.IllegalArgumentException</CODE>: The object
452: * name in parameter is null or the attribute in parameter is
453: * null.
454: * @exception IOException A communication problem occurred when
455: * talking to the MBean server.
456: *
457: * @see #getAttribute
458: */
459: public void setAttribute(ObjectName name, Attribute attribute)
460: throws InstanceNotFoundException,
461: AttributeNotFoundException, InvalidAttributeValueException,
462: MBeanException, ReflectionException, IOException;
463:
464: /**
465: * Sets the values of several attributes of a named MBean. The MBean is
466: * identified by its object name.
467: *
468: * @param name The object name of the MBean within which the
469: * attributes are to be set.
470: * @param attributes A list of attributes: The identification of
471: * the attributes to be set and the values they are to be set to.
472: *
473: * @return The list of attributes that were set, with their new
474: * values.
475: *
476: * @exception InstanceNotFoundException The MBean specified is not
477: * registered in the MBean server.
478: * @exception ReflectionException An exception occurred when
479: * trying to invoke the getAttributes method of a Dynamic MBean.
480: * @exception RuntimeOperationsException Wraps a
481: * <CODE>java.lang.IllegalArgumentException</CODE>: The object
482: * name in parameter is null or attributes in parameter is null.
483: * @exception IOException A communication problem occurred when
484: * talking to the MBean server.
485: *
486: * @see #getAttributes
487: */
488: public AttributeList setAttributes(ObjectName name,
489: AttributeList attributes) throws InstanceNotFoundException,
490: ReflectionException, IOException;
491:
492: /**
493: * Invokes an operation on an MBean.
494: *
495: * @param name The object name of the MBean on which the method is
496: * to be invoked.
497: * @param operationName The name of the operation to be invoked.
498: * @param params An array containing the parameters to be set when
499: * the operation is invoked
500: * @param signature An array containing the signature of the
501: * operation. The class objects will be loaded using the same
502: * class loader as the one used for loading the MBean on which the
503: * operation was invoked.
504: *
505: * @return The object returned by the operation, which represents
506: * the result ofinvoking the operation on the MBean specified.
507: *
508: * @exception InstanceNotFoundException The MBean specified is not
509: * registered in the MBean server.
510: * @exception MBeanException Wraps an exception thrown by the
511: * MBean's invoked method.
512: * @exception ReflectionException Wraps a
513: * <CODE>java.lang.Exception</CODE> thrown while trying to invoke
514: * the method.
515: * @exception IOException A communication problem occurred when
516: * talking to the MBean server.
517: *
518: */
519: public Object invoke(ObjectName name, String operationName,
520: Object params[], String signature[])
521: throws InstanceNotFoundException, MBeanException,
522: ReflectionException, IOException;
523:
524: /**
525: * Returns the default domain used for naming the MBean.
526: * The default domain name is used as the domain part in the ObjectName
527: * of MBeans if no domain is specified by the user.
528: *
529: * @return the default domain.
530: *
531: * @exception IOException A communication problem occurred when
532: * talking to the MBean server.
533: */
534: public String getDefaultDomain() throws IOException;
535:
536: /**
537: * <p>Returns the list of domains in which any MBean is currently
538: * registered. A string is in the returned array if and only if
539: * there is at least one MBean registered with an ObjectName whose
540: * {@link ObjectName#getDomain() getDomain()} is equal to that
541: * string. The order of strings within the returned array is
542: * not defined.</p>
543: *
544: * @return the list of domains.
545: *
546: * @exception IOException A communication problem occurred when
547: * talking to the MBean server.
548: *
549: * @since JMX 1.2
550: */
551: public String[] getDomains() throws IOException;
552:
553: /**
554: * <p>Adds a listener to a registered MBean.</p>
555: *
556: * <P> A notification emitted by an MBean will be forwarded by the
557: * MBeanServer to the listener. If the source of the notification
558: * is a reference to an MBean object, the MBean server will replace it
559: * by that MBean's ObjectName. Otherwise the source is unchanged.
560: *
561: * @param name The name of the MBean on which the listener should
562: * be added.
563: * @param listener The listener object which will handle the
564: * notifications emitted by the registered MBean.
565: * @param filter The filter object. If filter is null, no
566: * filtering will be performed before handling notifications.
567: * @param handback The context to be sent to the listener when a
568: * notification is emitted.
569: *
570: * @exception InstanceNotFoundException The MBean name provided
571: * does not match any of the registered MBeans.
572: * @exception IOException A communication problem occurred when
573: * talking to the MBean server.
574: *
575: * @see #removeNotificationListener(ObjectName, NotificationListener)
576: * @see #removeNotificationListener(ObjectName, NotificationListener,
577: * NotificationFilter, Object)
578: */
579: public void addNotificationListener(ObjectName name,
580: NotificationListener listener, NotificationFilter filter,
581: Object handback) throws InstanceNotFoundException,
582: IOException;
583:
584: /**
585: * <p>Adds a listener to a registered MBean.</p>
586: *
587: * <p>A notification emitted by an MBean will be forwarded by the
588: * MBeanServer to the listener. If the source of the notification
589: * is a reference to an MBean object, the MBean server will
590: * replace it by that MBean's ObjectName. Otherwise the source is
591: * unchanged.</p>
592: *
593: * <p>The listener object that receives notifications is the one
594: * that is registered with the given name at the time this method
595: * is called. Even if it is subsequently unregistered, it will
596: * continue to receive notifications.</p>
597: *
598: * @param name The name of the MBean on which the listener should
599: * be added.
600: * @param listener The object name of the listener which will
601: * handle the notifications emitted by the registered MBean.
602: * @param filter The filter object. If filter is null, no
603: * filtering will be performed before handling notifications.
604: * @param handback The context to be sent to the listener when a
605: * notification is emitted.
606: *
607: * @exception InstanceNotFoundException The MBean name of the
608: * notification listener or of the notification broadcaster does
609: * not match any of the registered MBeans.
610: * @exception RuntimeOperationsException Wraps an {@link
611: * IllegalArgumentException}. The MBean named by
612: * <code>listener</code> exists but does not implement the {@link
613: * NotificationListener} interface.
614: * @exception IOException A communication problem occurred when
615: * talking to the MBean server.
616: *
617: * @see #removeNotificationListener(ObjectName, ObjectName)
618: * @see #removeNotificationListener(ObjectName, ObjectName,
619: * NotificationFilter, Object)
620: */
621: public void addNotificationListener(ObjectName name,
622: ObjectName listener, NotificationFilter filter,
623: Object handback) throws InstanceNotFoundException,
624: IOException;
625:
626: /**
627: * Removes a listener from a registered MBean.
628: *
629: * <P> If the listener is registered more than once, perhaps with
630: * different filters or callbacks, this method will remove all
631: * those registrations.
632: *
633: * @param name The name of the MBean on which the listener should
634: * be removed.
635: * @param listener The object name of the listener to be removed.
636: *
637: * @exception InstanceNotFoundException The MBean name provided
638: * does not match any of the registered MBeans.
639: * @exception ListenerNotFoundException The listener is not
640: * registered in the MBean.
641: * @exception IOException A communication problem occurred when
642: * talking to the MBean server.
643: *
644: * @see #addNotificationListener(ObjectName, ObjectName,
645: * NotificationFilter, Object)
646: */
647: public void removeNotificationListener(ObjectName name,
648: ObjectName listener) throws InstanceNotFoundException,
649: ListenerNotFoundException, IOException;
650:
651: /**
652: * <p>Removes a listener from a registered MBean.</p>
653: *
654: * <p>The MBean must have a listener that exactly matches the
655: * given <code>listener</code>, <code>filter</code>, and
656: * <code>handback</code> parameters. If there is more than one
657: * such listener, only one is removed.</p>
658: *
659: * <p>The <code>filter</code> and <code>handback</code> parameters
660: * may be null if and only if they are null in a listener to be
661: * removed.</p>
662: *
663: * @param name The name of the MBean on which the listener should
664: * be removed.
665: * @param listener A listener that was previously added to this
666: * MBean.
667: * @param filter The filter that was specified when the listener
668: * was added.
669: * @param handback The handback that was specified when the
670: * listener was added.
671: *
672: * @exception InstanceNotFoundException The MBean name provided
673: * does not match any of the registered MBeans.
674: * @exception ListenerNotFoundException The listener is not
675: * registered in the MBean, or it is not registered with the given
676: * filter and handback.
677: * @exception IOException A communication problem occurred when
678: * talking to the MBean server.
679: *
680: * @see #addNotificationListener(ObjectName, ObjectName,
681: * NotificationFilter, Object)
682: *
683: * @since JMX 1.2
684: */
685: public void removeNotificationListener(ObjectName name,
686: ObjectName listener, NotificationFilter filter,
687: Object handback) throws InstanceNotFoundException,
688: ListenerNotFoundException, IOException;
689:
690: /**
691: * <p>Removes a listener from a registered MBean.</p>
692: *
693: * <P> If the listener is registered more than once, perhaps with
694: * different filters or callbacks, this method will remove all
695: * those registrations.
696: *
697: * @param name The name of the MBean on which the listener should
698: * be removed.
699: * @param listener The object name of the listener to be removed.
700: *
701: * @exception InstanceNotFoundException The MBean name provided
702: * does not match any of the registered MBeans.
703: * @exception ListenerNotFoundException The listener is not
704: * registered in the MBean.
705: * @exception IOException A communication problem occurred when
706: * talking to the MBean server.
707: *
708: * @see #addNotificationListener(ObjectName, NotificationListener,
709: * NotificationFilter, Object)
710: */
711: public void removeNotificationListener(ObjectName name,
712: NotificationListener listener)
713: throws InstanceNotFoundException,
714: ListenerNotFoundException, IOException;
715:
716: /**
717: * <p>Removes a listener from a registered MBean.</p>
718: *
719: * <p>The MBean must have a listener that exactly matches the
720: * given <code>listener</code>, <code>filter</code>, and
721: * <code>handback</code> parameters. If there is more than one
722: * such listener, only one is removed.</p>
723: *
724: * <p>The <code>filter</code> and <code>handback</code> parameters
725: * may be null if and only if they are null in a listener to be
726: * removed.</p>
727: *
728: * @param name The name of the MBean on which the listener should
729: * be removed.
730: * @param listener A listener that was previously added to this
731: * MBean.
732: * @param filter The filter that was specified when the listener
733: * was added.
734: * @param handback The handback that was specified when the
735: * listener was added.
736: *
737: * @exception InstanceNotFoundException The MBean name provided
738: * does not match any of the registered MBeans.
739: * @exception ListenerNotFoundException The listener is not
740: * registered in the MBean, or it is not registered with the given
741: * filter and handback.
742: * @exception IOException A communication problem occurred when
743: * talking to the MBean server.
744: *
745: * @see #addNotificationListener(ObjectName, NotificationListener,
746: * NotificationFilter, Object)
747: *
748: * @since JMX 1.2
749: */
750: public void removeNotificationListener(ObjectName name,
751: NotificationListener listener, NotificationFilter filter,
752: Object handback) throws InstanceNotFoundException,
753: ListenerNotFoundException, IOException;
754:
755: /**
756: * This method discovers the attributes and operations that an
757: * MBean exposes for management.
758: *
759: * @param name The name of the MBean to analyze
760: *
761: * @return An instance of <CODE>MBeanInfo</CODE> allowing the
762: * retrieval of all attributes and operations of this MBean.
763: *
764: * @exception IntrospectionException An exception occured during
765: * introspection.
766: * @exception InstanceNotFoundException The MBean specified was
767: * not found.
768: * @exception ReflectionException An exception occurred when
769: * trying to invoke the getMBeanInfo of a Dynamic MBean.
770: * @exception IOException A communication problem occurred when
771: * talking to the MBean server.
772: */
773: public MBeanInfo getMBeanInfo(ObjectName name)
774: throws InstanceNotFoundException, IntrospectionException,
775: ReflectionException, IOException;
776:
777: /**
778: * <p>Returns true if the MBean specified is an instance of the
779: * specified class, false otherwise.</p>
780: *
781: * <p>If <code>name</code> does not name an MBean, this method
782: * throws {@link InstanceNotFoundException}.</p>
783: *
784: * <p>Otherwise, let<br>
785: * X be the MBean named by <code>name</code>,<br>
786: * L be the ClassLoader of X,<br>
787: * N be the class name in X's {@link MBeanInfo}.</p>
788: *
789: * <p>If N equals <code>className</code>, the result is true.</p>
790: *
791: * <p>Otherwise, if L successfully loads both N and
792: * <code>className</code>, and the second class is assignable from
793: * the first, the result is true.</p>
794: *
795: * <p>Otherwise, the result is false.</p>
796: *
797: * @param name The <CODE>ObjectName</CODE> of the MBean.
798: * @param className The name of the class.
799: *
800: * @return true if the MBean specified is an instance of the
801: * specified class according to the rules above, false otherwise.
802: *
803: * @exception InstanceNotFoundException The MBean specified is not
804: * registered in the MBean server.
805: * @exception IOException A communication problem occurred when
806: * talking to the MBean server.
807: */
808: public boolean isInstanceOf(ObjectName name, String className)
809: throws InstanceNotFoundException, IOException;
810:
811: }
|