KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > management > agent > IIOPMBeanServerImpl


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.management.agent;
25
26 import java.security.*;
27 import java.rmi.RemoteException JavaDoc;
28 import java.util.*;
29 import java.io.ObjectInputStream JavaDoc;
30 import javax.ejb.*;
31 import javax.management.*;
32 import javax.management.j2ee.*;
33 import javax.rmi.PortableRemoteObject JavaDoc;
34
35 /**
36  * IIOPMBeanServerImpl provides an IIOP wrapper for MBeanServers in remote VMs
37  *
38  * @author Hans Hrasna
39  */

40 public class IIOPMBeanServerImpl extends PortableRemoteObject JavaDoc implements IIOPMBeanServer {
41
42     private MBeanServer server;
43
44     public IIOPMBeanServerImpl(MBeanServer mbs) throws java.rmi.RemoteException JavaDoc {
45         server = mbs;
46     }
47
48     // javax.management.j2ee.Management implementation starts here
49

50     /**
51      * Gets the names of managed objects controlled by the MEJB. This method
52      * enables any of the following to be obtained: The names of all managed objects,
53      * the names of a set of managed objects specified by pattern matching on the
54      * <CODE>ObjectName</CODE> and/or a Query expression, a specific managed object name (equivalent to
55      * testing whether an managed object is registered). When the object name is
56      * null or no domain and key properties are specified, all objects are selected (and filtered if a
57      * query is specified). It returns the set of ObjectNames for the managed objects selected.
58      * @param name The object name pattern identifying the managed objects to be retrieved. If
59      * null or no domain and key properties are specified, all the managed objects registered will be retrieved.
60      * @param query The query expression to be applied for selecting managed objects. If null
61      * no query expression will be applied for selecting managed objects.
62      * @return A set containing the ObjectNames for the managed objects selected.
63      * If no managed object satisfies the query, an empty list is returned.
64      */

65     public Set queryNames(ObjectName name, QueryExp query) throws RemoteException JavaDoc {
66         return server.queryNames(name, query);
67     }
68
69     /**
70      * Checks whether an MBean, identified by its object name, is already registered with the MBean server.
71      * @param name The object name of the MBean to be checked.
72      * @return True if the MBean is already registered in the MBean server, false otherwise.
73      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The object
74      * name in parameter is null.
75      */

76     public boolean isRegistered(ObjectName name) throws RemoteException JavaDoc {
77         return server.isRegistered(name);
78     }
79
80     /** Returns the number of MBeans registered in the MBean server. */
81     public Integer JavaDoc getMBeanCount() throws RemoteException JavaDoc {
82         return server.getMBeanCount();
83     }
84
85     /**
86      * This method discovers the attributes and operations that an MBean exposes for management.
87      * @param name The name of the MBean to analyze
88      * @return An instance of <CODE>MBeanInfo</CODE> allowing the retrieval of all attributes and operations of this MBean.
89      * @exception IntrospectionException An exception occurs during introspection.
90      * @exception InstanceNotFoundException The MBean specified is not found.
91      * @exception ReflectionException An exception occurred when trying to invoke the getMBeanInfo of a Dynamic MBean.
92      */

93     public MBeanInfo getMBeanInfo(ObjectName name) throws InstanceNotFoundException,
94         IntrospectionException, ReflectionException, RemoteException JavaDoc {
95             return server.getMBeanInfo(name);
96     }
97
98     /**
99      * Gets the value of a specific attribute of a named MBean. The MBean is identified by its object name.
100      * @param name The object name of the MBean from which the attribute is to be retrieved.
101      * @param attribute A String specifying the name of the attribute to be retrieved.
102      * @return The value of the retrieved attribute.
103      * @exception AttributeNotFoundException The attribute specified is not accessible in the MBean.
104      * @exception MBeanException Wraps an exception thrown by the MBean's getter.
105      * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
106      * @exception ReflectionException Wraps a <CODE>java.lang.Exception</CODE> thrown when trying to invoke the setter.
107      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The object name in
108      * parameter is null or the attribute in parameter is null.
109      */

110     public Object JavaDoc getAttribute(ObjectName name, String JavaDoc attribute) throws MBeanException,
111         AttributeNotFoundException, InstanceNotFoundException,
112         ReflectionException, RemoteException JavaDoc {
113             return server.getAttribute(name, attribute);
114     }
115
116     /**
117      * Enables the values of several attributes of a named MBean. The MBean is identified by its object name.
118      * @param name The object name of the MBean from which the attributes are retrieved.
119      * @param attributes A list of the attributes to be retrieved.
120      * @return The list of the retrieved attributes.
121      * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
122      * @exception ReflectionException An exception occurred when trying to invoke the getAttributes method of a Dynamic MBean.
123      * @exception RuntimeOperationsException Wrap a <CODE>java.lang.IllegalArgumentException</CODE>: The object name in
124      * parameter is null or attributes in parameter is null.
125      */

126     public AttributeList getAttributes(ObjectName name, String JavaDoc[] attributes)
127         throws InstanceNotFoundException, ReflectionException, RemoteException JavaDoc {
128             return server.getAttributes(name, attributes);
129     }
130
131     /**
132      * Sets the value of a specific attribute of a named MBean. The MBean is identified by its object name.
133      * @param name The name of the MBean within which the attribute is to be set.
134      * @param attribute The identification of the attribute to be set and the value it is to be set to.
135      * @return The value of the attribute that has been set.
136      * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
137      * @exception AttributeNotFoundException The attribute specified is not accessible in the MBean.
138      * @exception InvalidAttributeValueException The value specified for the attribute is not valid.
139      * @exception MBeanException Wraps an exception thrown by the MBean's setter.
140      * @exception ReflectionException Wraps a <CODE>java.lang.Exception</CODE> thrown when trying to invoke the setter.
141      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The object name in
142      * parameter is null or the attribute in parameter is null.
143      */

144     public void setAttribute(ObjectName name, Attribute attribute)
145         throws InstanceNotFoundException, AttributeNotFoundException,
146         InvalidAttributeValueException, MBeanException,
147         ReflectionException, RemoteException JavaDoc {
148             server.setAttribute(name, attribute);
149     }
150
151     /**
152      * Sets the values of several attributes of a named MBean. The MBean is identified by its object name.
153      * @param name The object name of the MBean within which the attributes are to be set.
154      * @param attributes A list of attributes: The identification of the
155      * attributes to be set and the values they are to be set to.
156      * @return The list of attributes that were set, with their new values.
157      * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
158      * @exception ReflectionException An exception occurred when trying to invoke the getAttributes method of a Dynamic MBean.
159      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The object name in
160      * parameter is null or attributes in parameter is null.
161      */

162     public AttributeList setAttributes(ObjectName name, AttributeList attributes)
163         throws InstanceNotFoundException, ReflectionException, RemoteException JavaDoc {
164             return server.setAttributes(name, attributes);
165     }
166
167     /**
168      * Invokes an operation on an MBean.
169      * @param name The object name of the MBean on which the method is to be invoked.
170      * @param operationName The name of the operation to be invoked.
171      * @param params An array containing the parameters to be set when the operation is invoked
172      * @param signature An array containing the signature of the operation. The class objects will
173      * be loaded using the same class loader as the one used for loading the MBean on which the operation was invoked.
174      * @return The object returned by the operation, which represents the result ofinvoking the operation
175      * on the MBean specified.
176      * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
177      * @exception MBeanException Wraps an exception thrown by the MBean's invoked method.
178      * @exception ReflectionException Wraps a <CODE>java.lang.Exception</CODE> thrown while trying to invoke the method.
179      */

180     public Object JavaDoc invoke(ObjectName name, String JavaDoc operationName, Object JavaDoc[] params, String JavaDoc[] signature)
181         throws InstanceNotFoundException, MBeanException,
182         ReflectionException, RemoteException JavaDoc {
183             return server.invoke(name, operationName, params, signature);
184     }
185
186     /**
187      * Returns the default domain used for naming the managed object.
188      * The default domain name is used as the domain part in the ObjectName
189      * of managed objects if no domain is specified by the user.
190      */

191     public String JavaDoc getDefaultDomain() throws RemoteException JavaDoc {
192         return server.getDefaultDomain();
193     }
194
195     /*
196      * returns the ListenerRegistry implementation for this MEJB
197      */

198
199     /*ListenerRegistration getListenerRegistry() throws RemoteException {
200         if (listenerRegistry == null) {
201
202             listenerRegistry = new ListenerRegistry(ctx.toString());
203             System.out.println("Created new ListenerRegistry...");
204         }
205         return listenerRegistry;
206     }*/

207
208     // Additional MBeanServer interface implementation starts here
209

210     /**
211      * Instantiates an object using the list of all class loaders registered
212      * in the MBean server ({@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}).
213      * The object's class should have a public constructor. It returns a reference to the newly created object.
214      * The newly created object is not registered in the MBean server.
215      * @param className The class name of the object to be instantiated.
216      * @return The newly instantiated object.
217      * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or the
218      * <CODE>java.lang.Exception</CODE> that occurred when trying to invoke the object's constructor.
219      * @exception MBeanException The constructor of the object has thrown an exception
220      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className
221      * passed in parameter is null.
222      */

223     public Object JavaDoc instantiate(String JavaDoc className) throws ReflectionException, MBeanException, RemoteException JavaDoc {
224         return server.instantiate(className);
225     }
226
227     /**
228      * Instantiates an object using the class Loader specified by its <CODE>ObjectName</CODE>.
229      * If the loader name is null, the ClassLoader that loaded the MBean Server will be used.
230      * The object's class should have a public constructor. It returns a reference to the newly created object.
231      * The newly created object is not registered in the MBean server.
232      * @param className The class name of the MBean to be instantiated.
233      * @param loaderName The object name of the class loader to be used.
234      * @return The newly instantiated object.
235      * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or the
236      * <CODE>java.lang.Exception</CODE> that occurred when trying to invoke the object's constructor.
237      * @exception MBeanException The constructor of the object has thrown an exception.
238      * @exception InstanceNotFoundException The specified class loader is not registered in the MBaenServer.
239      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className
240      * passed in parameter is null.
241      */

242     public Object JavaDoc instantiate(String JavaDoc className, ObjectName loaderName) throws ReflectionException,
243         MBeanException, InstanceNotFoundException, RemoteException JavaDoc {
244             return server.instantiate(className, loaderName);
245     }
246
247     /**
248      * Instantiates an object using the list of all class loaders registered
249      * in the MBean server ({@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}).
250      * The object's class should have a public constructor. The call returns a reference to the newly created object.
251      * The newly created object is not registered in the MBean server.
252      * @param className The class name of the object to be instantiated.
253      * @param params An array containing the parameters of the constructor to be invoked.
254      * @param signature An array containing the signature of the constructor to be invoked.
255      * @return The newly instantiated object.
256      * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or the
257      * <CODE>java.lang.Exception</CODE> that occurred when trying to invoke the object's constructor.
258      * @exception MBeanException The constructor of the object has thrown an exception
259      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className
260      * passed in parameter is null.
261      */

262     public Object JavaDoc instantiate(String JavaDoc className, Object JavaDoc[] params, String JavaDoc[] signature) throws ReflectionException,
263         MBeanException, RemoteException JavaDoc {
264             return server.instantiate(className, params, signature);
265     }
266
267     /**
268      * Instantiates an object. The class loader to be used is identified by its object
269      * name. If the object name of the loader is null, the ClassLoader that loaded the MBean server will be used.
270      * The object's class should have a public constructor. The call returns a reference to the newly created object.
271      * The newly created object is not registered in the MBean server.
272      * @param className The class name of the object to be instantiated.
273      * @param params An array containing the parameters of the constructor to be invoked.
274      * @param signature An array containing the signature of the constructor to be invoked.
275      * @param loaderName The object name of the class loader to be used.
276      * @return The newly instantiated object.
277      * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or the
278      * <CODE>java.lang.Exception</CODE> that occurred when trying to invoke the object's constructor.
279      * @exception MBeanException The constructor of the object has thrown an exception
280      * @exception InstanceNotFoundException The specified class loader is not registered in the MBean server.
281      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className
282      * passed in parameter is null.
283      */

284     public Object JavaDoc instantiate(String JavaDoc className, ObjectName loaderName, Object JavaDoc[] params, String JavaDoc[] signature)
285         throws ReflectionException, MBeanException,
286         InstanceNotFoundException, RemoteException JavaDoc {
287             return server.instantiate(className, loaderName, params, signature);
288     }
289
290     /**
291      * Instantiates and registers an MBean in the MBean server. The MBean server will use the {@link
292      * javax.management.loading.DefaultLoaderRepository Default Loader Repository} to load the class of the MBean.
293      * An object name is associated to the MBean. If the object name given is null, the MBean can automatically provide its
294      * own name by implementing the {@link javax.management.MBeanRegistration MBeanRegistration} interface. The call returns
295      * an <CODE>ObjectInstance</CODE> object representing the newly created MBean.
296      * @param className The class name of the MBean to be instantiated.
297      * @param name The object name of the MBean. May be null.
298      * @return An <CODE>ObjectInstance</CODE>, containing the <CODE>ObjectName</CODE> and the Java class name
299      * of the newly instantiated MBean.
300      * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or a
301      * <CODE><CODE>java.lang.Exception</CODE></CODE> that occurred when trying to invoke the MBean's constructor.
302      * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server.
303      * @exception MBeanRegistrationException The <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE> interface) method of
304      * the MBean has thrown an exception. The MBean will not be registered.
305      * @exception MBeanException The constructor of the MBean has thrown an exception
306      * @exception NotCompliantMBeanException This class is not a JMX compliant MBean
307      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className passed in
308      * parameter is null, the <CODE>ObjectName</CODE> passed in parameter contains a pattern or no <CODE>ObjectName</CODE> is
309      * specified for the MBean.
310      */

311     public ObjectInstance createMBean(String JavaDoc className, ObjectName name) throws ReflectionException,
312         InstanceAlreadyExistsException, MBeanRegistrationException, MBeanException,
313         NotCompliantMBeanException, RemoteException JavaDoc {
314             return server.createMBean(className, name);
315     }
316
317     /**
318      * Instantiates and registers an MBean in the MBean server. The class loader to be used is identified by its object name.
319      * An object name is associated to the MBean. If the object name of the loader is null, the ClassLoader that loaded the
320      * MBean server will be used. If the MBean's object name given is null, the MBean can automatically provide its
321      * own name by implementing the {@link javax.management.MBeanRegistration MBeanRegistration} interface. The call returns
322      * an <CODE>ObjectInstance</CODE> object representing the newly created MBean.
323      * @param className The class name of the MBean to be instantiated.
324      * @param name The object name of the MBean. May be null.
325      * @param loaderName The object name of the class loader to be used.
326      * @return An <CODE>ObjectInstance</CODE>, containing the <CODE>ObjectName</CODE> and the Java class name
327      * of the newly instantiated MBean.
328      * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or a
329      * <CODE>java.lang.Exception</CODE> that occurred when trying to invoke the MBean's constructor.
330      * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server.
331      * @exception MBeanRegistrationException The <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE> interface) method
332      * of the MBean has thrown an exception. The MBean will not be registered.
333      * @exception MBeanException The constructor of the MBean has thrown an exception
334      * @exception NotCompliantMBeanException This class is not a JMX compliant MBean
335      * @exception InstanceNotFoundException The specified class loader is not registered in the MBean server.
336      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className passed in
337      * parameter is null, the <CODE>ObjectName</CODE> passed in parameter contains a pattern or no <CODE>ObjectName</CODE> is
338      * specified for the MBean.
339      */

340     public ObjectInstance createMBean(String JavaDoc className, ObjectName name, ObjectName loaderName)
341         throws ReflectionException, InstanceAlreadyExistsException,
342         MBeanRegistrationException, MBeanException, NotCompliantMBeanException,
343         InstanceNotFoundException, RemoteException JavaDoc {
344             return server.createMBean(className, name, loaderName);
345     }
346
347     /**
348      * Instantiates and registers an MBean in the MBean server.
349      * The MBean server will use the {@link javax.management.loading.DefaultLoaderRepository Default Loader Repository}
350      * to load the class of the MBean. An object name is associated to the MBean. If the object name given is null, the MBean
351      * can automatically provide its own name by implementing the {@link javax.management.MBeanRegistration MBeanRegistration}
352      * interface. The call returns an <CODE>ObjectInstance</CODE> object representing the newly created MBean.
353      * @param className The class name of the MBean to be instantiated.
354      * @param name The object name of the MBean. May be null.
355      * @param params An array containing the parameters of the constructor to be invoked.
356      * @param signature An array containing the signature of the constructor to be invoked.
357      * @return An <CODE>ObjectInstance</CODE>, containing the <CODE>ObjectName</CODE> and the Java class name
358      * of the newly instantiated MBean.
359      * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or a
360      * <CODE>java.lang.Exception</CODE> that occurred when trying to invoke the MBean's constructor.
361      * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server.
362      * @exception MBeanRegistrationException The <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE> interface) method
363      * of the MBean has thrown an exception. The MBean will not be registered.
364      * @exception MBeanException The constructor of the MBean has thrown an exception
365      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className passed in
366      * parameter is null, the <CODE>ObjectName</CODE> passed in parameter contains a pattern or no <CODE>ObjectName</CODE> is
367      * specified for the MBean.
368      */

369     public ObjectInstance createMBean(String JavaDoc className, ObjectName name, Object JavaDoc[] params, String JavaDoc[] signature)
370         throws ReflectionException, InstanceAlreadyExistsException,
371         MBeanRegistrationException, MBeanException, NotCompliantMBeanException, RemoteException JavaDoc {
372             return server.createMBean(className, name, params, signature);
373     }
374
375     /**
376      * Instantiates and registers an MBean in the MBean server. The class loader to be used is identified by its object
377      * name. An object name is associated to the MBean. If the object name
378      * of the loader is not specified, the ClassLoader that loaded the MBean server will be used.
379      * If the MBean object name given is null, the MBean can automatically provide its
380      * own name by implementing the {@link javax.management.MBeanRegistration MBeanRegistration} interface. The call returns
381      * an <CODE>ObjectInstance</CODE> object representing the newly created MBean.
382      * @param className The class name of the MBean to be instantiated.
383      * @param name The object name of the MBean. May be null.
384      * @param params An array containing the parameters of the constructor to be invoked.
385      * @param signature An array containing the signature of the constructor to be invoked.
386      * @param loaderName The object name of the class loader to be used.
387      * @return An <CODE>ObjectInstance</CODE>, containing the <CODE>ObjectName</CODE> and the Java class name
388      * of the newly instantiated MBean.
389      * @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or a
390      * <CODE>java.lang.Exception</CODE> that occurred when trying to invoke the MBean's constructor.
391      * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server.
392      * @exception MBeanRegistrationException The <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE> interface) method
393      * of the MBean has thrown an exception. The MBean will not be registered.
394      * @exception MBeanException The constructor of the MBean has thrown an exception
395      * @exception InstanceNotFoundException The specified class loader is not registered in the MBean server.
396      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The className passed in
397      * parameter is null, the <CODE>ObjectName</CODE> passed in parameter contains a pattern or no <CODE>ObjectName</CODE> is
398      * specified for the MBean.
399      */

400     public ObjectInstance createMBean(String JavaDoc className, ObjectName name, ObjectName loaderName, Object JavaDoc[] params, String JavaDoc[] signature)
401         throws ReflectionException, InstanceAlreadyExistsException,
402         MBeanRegistrationException, MBeanException, NotCompliantMBeanException,
403         InstanceNotFoundException, RemoteException JavaDoc {
404             return server.createMBean(className, name, loaderName, params, signature);
405     }
406
407     /**
408      * Registers a pre-existing object as an MBean with the MBean server. If the object name given is
409      * null, the MBean may automatically provide its own name by implementing the
410      * {@link javax.management.MBeanRegistration MBeanRegistration} interface.
411      * The call returns an <CODE>ObjectInstance</CODE> object representing the registered MBean.
412      * @param object The MBean to be registered as an MBean.
413      * @param name The object name of the MBean. May be null.
414      * @return The <CODE>ObjectInstance</CODE> for the MBean that has been registered.
415      * @exception InstanceAlreadyExistsException The MBean is already under the control of the MBean server.
416      * @exception MBeanRegistrationException The <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE> interface) method
417      * of the MBean has thrown an exception. The MBean will not be registered.
418      * @exception NotCompliantMBeanException This object is not a JMX compliant MBean
419      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The object passed in
420      * parameter is null or no object name is specified.
421      */

422     public ObjectInstance registerMBean(Object JavaDoc object, ObjectName name) throws InstanceAlreadyExistsException,
423         MBeanRegistrationException, NotCompliantMBeanException, RemoteException JavaDoc {
424             return server.registerMBean(object, name);
425     }
426
427     /**
428      * De-registers an MBean from the MBean server. The MBean is identified by
429      * its object name. Once the method has been invoked, the MBean may no longer be accessed by its object name.
430      * @param name The object name of the MBean to be de-registered.
431      * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
432      * @exception MBeanRegistrationException The preDeregister ((<CODE>MBeanRegistration</CODE> interface) method of the MBean
433      * has thrown an exception.
434      * @exception RuntimeOperationsException Wraps a <CODE>java.lang.IllegalArgumentException</CODE>: The object name in
435      * parameter is null or the MBean you are when trying to de-register is the {@link javax.management.MBeanServerDelegate
436      * MBeanServerDelegate} MBean.
437      */

438     public void unregisterMBean(ObjectName name) throws InstanceNotFoundException,
439         MBeanRegistrationException, RemoteException JavaDoc {
440             server.unregisterMBean(name);
441     }
442
443     /**
444      * Gets the <CODE>ObjectInstance</CODE> for a given MBean registered with the MBean server.
445      * @param name The object name of the MBean.
446      * @return The <CODE>ObjectInstance</CODE> associated to the MBean specified by <VAR>name</VAR>.
447      * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
448      */

449     public ObjectInstance getObjectInstance(ObjectName name)
450         throws InstanceNotFoundException, RemoteException JavaDoc {
451             return server.getObjectInstance(name);
452     }
453
454     /**
455      * Gets MBeans controlled by the MBean server. This method allows any
456      * of the following to be obtained: All MBeans, a set of MBeans specified
457      * by pattern matching on the <CODE>ObjectName</CODE> and/or a Query expression, a
458      * specific MBean. When the object name is null or no domain and key properties are specified, all objects are to be
459      * selected (and filtered if a query is specified). It returns the
460      * set of <CODE>ObjectInstance</CODE> objects (containing the <CODE>ObjectName</CODE> and the Java Class name)
461      * for the selected MBeans.
462      * @param name The object name pattern identifying the MBeans to be retrieved. If
463      * null or no domain and key properties are specified, all the MBeans registered will be retrieved.
464      * @param query The query expression to be applied for selecting MBeans. If null
465      * no query expression will be applied for selecting MBeans.
466      * @return A set containing the <CODE>ObjectInstance</CODE> objects for the selected MBeans.
467      * If no MBean satisfies the query an empty list is returned.
468      */

469     public Set queryMBeans(ObjectName name, QueryExp query) throws RemoteException JavaDoc {
470         return server.queryMBeans(name, query);
471     }
472
473     /**
474      * Returns the default domain used for naming the MBean. The default domain name is used as the domain part in the
475      * ObjectName of MBeans if no domain is specified by the user.
476      */

477     //public String getDefaultDomain() throws RemoteException;
478

479     /**
480      * Enables to add a listener to a registered MBean.
481      * @param name The name of the MBean on which the listener should be added.
482      * @param listener The listener object which will handle the notifications emitted by the registered MBean.
483      * @param filter The filter object. If filter is null, no filtering will be performed before handling notifications.
484      * @param handback The context to be sent to the listener when a notification is emitted.
485      * @exception InstanceNotFoundException The MBean name provided does not match any of the registered MBeans.
486      */

487     public void addNotificationListener(ObjectName name, NotificationListener listener, NotificationFilter filter, Object JavaDoc handback)
488         throws InstanceNotFoundException, RemoteException JavaDoc {
489 /* ***** FIX THIS *****
490         if (listener instanceof RemoteListenerConnector) {
491             ((RemoteListenerConnector)listener).setMBeanServer(server);
492         }
493         server.addNotificationListener(name, listener, filter, handback);
494 */

495     }
496
497     /**
498      * Enables to add a listener to a registered MBean.
499      * @param name The name of the MBean on which the listener should be added.
500      * @param listener The object name of the listener which will handle the notifications emitted by the registered MBean.
501      * @param filter The filter object. If filter is null, no filtering will be performed before handling notifications.
502      * @param handback The context to be sent to the listener when a notification is emitted.
503      * @exception InstanceNotFoundException The MBean name of the notification listener or of the notification broadcaster
504      * does not match any of the registered MBeans.
505      */

506     public void addNotificationListener(ObjectName name, ObjectName listener, NotificationFilter filter, Object JavaDoc handback)
507         throws InstanceNotFoundException, RemoteException JavaDoc {
508             server.addNotificationListener(name, listener, filter, handback);
509     }
510
511     /**
512      * Enables to remove a listener from a registered MBean.
513      * @param name The name of the MBean on which the listener should be removed.
514      * @param listener The listener object which will handle the notifications emitted by the registered MBean.
515      * This method will remove all the information related to this listener.
516      * @exception InstanceNotFoundException The MBean name provided does not match any of the registered MBeans.
517      * @exception ListenerNotFoundException The listener is not registered in the MBean.
518      */

519     public void removeNotificationListener(ObjectName name, NotificationListener listener)
520         throws InstanceNotFoundException, ListenerNotFoundException, RemoteException JavaDoc {
521             server.removeNotificationListener(name, listener);
522     }
523
524     /**
525      * Enables to remove a listener from a registered MBean.
526      * @param name The name of the MBean on which the listener should be removed.
527      * @param listener The object name of the listener which will handle the notifications emitted by the registered MBean.
528      * This method will remove all the information related to this listener.
529      * @exception InstanceNotFoundException The MBean name provided does not match any of the registered MBeans.
530      * @exception ListenerNotFoundException The listener is not registered in the MBean.
531      */

532     public void removeNotificationListener(ObjectName name, ObjectName listener) throws InstanceNotFoundException,
533         ListenerNotFoundException, RemoteException JavaDoc {
534             server.removeNotificationListener(name, listener);
535     }
536
537     /**
538      * Returns true if the MBean specified is an instance of the specified class, false otherwise.
539      * @param name The <CODE>ObjectName</CODE> of the MBean.
540      * @param className The name of the class.
541      * @return true if the MBean specified is an instance of the specified class, false otherwise.
542      * @exception InstanceNotFoundException The MBean specified is not registered in the MBean server.
543      */

544     public boolean isInstanceOf(ObjectName name, String JavaDoc className)
545         throws InstanceNotFoundException, RemoteException JavaDoc {
546             return server.isInstanceOf(name, className);
547     }
548
549     /**
550      * De-serializes a byte array in the context of the class loader of an MBean.
551      * @param name The name of the MBean whose class loader should be used for the de-serialization.
552      * @param data The byte array to be de-sererialized.
553      * @return The de-serialized object stream.
554      * @exception InstanceNotFoundException The MBean specified is not found.
555      * @exception OperationsException Any of the usual Input/Output related exceptions.
556      */

557     public ObjectInputStream JavaDoc deserialize(ObjectName name, byte[] data) throws InstanceNotFoundException,
558         OperationsException, RemoteException JavaDoc {
559             return server.deserialize(name, data);
560     }
561
562     /**
563      * De-serializes a byte array in the context of a given MBean class loader.
564      * The class loader is the one that loaded the class with name "className".
565      * @param name The name of the class whose class loader should be used for the de-serialization.
566      * @param data The byte array to be de-sererialized.
567      * @return The de-serialized object stream.
568      * @exception OperationsException Any of the usual Input/Output related exceptions.
569      * @exception ReflectionException The specified class could not be loaded by the default loader repository
570      */

571     public ObjectInputStream JavaDoc deserialize(String JavaDoc className, byte[] data) throws OperationsException,
572         ReflectionException, RemoteException JavaDoc {
573             return server.deserialize(className, data);
574     }
575
576     /**
577      * De-serializes a byte array in the context of a given MBean class loader.
578      * The class loader is the one that loaded the class with name "className".
579      * The name of the class loader to be used for loading the specified class is specified.
580      * If null, the MBean Server's class loader will be used.
581      * @param name The name of the class whose class loader should be used for the de-serialization.
582      * @param data The byte array to be de-sererialized.
583      * @param loaderName The name of the class loader to be used for loading the specified class.
584      * If null, the MBean Server's class loader will be used.
585      * @return The de-serialized object stream.
586      * @exception InstanceNotFoundException The specified class loader MBean is not found.
587      * @exception OperationsException Any of the usual Input/Output related exceptions.
588      * @exception ReflectionException The specified class could not be loaded by the specified class loader.
589      */

590     public ObjectInputStream JavaDoc deserialize(String JavaDoc className, ObjectName loaderName, byte[] data)
591         throws InstanceNotFoundException, OperationsException,
592         ReflectionException, RemoteException JavaDoc {
593             return server.deserialize(className, loaderName, data);
594     }
595 }
596
Popular Tags