001: /**
002: * The XMOJO Project 5
003: * Copyright © 2003 XMOJO.org. All rights reserved.
004:
005: * NO WARRANTY
006:
007: * BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
008: * THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
009: * OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
010: * PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
011: * OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
012: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
013: * TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE
014: * LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
015: * REPAIR OR CORRECTION.
016:
017: * IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
018: * ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE
019: * THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
020: * GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
021: * USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF
022: * DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
023: * PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE),
024: * EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
025: * SUCH DAMAGES.
026: **/package javax.management;
027:
028: import java.io.ObjectInputStream;
029: import java.util.Set;
030:
031: /**
032: * This is the interface for MBean manipulation on the agent side. It contains
033: * the methods necessary for the creation, registration, and deletion of MBeans
034: * as well as the access methods for registered MBeans. This is the core
035: * component of the JMX infrastructure.
036: * <P>
037: * Every MBean which is added to the MBean server becomes manageable: its
038: * attributes and operations become remotely accessible through the
039: * connectors/adaptors connected to that MBean server. A Java object cannot be
040: * registered in the MBean server unless it is a JMX compliant MBean.
041: * <P>
042: * When an MBean is registered or unregistered in the MBean server an
043: * {@link javax.management.MBeanServerNotification MBeanServerNotification}
044: * Notification is emitted. To register an object as listener to
045: * MBeanServerNotifications you should call the MBean server method
046: * {@link #addNotificationListener addNotificationListener} with
047: * <CODE>ObjectName</CODE> the <CODE>ObjectName</CODE> of the
048: * {@link javax.management.MBeanServerDelegate MBeanServerDelegate}.
049: * This <CODE>ObjectName</CODE> is:
050: * <BR>
051: * <CODE>JMImplementation:type=MBeanServerDelegate</CODE>.
052: */
053: public abstract interface MBeanServer {
054: /**
055: * Enables a couple (listener,handback) for a registered MBean to be added.
056: *
057: * @param name The name of the MBean on which the listener should be added.
058: *
059: * @param listener The listener object which will handles notifications
060: * emitted by the registered MBean.
061: *
062: * @param filter The filter object. If not specified, no filtering will be
063: * performed before handling notifications.
064: *
065: * @param handback The context to be sent to the listener when a
066: * notification is emitted.
067: *
068: * @exception javax.management.InstanceNotFoundException The MBean name
069: * doesn't correspond to a registered MBean.
070: */
071: public void addNotificationListener(ObjectName name,
072: NotificationListener listener, NotificationFilter filter,
073: Object handback) throws InstanceNotFoundException;
074:
075: /**
076: * Enables a couple (listener,handback) for a registered MBean to be added.
077: *
078: * @param name The name of the MBean on which the listener should be added.
079: *
080: * @param listener The listener name which will handles notifications
081: * emitted by the registered MBean.
082: *
083: * @param filter The filter object. If not specified, no filtering will be
084: * performed before handling notifications.
085: *
086: * @param handback The context to be sent to the listener when a
087: * notification is emitted.
088: *
089: * @exception javax.management.InstanceNotFoundException The MBean name
090: * doesn't correspond to a registered MBean.
091: */
092: public void addNotificationListener(ObjectName name,
093: ObjectName listener, NotificationFilter filter,
094: Object handback) throws InstanceNotFoundException;
095:
096: /**
097: * Instantiates and registers an MBean in the MBean server.
098: * The MBean server will use the
099: * {@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}
100: * to load the class of the MBean. An object name is associated to the
101: * MBean. If the object name given is null, the MBean can automatically
102: * provide its own name by implementing the
103: * {@link javax.management.MBeanRegistration MBeanRegistration} interface.
104: * The call returns an <CODE>ObjectInstance</CODE> object representing
105: * the newly created MBean.
106: *
107: * @param className The class name of the MBean to be instantiated.
108: *
109: * @param name The object name of the MBean. May be null.
110: *
111: * @return An <CODE>ObjectInstance</CODE>, containing the
112: * <CODE>ObjectName</CODE> and the Java class name of
113: * the newly instantiated MBean.
114: *
115: * @exception ReflectionException Wraps a
116: * <CODE>java.lang.ClassNotFoundException</CODE>
117: * or a <CODE><CODE>java.lang.Exception</CODE></CODE> that
118: * occurred when trying to invoke the MBean's constructor.
119: *
120: * @exception InstanceAlreadyExistsException The MBean is already under
121: * the control of the MBean server.
122: *
123: * @exception MBeanRegistrationException The <CODE>preRegister</CODE>
124: * (<CODE>MBeanRegistration</CODE> interface) method of the
125: * MBean has thrown an exception. The MBean will not be registered.
126: *
127: * @exception MBeanException The constructor of the MBean has thrown an exception
128: *
129: * @exception NotCompliantMBeanException This class is not a JMX compliant MBean
130: *
131: * @exception RuntimeOperationsException Wraps a
132: * <CODE>java.lang.IllegalArgumentException</CODE>:
133: * The className passed in parameter is null,
134: * the <CODE>ObjectName</CODE> passed in parameter contains
135: * a pattern
136: * or no <CODE>ObjectName</CODE> is specified for the MBean.
137: */
138: public ObjectInstance createMBean(String className, ObjectName name)
139: throws ReflectionException, InstanceAlreadyExistsException,
140: MBeanRegistrationException, MBeanException,
141: NotCompliantMBeanException;
142:
143: /**
144: * Instantiates and registers an MBean in the MBean server.
145: * The MBean server will use the
146: * {@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}
147: * to load the class of the MBean.
148: * An object name is associated to the MBean. If the object name given is
149: * null, the MBean can automatically provide its own name by implementing
150: * the {@link javax.management.MBeanRegistration MBeanRegistration}
151: * interface. The call returns an <CODE>ObjectInstance</CODE> object
152: * representing the newly created MBean.
153: *
154: * @param className The class name of the MBean to be instantiated.
155: *
156: * @param name The object name of the MBean. May be null.
157: *
158: * @param params An array containing the parameters of constructor to be invoked.
159: *
160: * @param signature An array containing the signature of constructor to be invoked.
161: *
162: * @return An <CODE>ObjectInstance</CODE>, containing the
163: * <CODE>ObjectName</CODE> and the Java class name of
164: * the newly instantiated MBean.
165: *
166: * @exception ReflectionException Wraps a
167: * <CODE>java.lang.ClassNotFoundException</CODE>
168: * or a <CODE>java.lang.Exception</CODE> that occurred
169: * when trying to invoke the MBean's constructor.
170: *
171: * @exception InstanceAlreadyExistsException The MBean is already under
172: * the control of the MBean server.
173: *
174: * @exception MBeanRegistrationException The <CODE>preRegister</CODE>
175: * (<CODE>MBeanRegistration</CODE> interface) method of the
176: * MBean has thrown an exception. The MBean will not be registered.
177: *
178: * @exception MBeanException The constructor of the MBean has thrown an exception.
179: *
180: * @exception RuntimeOperationsException Wraps a
181: * <CODE>java.lang.IllegalArgumentException</CODE>:
182: * The className passed in parameter is null,
183: * the <CODE>ObjectName</CODE> passed in parameter contains a pattern
184: * or no <CODE>ObjectName</CODE> is specified for the MBean.
185: */
186: public ObjectInstance createMBean(String className,
187: ObjectName name, Object[] params, String[] signature)
188: throws ReflectionException, InstanceAlreadyExistsException,
189: MBeanRegistrationException, MBeanException,
190: NotCompliantMBeanException;
191:
192: /**
193: * Instantiates and registers an MBean in the MBean server. The class loader
194: * to be used is identified by its object name. An object name is associated
195: * to the MBean. If the object name of the loader is null, the ClassLoader
196: * that loaded the MBean server will be used. If the MBean's object name
197: * given is null, the MBean can automatically provide its own name by
198: * implementing the {@link javax.management.MBeanRegistration MBeanRegistration}
199: * interface. The call returns an <CODE>ObjectInstance</CODE> object
200: * representing the newly created MBean.
201: *
202: * @param className The class name of the MBean to be instantiated.
203: *
204: * @param name The object name of the MBean. May be null.
205: *
206: * @param loaderName The object name of the class loader to be used.
207: *
208: * @return An <CODE>ObjectInstance</CODE>, containing the
209: * <CODE>ObjectName</CODE> and the Java class name of
210: * the newly instantiated MBean.
211: *
212: * @exception ReflectionException Wraps a
213: * <CODE>java.lang.ClassNotFoundException</CODE>
214: * or a <CODE>java.lang.Exception</CODE> that occurred
215: * when trying to invoke the MBean's constructor.
216: *
217: * @exception InstanceAlreadyExistsException The MBean is already under
218: * the control of the MBean server.
219: *
220: * @exception MBeanRegistrationException The <CODE>preRegister</CODE>
221: * (<CODE>MBeanRegistration</CODE> interface) method of the
222: * MBean has thrown an exception. The MBean will not be registered.
223: *
224: * @exception MBeanException The constructor of the MBean has thrown an exception.
225: *
226: * @exception NotCompliantMBeanException This class is not a JMX compliant MBean.
227: *
228: * @exception InstanceNotFoundException The specified class loader
229: * is not registered in the MBean server.
230: *
231: * @exception RuntimeOperationsException Wraps a
232: * <CODE>java.lang.IllegalArgumentException</CODE>:
233: * The className passed in parameter is null,
234: * the <CODE>ObjectName</CODE> passed in parameter contains a pattern
235: * or no <CODE>ObjectName</CODE> is specified for the MBean.
236: */
237: public ObjectInstance createMBean(String className,
238: ObjectName name, ObjectName loaderName)
239: throws ReflectionException, InstanceAlreadyExistsException,
240: MBeanRegistrationException, MBeanException,
241: NotCompliantMBeanException, InstanceNotFoundException;
242:
243: /**
244: * Instantiates and registers an MBean in the MBean server. The class loader
245: * to be used is identified by its object name. An object name is associated
246: * to the MBean. If the object name of the loader is not specified, the
247: * ClassLoader that loaded the MBean server will be used. If the MBean
248: * object name given is null, the MBean can automatically provide its own
249: * name by implementing the
250: * {@link javax.management.MBeanRegistration MBeanRegistration} interface.
251: * The call returns an <CODE>ObjectInstance</CODE> object representing
252: * the newly created MBean.
253: *
254: * @param className The class name of the MBean to be instantiated.
255: *
256: * @param name The object name of the MBean. May be null.
257: *
258: * @param params An array containing the parameters of constructor to be invoked.
259: *
260: * @param signature An array containing the signature of constructor to be invoked.
261: *
262: * @param loaderName The object name of the class loader to be used.
263: *
264: * @return An <CODE>ObjectInstance</CODE>, containing the
265: * <CODE>ObjectName</CODE> and the Java class name of
266: * the newly instantiated MBean.
267: *
268: * @exception ReflectionException Wraps a
269: * <CODE>java.lang.ClassNotFoundException</CODE>
270: * or a <CODE>java.lang.Exception</CODE> that occurred
271: * when trying to invoke the MBean's constructor.
272: *
273: * @exception InstanceAlreadyExistsException The MBean is already under
274: * the control of the MBean server.
275: *
276: * @exception MBeanRegistrationException The <CODE>preRegister</CODE>
277: * (<CODE>MBeanRegistration</CODE> interface) method of the
278: * MBean has thrown an exception. The MBean will not be registered.
279: *
280: * @exception MBeanException The constructor of the MBean has thrown an exception.
281: *
282: * @exception InstanceNotFoundException The specified class loader
283: * is not registered in the MBean server.
284: *
285: * @exception RuntimeOperationsException Wraps a
286: * <CODE>java.lang.IllegalArgumentException</CODE>:
287: * The className passed in parameter is null,
288: * the <CODE>ObjectName</CODE> passed in parameter contains a pattern
289: * or no <CODE>ObjectName</CODE> is specified for the MBean.
290: */
291: public ObjectInstance createMBean(String className,
292: ObjectName name, ObjectName loaderName, Object[] params,
293: String[] signature) throws ReflectionException,
294: InstanceAlreadyExistsException, MBeanRegistrationException,
295: MBeanException, NotCompliantMBeanException,
296: InstanceNotFoundException;
297:
298: /**
299: * De-serializes a byte array in the context of the class loader of an MBean.
300: *
301: * @param name The name of the MBean whose class loader should be used
302: * for the de-serialization.
303: *
304: * @param data The byte array to be de-sererialized.
305: *
306: * @return The de-serialized object stream.
307: *
308: * @exception InstanceNotFoundException The MBean specified is not found.
309: *
310: * @exception OperationsException Any of the usual Input/Output related exceptions.
311: */
312: public ObjectInputStream deserialize(ObjectName name, byte[] data)
313: throws InstanceNotFoundException, OperationsException;
314:
315: /**
316: * De-serializes a byte array in the context of a given MBean class loader.
317: * The class loader is the one that loaded the class with name "className".
318: *
319: * @param className The name of the class whose class loader should be used
320: * for the de-serialization.
321: *
322: * @param data The byte array to be de-sererialized.
323: *
324: * @return The de-serialized object stream.
325: *
326: * @exception OperationsException Any of the usual Input/Output related exceptions.
327: *
328: * @exception ReflectionException The specified class could not be
329: * loaded by the default loader repository.
330: */
331: public ObjectInputStream deserialize(String className, byte[] data)
332: throws OperationsException, ReflectionException;
333:
334: /**
335: * De-serializes a byte array in the context of a given MBean class loader.
336: * The class loader is the one that loaded the class with name "className".
337: * The name of the class loader to be used for loading the specified class
338: * is specified. If null, the MBean Server's class loader will be used.
339: *
340: * @param className The name of the class whose class loader should be
341: * used for the de-serialization.
342: *
343: * @param data The byte array to be de-sererialized.
344: *
345: * @param loaderName The name of the class loader to be used for
346: * loading the specified class. If null, the MBean Server's
347: * class loader will be used.
348: *
349: * @return The de-serialized object stream.
350: *
351: * @exception InstanceNotFoundException The specified class loader MBean
352: * is not found.
353: *
354: * @exception OperationsException Any of the usual Input/Output related exceptions.
355: *
356: * @exception ReflectionException The specified class could not be
357: * loaded by the specified class loader.
358: */
359: public ObjectInputStream deserialize(String className,
360: ObjectName loaderName, byte[] data)
361: throws InstanceNotFoundException, OperationsException,
362: ReflectionException;
363:
364: /**
365: * Gets the value of a specific attribute of a named MBean. The MBean
366: * is identified by its object name.
367: *
368: * @param name The object name of the MBean from which the attribute is
369: * to be retrieved.
370: *
371: * @param attribute A String specifying the name of the attribute to be retrieved.
372: *
373: * @return The value of the retrieved attribute.
374: *
375: * @exception AttributeNotFoundException The attribute specified is
376: * not accessible in the MBean.
377: *
378: * @exception MBeanException Wraps an exception thrown by the MBean's getter.
379: *
380: * @exception InstanceNotFoundException The MBean specified is not
381: * registered in the MBean server.
382: *
383: * @exception ReflectionException Wraps a <CODE>java.lang.Exception</CODE>
384: * thrown when trying to invoke the setter.
385: *
386: * @exception RuntimeOperationsException Wraps a
387: * <CODE>java.lang.IllegalArgumentException</CODE>:
388: * The object name in parameter is null
389: * or the attribute in parameter is null.
390: */
391: public Object getAttribute(ObjectName name, String attribute)
392: throws MBeanException, AttributeNotFoundException,
393: InstanceNotFoundException, ReflectionException;
394:
395: /**
396: * Enables the values of several attributes of a named MBean. The MBean
397: * is identified by its object name.
398: *
399: * @param name The object name of the MBean from which the attributes are
400: * retrieved.
401: *
402: * @param attributes A list of the attributes to be retrieved.
403: *
404: * @return The list of the retrieved attributes.
405: *
406: * @exception InstanceNotFoundException The MBean specified is
407: * not registered in the MBean server.
408: *
409: * @exception ReflectionException An exception occurred when trying to
410: * invoke the getAttributes method of a Dynamic MBean.
411: *
412: * @exception RuntimeOperationsException Wrap a
413: * <CODE>java.lang.IllegalArgumentException</CODE>:
414: * The object name in parameter is null
415: * or attributes in parameter is null.
416: */
417: public AttributeList getAttributes(ObjectName name,
418: String[] attributes) throws InstanceNotFoundException,
419: ReflectionException;
420:
421: /**
422: * Returns the default domain used for naming the MBean. The default
423: * domain name is used as the domain part in the ObjectName of MBeans
424: * if no domain is specified by the user.
425: */
426: public String getDefaultDomain();
427:
428: /**
429: * Returns the number of MBeans controlled by the MBeanServer.
430: */
431: public Integer getMBeanCount();
432:
433: /**
434: * This method discovers the attributes and operations that an MBean exposes
435: * for management.
436: *
437: * @param name The name of the MBean to analyze
438: *
439: * @return An instance of <CODE>MBeanInfo</CODE> allowing the retrieval
440: * of all attributes and operations of this MBean.
441: *
442: * @exception IntrospectionException An exception occurs during introspection.
443: *
444: * @exception InstanceNotFoundException The MBean specified is not found.
445: *
446: * @exception ReflectionException An exception occurred when trying
447: * to invoke the getMBeanInfo of a Dynamic MBean.
448: */
449: public MBeanInfo getMBeanInfo(ObjectName name)
450: throws InstanceNotFoundException, IntrospectionException,
451: ReflectionException;
452:
453: /**
454: * Gets the <CODE>ObjectInstance</CODE> for a given MBean registered
455: * with the MBean server.
456: *
457: * @param name The object name of the MBean.
458: *
459: * @return The <CODE>ObjectInstance</CODE> associated to the
460: * MBean specified by <VAR>name</VAR>.
461: *
462: * @exception InstanceNotFoundException The MBean specified is not
463: * registered in the MBean server.
464: */
465: public ObjectInstance getObjectInstance(ObjectName name)
466: throws InstanceNotFoundException;
467:
468: /**
469: * Instantiates an object using the list of all class loaders registered
470: * in the MBean server
471: * ({@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}).
472: * The object's class should have a public constructor. It returns a
473: * reference to the newly created object. The newly created object is
474: * not registered in the MBean server.
475: *
476: * @param className The class name of the object to be instantiated.
477: *
478: * @return The newly instantiated object.
479: *
480: * @exception ReflectionException Wraps a
481: * <CODE>java.lang.ClassNotFoundException</CODE>
482: * or the <CODE>java.lang.Exception</CODE> that occurred
483: * when trying to invoke the object's constructor.
484: *
485: * @exception MBeanException The constructor of the object has thrown an exception.
486: *
487: * @exception RuntimeOperationsException Wraps a
488: * <CODE>java.lang.IllegalArgumentException</CODE>:
489: * The className passed in parameter is null.
490: */
491: public java.lang.Object instantiate(String className)
492: throws ReflectionException, MBeanException;
493:
494: /**
495: * Instantiates an object using the list of all class loaders registered
496: * in the MBean server
497: * ({@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}).
498: * The object's class should have a public constructor. The call returns
499: * a reference to the newly created object. The newly created object is
500: * not registered in the MBean server.
501: *
502: * @param className The class name of the object to be instantiated.
503: *
504: * @param params An array containing the parameters of the constructor to be invoked.
505: *
506: * @param signature An array containing the signature of the constructor to be invoked.
507: *
508: * @return The newly instantiated object.
509: *
510: * @exception ReflectionException Wraps a
511: * <CODE>java.lang.ClassNotFoundException</CODE>
512: * or the <CODE>java.lang.Exception</CODE> that occurred
513: * when trying to invoke the object's constructor.
514: *
515: * @exception MBeanException The constructor of the object has thrown an exception
516: *
517: * @exception RuntimeOperationsException Wraps a
518: * <CODE>java.lang.IllegalArgumentException</CODE>:
519: * The className passed in parameter is null.
520: */
521: public java.lang.Object instantiate(String className,
522: Object[] params, String[] signature)
523: throws ReflectionException, MBeanException;
524:
525: /**
526: * Instantiates an object using the class Loader specified by its
527: * <CODE>ObjectName</CODE>. If the loader name is null, the ClassLoader
528: * that loaded the MBean Server will be used. The object's class should
529: * have a public constructor. It returns a reference to the newly created
530: * object. The newly created object is not registered in the MBean server.
531: *
532: * @param className The class name of the MBean to be instantiated.
533: *
534: * @param loaderName The object name of the class loader to be used.
535: *
536: * @return The newly instantiated object.
537: *
538: * @exception ReflectionException Wraps a
539: * <CODE>java.lang.ClassNotFoundException</CODE>
540: * or the <CODE>java.lang.Exception</CODE> that occurred
541: * when trying to invoke the object's constructor.
542: *
543: * @exception MBeanException The constructor of the object has thrown an exception.
544: *
545: * @exception InstanceNotFoundException The specified class loader is
546: * not registered in the MBaenServer.
547: *
548: * @exception RuntimeOperationsException Wraps a
549: * <CODE>java.lang.IllegalArgumentException</CODE>:
550: * The className passed in parameter is null.
551: */
552: public java.lang.Object instantiate(String className,
553: ObjectName loaderName) throws ReflectionException,
554: MBeanException, InstanceNotFoundException;
555:
556: /**
557: * Instantiates an object. The class loader to be used is identified by
558: * its object name. If the object name of the loader is null, the
559: * ClassLoader that loaded the MBean server will be used. The object's
560: * class should have a public constructor. The call returns a reference
561: * to the newly created object. The newly created object is not
562: * registered in the MBean server.
563: *
564: * @param className The class name of the object to be instantiated.
565: *
566: * @param params An array containing the parameters of the constructor to be invoked.
567: *
568: * @param signature An array containing the signature of the constructor to be invoked.
569: *
570: * @param loaderName The object name of the class loader to be used.
571: *
572: * @return The newly instantiated object.
573: *
574: * @exception ReflectionException Wraps a
575: * <CODE>java.lang.ClassNotFoundException</CODE>
576: * or the <CODE>java.lang.Exception</CODE> that occurred
577: * when trying to invoke the object's constructor.
578: *
579: * @exception MBeanException The constructor of the object has thrown
580: * an exception.
581: *
582: * @exception InstanceNotFoundException The specified class loader is
583: * not registered in the MBean server.
584: *
585: * @exception RuntimeOperationsException Wraps a
586: * <CODE>java.lang.IllegalArgumentException</CODE>:
587: * The className passed in parameter is null.
588: */
589: public java.lang.Object instantiate(String className,
590: ObjectName loaderName, Object[] params, String[] signature)
591: throws ReflectionException, MBeanException,
592: InstanceNotFoundException;
593:
594: /**
595: * Invokes an operation on an MBean.
596: *
597: * @param name The object name of the MBean on which the method is to be invoked.
598: *
599: * @param operationName The name of the operation to be invoked.
600: *
601: * @param params An array containing the parameters to be set when
602: * the operation is invoked.
603: *
604: * @param signature An array containing the signature of the operation.
605: * The class objects will be loaded using the same
606: * class loader as the one used for loading the MBean on
607: * which the operation was invoked.
608: *
609: * @return The object returned by the operation, which represents the
610: * result ofinvoking the operation on the MBean specified.
611: *
612: * @exception InstanceNotFoundException The MBean specified is
613: * not registered in the MBean server.
614: *
615: * @exception MBeanException Wraps an exception thrown by the MBean's invoked method.
616: *
617: * @exception ReflectionException Wraps a <CODE>java.lang.Exception</CODE>
618: * thrown while trying to invoke the method.
619: */
620: public Object invoke(ObjectName name, String actionName,
621: Object[] params, String[] signature)
622: throws InstanceNotFoundException, MBeanException,
623: ReflectionException;
624:
625: /**
626: * Checks whether an MBean, identified by its object name, is already
627: * registered with the MBean server.
628: *
629: * @param name The object name of the MBean to be checked.
630: *
631: * @return True if the MBean is already registered in the
632: * MBean server, false otherwise.
633: *
634: * @exception RuntimeOperationsException Wraps a
635: * <CODE>java.lang.IllegalArgumentException</CODE>:
636: * The object name in parameter is null.
637: */
638: public boolean isRegistered(ObjectName name);
639:
640: /**
641: * Returns true if the MBean specified is an instance of the specified
642: * class, false otherwise.
643: *
644: * @param name The <CODE>ObjectName</CODE> of the MBean.
645: *
646: * @param className The name of the class.
647: *
648: * @return true if the MBean specified is an instance of the
649: * specified class, false otherwise.
650: *
651: * @exception InstanceNotFoundException The MBean specified is not
652: * registered in the MBean server.
653: */
654: public boolean isInstanceOf(ObjectName name, String className)
655: throws InstanceNotFoundException;
656:
657: /**
658: * Gets MBeans controlled by the MBean server. This method allows any of
659: * the following to be obtained: All MBeans, a set of MBeans specified
660: * by pattern matching on the <CODE>ObjectName</CODE> and/or a
661: * Query expression, a specific MBean. When the object name is null or
662: * no domain and key properties are specified, all objects are to be
663: * selected (and filtered if a query is specified). It returns the set
664: * of <CODE>ObjectInstance</CODE> objects (containing the
665: * <CODE>ObjectName</CODE> and the Java Class name) for the selected MBeans.
666: *
667: * @param name The object name pattern identifying the MBeans to be
668: * retrieved. If null or no domain and key properties are
669: * specified, all the MBeans registered will be retrieved.
670: *
671: * @param query The query expression to be applied for selecting MBeans. If
672: * null no query expression will be applied for selecting MBeans.
673: *
674: * @return A set containing the <CODE>ObjectInstance</CODE> objects for
675: * the selected MBeans. If no MBean satisfies the query
676: * an empty list is returned.
677: */
678: public Set queryMBeans(ObjectName name, QueryExp query);
679:
680: /**
681: * Gets the names of MBeans controlled by the MBean server. This method
682: * enables any of the following to be obtained: The names of all MBeans,
683: * the names of a set of MBeans specified by pattern matching on the
684: * <CODE>ObjectName</CODE> and/or a Query expression, a specific MBean name
685: * (equivalent to testing whether an MBean is registered). When the
686: * object name is null or no domain and key properties are specified,
687: * all objects are selected (and filtered if a query is specified). It
688: * returns the set of ObjectNames for the MBeans selected.
689: *
690: * @param name The object name pattern identifying the MBeans to be
691: * retrieved. If null or no domain and key properties are
692: * specified, all the MBeans registered will be retrieved.
693: *
694: * @param query The query expression to be applied for selecting MBeans. If
695: * null no query expression will be applied for selecting MBeans.
696: *
697: * @return A set containing the ObjectNames for the MBeans selected. If
698: * no MBean satisfies the query, an empty list is returned.
699: */
700: public Set queryNames(ObjectName name, QueryExp query);
701:
702: /**
703: * Registers a pre-existing object as an MBean with the MBean server. If
704: * the object name given is null, the MBean may automatically provide its
705: * own name by implementing the
706: * {@link javax.management.MBeanRegistration MBeanRegistration} interface.
707: * The call returns an <CODE>ObjectInstance</CODE> object
708: * representing the registered MBean.
709: *
710: * @param object The MBean to be registered as an MBean.
711: *
712: * @param name The object name of the MBean. May be null.
713: *
714: * @return The <CODE>ObjectInstance</CODE> for the registered MBean.
715: *
716: * @exception InstanceAlreadyExistsException The MBean is already
717: * under the control of the MBean server.
718: *
719: * @exception MBeanRegistrationException The <CODE>preRegister</CODE>
720: * (<CODE>MBeanRegistration</CODE> interface) method of the
721: * MBean has thrown an exception. The MBean will not be registered.
722: *
723: * @exception NotCompliantMBeanException This object is not a JMX compliant MBean.
724: *
725: * @exception RuntimeOperationsException Wraps a
726: * <CODE>java.lang.IllegalArgumentException</CODE>:
727: * The object passed in parameter is null
728: * or no object name is specified.
729: */
730: public ObjectInstance registerMBean(Object object, ObjectName name)
731: throws InstanceAlreadyExistsException,
732: MBeanRegistrationException, NotCompliantMBeanException;
733:
734: /**
735: * Enables to remove a listener from a registered MBean.
736: *
737: * @param name The name of the MBean on which the listener should be removed.
738: *
739: * @param listener The listener object which will handle the notifications
740: * emitted by the registered MBean. This method will remove
741: * all the information related to this listener.
742: *
743: * @exception InstanceNotFoundException The MBean name provided
744: * does not match any of the registered MBeans.
745: *
746: * @exception ListenerNotFoundException The couple (listener,handback)
747: * is not registered in the MBean. The exception message
748: * contains either "listener", "handback" or the object name
749: * depending on which object cannot be found.
750: */
751: public void removeNotificationListener(ObjectName name,
752: NotificationListener listener)
753: throws InstanceNotFoundException, ListenerNotFoundException;
754:
755: /**
756: * Enables to remove a listener from a registered MBean.
757: *
758: * @param name The name of the MBean on which the listener should be removed.
759: *
760: * @param listener The object name of the listener which will handle the
761: * notifications emitted by the registered MBean. This method
762: * will remove all the information related to this listener.
763: *
764: * @exception InstanceNotFoundException The MBean name provided
765: * does not match any of the registered MBeans.
766: *
767: * @exception ListenerNotFoundException The couple (listener,handback) is
768: * not registered in the MBean. The exception message
769: * contains either "listener", "handback" or the object name
770: * depending on which object cannot be found.
771: */
772: public void removeNotificationListener(ObjectName name,
773: ObjectName listener) throws InstanceNotFoundException,
774: ListenerNotFoundException;
775:
776: /**
777: * Sets the value of a specific attribute of a named MBean. The MBean
778: * is identified by its object name.
779: *
780: * @param name The name of the MBean within which the attribute is to be set.
781: *
782: * @param attribute The identification of the attribute to be set and
783: * the value it is to be set to.
784: *
785: * @return The value of the attribute that has been set.
786: *
787: * @exception InstanceNotFoundException The MBean specified is
788: * not registered in the MBean server.
789: *
790: * @exception AttributeNotFoundException The attribute specified is
791: * not accessible in the MBean.
792: *
793: * @exception InvalidAttributeValueException The value specified for
794: * the attribute is not valid.
795: *
796: * @exception MBeanException Wraps an exception thrown by the MBean's setter.
797: *
798: * @exception ReflectionException Wraps a <CODE>java.lang.Exception</CODE>
799: * thrown when trying to invoke the setter.
800: *
801: * @exception RuntimeOperationsException Wraps a
802: * <CODE>java.lang.IllegalArgumentException</CODE>:
803: * The object name in parameter is null
804: * or the attribute in parameter is null.
805: */
806: public void setAttribute(ObjectName name, Attribute attribute)
807: throws InstanceNotFoundException,
808: AttributeNotFoundException, InvalidAttributeValueException,
809: MBeanException, ReflectionException;
810:
811: /**
812: * Sets the values of several attributes of a named MBean. The MBean is
813: * identified by its object name.
814: *
815: * @param name The object name of the MBean within which the attributes
816: * are to be set.
817: *
818: * @param attributes A list of attributes: The identification of the
819: * attributes to be set and the values they are to be set to.
820: *
821: * @return The list of attributes that were set, with their new values.
822: *
823: * @exception InstanceNotFoundException The MBean specified is
824: * not registered in the MBean server.
825: *
826: * @exception ReflectionException An exception occurred when trying to
827: * invoke the getAttributes method of a Dynamic MBean.
828: *
829: * @exception RuntimeOperationsException Wraps a
830: * <CODE>java.lang.IllegalArgumentException</CODE>:
831: * The object name in parameter is null
832: * or attributes in parameter is null.
833: */
834: public AttributeList setAttributes(ObjectName name,
835: AttributeList attributes) throws InstanceNotFoundException,
836: ReflectionException;
837:
838: /**
839: * De-registers an MBean from the MBean server. The MBean is identified
840: * by its object name. Once the method has been invoked, the MBean may
841: * no longer be accessed by its object name.
842: *
843: * @param name The object name of the MBean to be de-registered.
844: *
845: * @exception InstanceNotFoundException The MBean specified is
846: * not registered in the MBean server.
847: *
848: * @exception MBeanRegistrationException The preDeregister
849: * ((<CODE>MBeanRegistration</CODE> interface) method of
850: * the MBean has thrown an exception.
851: *
852: * @exception RuntimeOperationsException Wraps a
853: * <CODE>java.lang.IllegalArgumentException</CODE>:
854: * The object name in parameter is null
855: * or the MBean you are when trying to de-register is the
856: * {@link javax.management.MBeanServerDelegate MBeanServerDelegate} MBean.
857: */
858: public void unregisterMBean(ObjectName name)
859: throws InstanceNotFoundException,
860: MBeanRegistrationException;
861: }
|