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