author | emcmanus |
Tue, 02 Sep 2008 14:14:05 +0200 | |
changeset 1154 | 4561ee1fb2b7 |
parent 1015 | 98e761716380 |
child 1156 | bbc2d15aaf7a |
permissions | -rw-r--r-- |
2 | 1 |
/* |
715 | 2 |
* Copyright 1999-2008 Sun Microsystems, Inc. All Rights Reserved. |
2 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. Sun designates this |
|
8 |
* particular file as subject to the "Classpath" exception as provided |
|
9 |
* by Sun in the LICENSE file that accompanied this code. |
|
10 |
* |
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
21 |
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
22 |
* CA 95054 USA or visit www.sun.com if you need additional information or |
|
23 |
* have any questions. |
|
24 |
*/ |
|
25 |
||
26 |
package javax.management; |
|
27 |
||
28 |
||
29 |
// java import |
|
30 |
import java.util.Set; |
|
31 |
import java.io.ObjectInputStream; |
|
32 |
||
33 |
// RI import |
|
34 |
import javax.management.loading.ClassLoaderRepository; |
|
35 |
||
36 |
/** |
|
37 |
* <p>This is the interface for MBean manipulation on the agent |
|
38 |
* side. It contains the methods necessary for the creation, |
|
39 |
* registration, and deletion of MBeans as well as the access methods |
|
40 |
* for registered MBeans. This is the core component of the JMX |
|
41 |
* infrastructure.</p> |
|
42 |
* |
|
43 |
* <p>User code does not usually implement this interface. Instead, |
|
44 |
* an object that implements this interface is obtained with one of |
|
45 |
* the methods in the {@link MBeanServerFactory} class.</p> |
|
46 |
* |
|
47 |
* <p>Every MBean which is added to the MBean server becomes |
|
48 |
* manageable: its attributes and operations become remotely |
|
49 |
* accessible through the connectors/adaptors connected to that MBean |
|
50 |
* server. A Java object cannot be registered in the MBean server |
|
51 |
* unless it is a JMX compliant MBean.</p> |
|
52 |
* |
|
1015
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
53 |
* <p id="notif">When an MBean is registered or unregistered in the |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
54 |
* MBean server a {@link javax.management.MBeanServerNotification |
2 | 55 |
* MBeanServerNotification} Notification is emitted. To register an |
56 |
* object as listener to MBeanServerNotifications you should call the |
|
57 |
* MBean server method {@link #addNotificationListener |
|
58 |
* addNotificationListener} with <CODE>ObjectName</CODE> the |
|
59 |
* <CODE>ObjectName</CODE> of the {@link |
|
60 |
* javax.management.MBeanServerDelegate MBeanServerDelegate}. This |
|
61 |
* <CODE>ObjectName</CODE> is: <BR> |
|
62 |
* <CODE>JMImplementation:type=MBeanServerDelegate</CODE>.</p> |
|
63 |
* |
|
833
bfa2bef7517c
6323980: Annotations to simplify MBean development
emcmanus
parents:
267
diff
changeset
|
64 |
* <p id="security">An object obtained from the {@link |
2 | 65 |
* MBeanServerFactory#createMBeanServer(String) createMBeanServer} or |
66 |
* {@link MBeanServerFactory#newMBeanServer(String) newMBeanServer} |
|
67 |
* methods of the {@link MBeanServerFactory} class applies security |
|
68 |
* checks to its methods, as follows.</p> |
|
69 |
* |
|
70 |
* <p>First, if there is no security manager ({@link |
|
71 |
* System#getSecurityManager()} is null), then an implementation of |
|
72 |
* this interface is free not to make any checks.</p> |
|
73 |
* |
|
74 |
* <p>Assuming that there is a security manager, or that the |
|
75 |
* implementation chooses to make checks anyway, the checks are made |
|
76 |
* as detailed below. In what follows, <code>className</code> is the |
|
77 |
* string returned by {@link MBeanInfo#getClassName()} for the target |
|
78 |
* MBean.</p> |
|
79 |
* |
|
80 |
* <p>If a security check fails, the method throws {@link |
|
81 |
* SecurityException}.</p> |
|
82 |
* |
|
83 |
* <p>For methods that can throw {@link InstanceNotFoundException}, |
|
84 |
* this exception is thrown for a non-existent MBean, regardless of |
|
85 |
* permissions. This is because a non-existent MBean has no |
|
86 |
* <code>className</code>.</p> |
|
87 |
* |
|
88 |
* <ul> |
|
89 |
* |
|
90 |
* <li><p>For the {@link #invoke invoke} method, the caller's |
|
91 |
* permissions must imply {@link |
|
92 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
93 |
* MBeanPermission(className, operationName, name, "invoke")}.</p> |
|
94 |
* |
|
95 |
* <li><p>For the {@link #getAttribute getAttribute} method, the |
|
96 |
* caller's permissions must imply {@link |
|
97 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
98 |
* MBeanPermission(className, attribute, name, "getAttribute")}.</p> |
|
99 |
* |
|
100 |
* <li><p>For the {@link #getAttributes getAttributes} method, the |
|
101 |
* caller's permissions must imply {@link |
|
102 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
103 |
* MBeanPermission(className, null, name, "getAttribute")}. |
|
104 |
* Additionally, for each attribute <em>a</em> in the {@link |
|
105 |
* AttributeList}, if the caller's permissions do not imply {@link |
|
106 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
107 |
* MBeanPermission(className, <em>a</em>, name, "getAttribute")}, the |
|
108 |
* MBean server will behave as if that attribute had not been in the |
|
109 |
* supplied list.</p> |
|
110 |
* |
|
111 |
* <li><p>For the {@link #setAttribute setAttribute} method, the |
|
112 |
* caller's permissions must imply {@link |
|
113 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
114 |
* MBeanPermission(className, attrName, name, "setAttribute")}, where |
|
115 |
* <code>attrName</code> is {@link Attribute#getName() |
|
116 |
* attribute.getName()}.</p> |
|
117 |
* |
|
118 |
* <li><p>For the {@link #setAttributes setAttributes} method, the |
|
119 |
* caller's permissions must imply {@link |
|
120 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
121 |
* MBeanPermission(className, null, name, "setAttribute")}. |
|
122 |
* Additionally, for each attribute <em>a</em> in the {@link |
|
123 |
* AttributeList}, if the caller's permissions do not imply {@link |
|
124 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
125 |
* MBeanPermission(className, <em>a</em>, name, "setAttribute")}, the |
|
126 |
* MBean server will behave as if that attribute had not been in the |
|
127 |
* supplied list.</p> |
|
128 |
* |
|
129 |
* <li><p>For the <code>addNotificationListener</code> methods, |
|
130 |
* the caller's permissions must imply {@link |
|
131 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
132 |
* MBeanPermission(className, null, name, |
|
133 |
* "addNotificationListener")}.</p> |
|
134 |
* |
|
135 |
* <li><p>For the <code>removeNotificationListener</code> methods, |
|
136 |
* the caller's permissions must imply {@link |
|
137 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
138 |
* MBeanPermission(className, null, name, |
|
139 |
* "removeNotificationListener")}.</p> |
|
140 |
* |
|
141 |
* <li><p>For the {@link #getMBeanInfo getMBeanInfo} method, the |
|
142 |
* caller's permissions must imply {@link |
|
143 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
144 |
* MBeanPermission(className, null, name, "getMBeanInfo")}.</p> |
|
145 |
* |
|
146 |
* <li><p>For the {@link #getObjectInstance getObjectInstance} method, |
|
147 |
* the caller's permissions must imply {@link |
|
148 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
149 |
* MBeanPermission(className, null, name, "getObjectInstance")}.</p> |
|
150 |
* |
|
151 |
* <li><p>For the {@link #isInstanceOf isInstanceOf} method, the |
|
152 |
* caller's permissions must imply {@link |
|
153 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
154 |
* MBeanPermission(className, null, name, "isInstanceOf")}.</p> |
|
155 |
* |
|
156 |
* <li><p>For the {@link #queryMBeans queryMBeans} method, the |
|
157 |
* caller's permissions must imply {@link |
|
158 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
159 |
* MBeanPermission(null, null, name, "queryMBeans")}. |
|
160 |
* Additionally, for each MBean that matches <code>name</code>, |
|
161 |
* if the caller's permissions do not imply {@link |
|
162 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
163 |
* MBeanPermission(className, null, name, "queryMBeans")}, the |
|
164 |
* MBean server will behave as if that MBean did not exist.</p> |
|
165 |
* |
|
166 |
* <p>Certain query elements perform operations on the MBean server. |
|
167 |
* If the caller does not have the required permissions for a given |
|
168 |
* MBean, that MBean will not be included in the result of the query. |
|
169 |
* The standard query elements that are affected are {@link |
|
170 |
* Query#attr(String)}, {@link Query#attr(String,String)}, and {@link |
|
171 |
* Query#classattr()}.</p> |
|
172 |
* |
|
173 |
* <li><p>For the {@link #queryNames queryNames} method, the checks |
|
174 |
* are the same as for <code>queryMBeans</code> except that |
|
175 |
* <code>"queryNames"</code> is used instead of |
|
176 |
* <code>"queryMBeans"</code> in the <code>MBeanPermission</code> |
|
177 |
* objects. Note that a <code>"queryMBeans"</code> permission implies |
|
178 |
* the corresponding <code>"queryNames"</code> permission.</p> |
|
179 |
* |
|
180 |
* <li><p>For the {@link #getDomains getDomains} method, the caller's |
|
181 |
* permissions must imply {@link |
|
182 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
183 |
* MBeanPermission(null, null, name, "getDomains")}. Additionally, |
|
184 |
* for each domain <var>d</var> in the returned array, if the caller's |
|
185 |
* permissions do not imply {@link |
|
186 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
187 |
* MBeanPermission(null, null, new ObjectName("<var>d</var>:x=x"), |
|
188 |
* "getDomains")}, the domain is eliminated from the array. Here, |
|
189 |
* <code>x=x</code> is any <var>key=value</var> pair, needed to |
|
190 |
* satisfy ObjectName's constructor but not otherwise relevant.</p> |
|
191 |
* |
|
192 |
* <li><p>For the {@link #getClassLoader getClassLoader} method, the |
|
193 |
* caller's permissions must imply {@link |
|
194 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
195 |
* MBeanPermission(className, null, loaderName, |
|
196 |
* "getClassLoader")}.</p> |
|
197 |
* |
|
198 |
* <li><p>For the {@link #getClassLoaderFor getClassLoaderFor} method, |
|
199 |
* the caller's permissions must imply {@link |
|
200 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
201 |
* MBeanPermission(className, null, mbeanName, |
|
202 |
* "getClassLoaderFor")}.</p> |
|
203 |
* |
|
204 |
* <li><p>For the {@link #getClassLoaderRepository |
|
205 |
* getClassLoaderRepository} method, the caller's permissions must |
|
206 |
* imply {@link |
|
207 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
208 |
* MBeanPermission(null, null, null, "getClassLoaderRepository")}.</p> |
|
209 |
* |
|
210 |
* <li><p>For the deprecated <code>deserialize</code> methods, the |
|
211 |
* required permissions are the same as for the methods that replace |
|
212 |
* them.</p> |
|
213 |
* |
|
214 |
* <li><p>For the <code>instantiate</code> methods, the caller's |
|
215 |
* permissions must imply {@link |
|
216 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
217 |
* MBeanPermission(className, null, null, "instantiate")}.</p> |
|
218 |
* |
|
219 |
* <li><p>For the {@link #registerMBean registerMBean} method, the |
|
220 |
* caller's permissions must imply {@link |
|
221 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
222 |
* MBeanPermission(className, null, name, "registerMBean")}. Here |
|
223 |
* <code>className</code> is the string returned by {@link |
|
224 |
* MBeanInfo#getClassName()} for an object of this class. |
|
225 |
* |
|
226 |
* <p>If the <code>MBeanPermission</code> check succeeds, the MBean's |
|
227 |
* class is validated by checking that its {@link |
|
228 |
* java.security.ProtectionDomain ProtectionDomain} implies {@link |
|
229 |
* MBeanTrustPermission#MBeanTrustPermission(String) |
|
230 |
* MBeanTrustPermission("register")}.</p> |
|
231 |
* |
|
232 |
* <p>Finally, if the <code>name</code> argument is null, another |
|
233 |
* <code>MBeanPermission</code> check is made using the |
|
234 |
* <code>ObjectName</code> returned by {@link |
|
235 |
* MBeanRegistration#preRegister MBeanRegistration.preRegister}.</p> |
|
236 |
* |
|
237 |
* <li><p>For the <code>createMBean</code> methods, the caller's |
|
238 |
* permissions must imply the permissions needed by the equivalent |
|
239 |
* <code>instantiate</code> followed by |
|
240 |
* <code>registerMBean</code>.</p> |
|
241 |
* |
|
242 |
* <li><p>For the {@link #unregisterMBean unregisterMBean} method, |
|
243 |
* the caller's permissions must imply {@link |
|
244 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
245 |
* MBeanPermission(className, null, name, "unregisterMBean")}.</p> |
|
246 |
* |
|
247 |
* </ul> |
|
248 |
* |
|
249 |
* @since 1.5 |
|
250 |
*/ |
|
251 |
||
252 |
/* DELETED: |
|
253 |
* |
|
254 |
* <li><p>For the {@link #isRegistered isRegistered} method, the |
|
255 |
* caller's permissions must imply {@link |
|
256 |
* MBeanPermission#MBeanPermission(String,String,ObjectName,String) |
|
257 |
* MBeanPermission(null, null, name, "isRegistered")}.</p> |
|
258 |
*/ |
|
259 |
public interface MBeanServer extends MBeanServerConnection { |
|
260 |
||
267
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
261 |
/** |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
262 |
* {@inheritDoc} |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
263 |
* <p>If this method successfully creates an MBean, a notification |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
264 |
* is sent as described <a href="#notif">above</a>.</p> |
1015
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
265 |
* |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
266 |
* @throws RuntimeOperationsException {@inheritDoc} |
1154 | 267 |
* @throws RuntimeMBeanException {@inheritDoc} |
268 |
* @throws RuntimeErrorException {@inheritDoc} |
|
267
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
269 |
*/ |
2 | 270 |
public ObjectInstance createMBean(String className, ObjectName name) |
271 |
throws ReflectionException, InstanceAlreadyExistsException, |
|
272 |
MBeanRegistrationException, MBeanException, |
|
273 |
NotCompliantMBeanException; |
|
274 |
||
267
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
275 |
/** |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
276 |
* {@inheritDoc} |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
277 |
* <p>If this method successfully creates an MBean, a notification |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
278 |
* is sent as described <a href="#notif">above</a>.</p> |
1015
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
279 |
* |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
280 |
* @throws RuntimeOperationsException {@inheritDoc} |
1154 | 281 |
* @throws RuntimeMBeanException {@inheritDoc} |
282 |
* @throws RuntimeErrorException {@inheritDoc} |
|
267
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
283 |
*/ |
2 | 284 |
public ObjectInstance createMBean(String className, ObjectName name, |
285 |
ObjectName loaderName) |
|
286 |
throws ReflectionException, InstanceAlreadyExistsException, |
|
287 |
MBeanRegistrationException, MBeanException, |
|
288 |
NotCompliantMBeanException, InstanceNotFoundException; |
|
289 |
||
267
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
290 |
/** |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
291 |
* {@inheritDoc} |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
292 |
* <p>If this method successfully creates an MBean, a notification |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
293 |
* is sent as described <a href="#notif">above</a>.</p> |
1015
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
294 |
* |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
295 |
* @throws RuntimeOperationsException {@inheritDoc} |
1154 | 296 |
* @throws RuntimeMBeanException {@inheritDoc} |
297 |
* @throws RuntimeErrorException {@inheritDoc} |
|
267
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
298 |
*/ |
2 | 299 |
public ObjectInstance createMBean(String className, ObjectName name, |
300 |
Object params[], String signature[]) |
|
301 |
throws ReflectionException, InstanceAlreadyExistsException, |
|
302 |
MBeanRegistrationException, MBeanException, |
|
303 |
NotCompliantMBeanException; |
|
304 |
||
267
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
305 |
/** |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
306 |
* {@inheritDoc} |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
307 |
* <p>If this method successfully creates an MBean, a notification |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
308 |
* is sent as described <a href="#notif">above</a>.</p> |
1015
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
309 |
* |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
310 |
* @throws RuntimeOperationsException {@inheritDoc} |
1154 | 311 |
* @throws RuntimeMBeanException {@inheritDoc} |
312 |
* @throws RuntimeErrorException {@inheritDoc} |
|
267
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
313 |
*/ |
2 | 314 |
public ObjectInstance createMBean(String className, ObjectName name, |
315 |
ObjectName loaderName, Object params[], |
|
316 |
String signature[]) |
|
317 |
throws ReflectionException, InstanceAlreadyExistsException, |
|
318 |
MBeanRegistrationException, MBeanException, |
|
319 |
NotCompliantMBeanException, InstanceNotFoundException; |
|
320 |
||
321 |
/** |
|
267
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
322 |
* <p>Registers a pre-existing object as an MBean with the MBean |
2 | 323 |
* server. If the object name given is null, the MBean must |
324 |
* provide its own name by implementing the {@link |
|
325 |
* javax.management.MBeanRegistration MBeanRegistration} interface |
|
326 |
* and returning the name from the {@link |
|
267
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
327 |
* MBeanRegistration#preRegister preRegister} method.</p> |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
328 |
* |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
329 |
* <p>If this method successfully registers an MBean, a notification |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
330 |
* is sent as described <a href="#notif">above</a>.</p> |
2 | 331 |
* |
332 |
* @param object The MBean to be registered as an MBean. |
|
333 |
* @param name The object name of the MBean. May be null. |
|
334 |
* |
|
335 |
* @return An <CODE>ObjectInstance</CODE>, containing the |
|
336 |
* <CODE>ObjectName</CODE> and the Java class name of the newly |
|
337 |
* registered MBean. If the contained <code>ObjectName</code> |
|
338 |
* is <code>n</code>, the contained Java class name is |
|
339 |
* <code>{@link #getMBeanInfo getMBeanInfo(n)}.getClassName()</code>. |
|
340 |
* |
|
341 |
* @exception InstanceAlreadyExistsException The MBean is already |
|
342 |
* under the control of the MBean server. |
|
343 |
* @exception MBeanRegistrationException The |
|
344 |
* <CODE>preRegister</CODE> (<CODE>MBeanRegistration</CODE> |
|
345 |
* interface) method of the MBean has thrown an exception. The |
|
346 |
* MBean will not be registered. |
|
1002
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
347 |
* @exception RuntimeMBeanException If the <CODE>postRegister</CODE> |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
348 |
* (<CODE>MBeanRegistration</CODE> interface) method of the MBean throws a |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
349 |
* <CODE>RuntimeException</CODE>, the <CODE>registerMBean<CODE> method will |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
350 |
* throw a <CODE>RuntimeMBeanException</CODE>, although the MBean |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
351 |
* registration succeeded. In such a case, the MBean will be actually |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
352 |
* registered even though the <CODE>registerMBean<CODE> method |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
353 |
* threw an exception. Note that <CODE>RuntimeMBeanException</CODE> can |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
354 |
* also be thrown by <CODE>preRegister</CODE>, in which case the MBean |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
355 |
* will not be registered. |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
356 |
* @exception RuntimeErrorException If the <CODE>postRegister</CODE> |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
357 |
* (<CODE>MBeanRegistration</CODE> interface) method of the MBean throws an |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
358 |
* <CODE>Error</CODE>, the <CODE>registerMBean<CODE> method will |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
359 |
* throw a <CODE>RuntimeErrorException</CODE>, although the MBean |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
360 |
* registration succeeded. In such a case, the MBean will be actually |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
361 |
* registered even though the <CODE>registerMBean<CODE> method |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
362 |
* threw an exception. Note that <CODE>RuntimeErrorException</CODE> can |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
363 |
* also be thrown by <CODE>preRegister</CODE>, in which case the MBean |
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
364 |
* will not be registered. |
2 | 365 |
* @exception NotCompliantMBeanException This object is not a JMX |
366 |
* compliant MBean |
|
367 |
* @exception RuntimeOperationsException Wraps a |
|
368 |
* <CODE>java.lang.IllegalArgumentException</CODE>: The object |
|
369 |
* passed in parameter is null or no object name is specified. |
|
1002
1e6a1b77f22a
6730926: Document that create/registerMBean can throw RuntimeMBeanException from postRegister
dfuchs
parents:
834
diff
changeset
|
370 |
* @see javax.management.MBeanRegistration |
2 | 371 |
*/ |
372 |
public ObjectInstance registerMBean(Object object, ObjectName name) |
|
373 |
throws InstanceAlreadyExistsException, MBeanRegistrationException, |
|
374 |
NotCompliantMBeanException; |
|
375 |
||
267
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
376 |
/** |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
377 |
* {@inheritDoc} |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
378 |
* |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
379 |
* <p>If this method successfully unregisters an MBean, a notification |
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
380 |
* is sent as described <a href="#notif">above</a>.</p> |
1015
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
381 |
* |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
382 |
* @throws RuntimeOperationsException {@inheritDoc} |
267
d436a8afbbd3
6649542: Document explicitly in registerMBean etc that MBeanServerNotification is emitted
emcmanus
parents:
2
diff
changeset
|
383 |
*/ |
2 | 384 |
public void unregisterMBean(ObjectName name) |
385 |
throws InstanceNotFoundException, MBeanRegistrationException; |
|
386 |
||
387 |
// doc comment inherited from MBeanServerConnection |
|
388 |
public ObjectInstance getObjectInstance(ObjectName name) |
|
389 |
throws InstanceNotFoundException; |
|
390 |
||
391 |
// doc comment inherited from MBeanServerConnection |
|
392 |
public Set<ObjectInstance> queryMBeans(ObjectName name, QueryExp query); |
|
393 |
||
394 |
// doc comment inherited from MBeanServerConnection |
|
395 |
public Set<ObjectName> queryNames(ObjectName name, QueryExp query); |
|
396 |
||
397 |
// doc comment inherited from MBeanServerConnection |
|
1015
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
398 |
/** |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
399 |
* @throws RuntimeOperationsException {@inheritDoc} |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
400 |
*/ |
2 | 401 |
public boolean isRegistered(ObjectName name); |
402 |
||
403 |
/** |
|
404 |
* Returns the number of MBeans registered in the MBean server. |
|
405 |
* |
|
406 |
* @return the number of registered MBeans, wrapped in an Integer. |
|
407 |
* If the caller's permissions are restricted, this number may |
|
408 |
* be greater than the number of MBeans the caller can access. |
|
409 |
*/ |
|
410 |
public Integer getMBeanCount(); |
|
411 |
||
412 |
// doc comment inherited from MBeanServerConnection |
|
1015
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
413 |
/** |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
414 |
* @throws RuntimeOperationsException {@inheritDoc} |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
415 |
*/ |
2 | 416 |
public Object getAttribute(ObjectName name, String attribute) |
417 |
throws MBeanException, AttributeNotFoundException, |
|
418 |
InstanceNotFoundException, ReflectionException; |
|
419 |
||
420 |
// doc comment inherited from MBeanServerConnection |
|
1015
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
421 |
/** |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
422 |
* @throws RuntimeOperationsException {@inheritDoc} |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
423 |
*/ |
2 | 424 |
public AttributeList getAttributes(ObjectName name, String[] attributes) |
425 |
throws InstanceNotFoundException, ReflectionException; |
|
426 |
||
427 |
// doc comment inherited from MBeanServerConnection |
|
1015
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
428 |
/** |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
429 |
* @throws RuntimeOperationsException {@inheritDoc} |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
430 |
*/ |
2 | 431 |
public void setAttribute(ObjectName name, Attribute attribute) |
432 |
throws InstanceNotFoundException, AttributeNotFoundException, |
|
433 |
InvalidAttributeValueException, MBeanException, |
|
434 |
ReflectionException; |
|
435 |
||
436 |
// doc comment inherited from MBeanServerConnection |
|
1015
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
437 |
/** |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
438 |
* @throws RuntimeOperationsException {@inheritDoc} |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
439 |
*/ |
2 | 440 |
public AttributeList setAttributes(ObjectName name, |
441 |
AttributeList attributes) |
|
442 |
throws InstanceNotFoundException, ReflectionException; |
|
443 |
||
444 |
// doc comment inherited from MBeanServerConnection |
|
445 |
public Object invoke(ObjectName name, String operationName, |
|
446 |
Object params[], String signature[]) |
|
447 |
throws InstanceNotFoundException, MBeanException, |
|
448 |
ReflectionException; |
|
449 |
||
450 |
// doc comment inherited from MBeanServerConnection |
|
451 |
public String getDefaultDomain(); |
|
452 |
||
453 |
// doc comment inherited from MBeanServerConnection |
|
454 |
public String[] getDomains(); |
|
455 |
||
1004
5ba8217eb504
5108776: Add reliable event handling to the JMX API
sjiang
parents:
1002
diff
changeset
|
456 |
// doc comment inherited from MBeanServerConnection, plus: |
5ba8217eb504
5108776: Add reliable event handling to the JMX API
sjiang
parents:
1002
diff
changeset
|
457 |
/** |
5ba8217eb504
5108776: Add reliable event handling to the JMX API
sjiang
parents:
1002
diff
changeset
|
458 |
* {@inheritDoc} |
5ba8217eb504
5108776: Add reliable event handling to the JMX API
sjiang
parents:
1002
diff
changeset
|
459 |
* If the source of the notification |
5ba8217eb504
5108776: Add reliable event handling to the JMX API
sjiang
parents:
1002
diff
changeset
|
460 |
* is a reference to an MBean object, the MBean server will replace it |
5ba8217eb504
5108776: Add reliable event handling to the JMX API
sjiang
parents:
1002
diff
changeset
|
461 |
* by that MBean's ObjectName. Otherwise the source is unchanged. |
5ba8217eb504
5108776: Add reliable event handling to the JMX API
sjiang
parents:
1002
diff
changeset
|
462 |
*/ |
2 | 463 |
public void addNotificationListener(ObjectName name, |
464 |
NotificationListener listener, |
|
465 |
NotificationFilter filter, |
|
466 |
Object handback) |
|
467 |
throws InstanceNotFoundException; |
|
468 |
||
1015
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
469 |
/** |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
470 |
* {@inheritDoc} |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
471 |
* @throws RuntimeOperationsException {@inheritDoc} |
98e761716380
6717257: MBeanServer doesn't describe RuntimeException for methods inherited from MBeanServerConnection
emcmanus
parents:
1004
diff
changeset
|
472 |
*/ |
2 | 473 |
public void addNotificationListener(ObjectName name, |
474 |
ObjectName listener, |
|
475 |
NotificationFilter filter, |
|
476 |
Object handback) |
|
477 |
throws InstanceNotFoundException; |
|
478 |
||
479 |
// doc comment inherited from MBeanServerConnection |
|
480 |
public void removeNotificationListener(ObjectName name, |
|
481 |
ObjectName listener) |
|
482 |
throws InstanceNotFoundException, ListenerNotFoundException; |
|
483 |
||
484 |
// doc comment inherited from MBeanServerConnection |
|
485 |
public void removeNotificationListener(ObjectName name, |
|
486 |
ObjectName listener, |
|
487 |
NotificationFilter filter, |
|
488 |
Object handback) |
|
489 |
throws InstanceNotFoundException, ListenerNotFoundException; |
|
490 |
||
491 |
// doc comment inherited from MBeanServerConnection |
|
492 |
public void removeNotificationListener(ObjectName name, |
|
493 |
NotificationListener listener) |
|
494 |
throws InstanceNotFoundException, ListenerNotFoundException; |
|
495 |
||
496 |
// doc comment inherited from MBeanServerConnection |
|
497 |
public void removeNotificationListener(ObjectName name, |
|
498 |
NotificationListener listener, |
|
499 |
NotificationFilter filter, |
|
500 |
Object handback) |
|
501 |
throws InstanceNotFoundException, ListenerNotFoundException; |
|
502 |
||
503 |
// doc comment inherited from MBeanServerConnection |
|
504 |
public MBeanInfo getMBeanInfo(ObjectName name) |
|
505 |
throws InstanceNotFoundException, IntrospectionException, |
|
506 |
ReflectionException; |
|
507 |
||
508 |
||
509 |
// doc comment inherited from MBeanServerConnection |
|
510 |
public boolean isInstanceOf(ObjectName name, String className) |
|
511 |
throws InstanceNotFoundException; |
|
512 |
||
513 |
/** |
|
514 |
* <p>Instantiates an object using the list of all class loaders |
|
515 |
* registered in the MBean server's {@link |
|
516 |
* javax.management.loading.ClassLoaderRepository Class Loader |
|
517 |
* Repository}. The object's class should have a public |
|
518 |
* constructor. This method returns a reference to the newly |
|
519 |
* created object. The newly created object is not registered in |
|
520 |
* the MBean server.</p> |
|
521 |
* |
|
522 |
* <p>This method is equivalent to {@link |
|
523 |
* #instantiate(String,Object[],String[]) |
|
524 |
* instantiate(className, (Object[]) null, (String[]) null)}.</p> |
|
525 |
* |
|
526 |
* @param className The class name of the object to be instantiated. |
|
527 |
* |
|
528 |
* @return The newly instantiated object. |
|
529 |
* |
|
530 |
* @exception ReflectionException Wraps a |
|
531 |
* <CODE>java.lang.ClassNotFoundException</CODE> or the |
|
532 |
* <CODE>java.lang.Exception</CODE> that occurred when trying to |
|
533 |
* invoke the object's constructor. |
|
534 |
* @exception MBeanException The constructor of the object has |
|
535 |
* thrown an exception |
|
536 |
* @exception RuntimeOperationsException Wraps a |
|
537 |
* <CODE>java.lang.IllegalArgumentException</CODE>: The className |
|
538 |
* passed in parameter is null. |
|
539 |
*/ |
|
540 |
public Object instantiate(String className) |
|
541 |
throws ReflectionException, MBeanException; |
|
542 |
||
543 |
||
544 |
/** |
|
545 |
* <p>Instantiates an object using the class Loader specified by its |
|
546 |
* <CODE>ObjectName</CODE>. If the loader name is null, the |
|
547 |
* ClassLoader that loaded the MBean Server will be used. The |
|
548 |
* object's class should have a public constructor. This method |
|
549 |
* returns a reference to the newly created object. The newly |
|
550 |
* created object is not registered in the MBean server.</p> |
|
551 |
* |
|
552 |
* <p>This method is equivalent to {@link |
|
553 |
* #instantiate(String,ObjectName,Object[],String[]) |
|
554 |
* instantiate(className, loaderName, (Object[]) null, (String[]) |
|
555 |
* null)}.</p> |
|
556 |
* |
|
557 |
* @param className The class name of the MBean to be instantiated. |
|
558 |
* @param loaderName The object name of the class loader to be used. |
|
559 |
* |
|
560 |
* @return The newly instantiated object. |
|
561 |
* |
|
562 |
* @exception ReflectionException Wraps a |
|
563 |
* <CODE>java.lang.ClassNotFoundException</CODE> or the |
|
564 |
* <CODE>java.lang.Exception</CODE> that occurred when trying to |
|
565 |
* invoke the object's constructor. |
|
566 |
* @exception MBeanException The constructor of the object has |
|
567 |
* thrown an exception. |
|
568 |
* @exception InstanceNotFoundException The specified class loader |
|
569 |
* is not registered in the MBeanServer. |
|
570 |
* @exception RuntimeOperationsException Wraps a |
|
571 |
* <CODE>java.lang.IllegalArgumentException</CODE>: The className |
|
572 |
* passed in parameter is null. |
|
573 |
*/ |
|
574 |
public Object instantiate(String className, ObjectName loaderName) |
|
575 |
throws ReflectionException, MBeanException, |
|
576 |
InstanceNotFoundException; |
|
577 |
||
578 |
/** |
|
579 |
* <p>Instantiates an object using the list of all class loaders |
|
580 |
* registered in the MBean server {@link |
|
581 |
* javax.management.loading.ClassLoaderRepository Class Loader |
|
582 |
* Repository}. The object's class should have a public |
|
583 |
* constructor. The call returns a reference to the newly created |
|
584 |
* object. The newly created object is not registered in the |
|
585 |
* MBean server.</p> |
|
586 |
* |
|
587 |
* @param className The class name of the object to be instantiated. |
|
588 |
* @param params An array containing the parameters of the |
|
589 |
* constructor to be invoked. |
|
590 |
* @param signature An array containing the signature of the |
|
591 |
* constructor to be invoked. |
|
592 |
* |
|
593 |
* @return The newly instantiated object. |
|
594 |
* |
|
595 |
* @exception ReflectionException Wraps a |
|
596 |
* <CODE>java.lang.ClassNotFoundException</CODE> or the |
|
597 |
* <CODE>java.lang.Exception</CODE> that occurred when trying to |
|
598 |
* invoke the object's constructor. |
|
599 |
* @exception MBeanException The constructor of the object has |
|
600 |
* thrown an exception |
|
601 |
* @exception RuntimeOperationsException Wraps a |
|
602 |
* <CODE>java.lang.IllegalArgumentException</CODE>: The className |
|
603 |
* passed in parameter is null. |
|
604 |
*/ |
|
605 |
public Object instantiate(String className, Object params[], |
|
606 |
String signature[]) |
|
607 |
throws ReflectionException, MBeanException; |
|
608 |
||
609 |
/** |
|
610 |
* <p>Instantiates an object. The class loader to be used is |
|
611 |
* identified by its object name. If the object name of the loader |
|
612 |
* is null, the ClassLoader that loaded the MBean server will be |
|
613 |
* used. The object's class should have a public constructor. |
|
614 |
* The call returns a reference to the newly created object. The |
|
615 |
* newly created object is not registered in the MBean server.</p> |
|
616 |
* |
|
617 |
* @param className The class name of the object to be instantiated. |
|
618 |
* @param params An array containing the parameters of the |
|
619 |
* constructor to be invoked. |
|
620 |
* @param signature An array containing the signature of the |
|
621 |
* constructor to be invoked. |
|
622 |
* @param loaderName The object name of the class loader to be used. |
|
623 |
* |
|
624 |
* @return The newly instantiated object. |
|
625 |
* |
|
626 |
* @exception ReflectionException Wraps a <CODE>java.lang.ClassNotFoundException</CODE> or the <CODE>java.lang.Exception</CODE> that |
|
627 |
* occurred when trying to invoke the object's constructor. |
|
628 |
* @exception MBeanException The constructor of the object has |
|
629 |
* thrown an exception |
|
630 |
* @exception InstanceNotFoundException The specified class loader |
|
631 |
* is not registered in the MBean server. |
|
632 |
* @exception RuntimeOperationsException Wraps a |
|
633 |
* <CODE>java.lang.IllegalArgumentException</CODE>: The className |
|
634 |
* passed in parameter is null. |
|
635 |
*/ |
|
636 |
public Object instantiate(String className, ObjectName loaderName, |
|
637 |
Object params[], String signature[]) |
|
638 |
throws ReflectionException, MBeanException, |
|
639 |
InstanceNotFoundException; |
|
640 |
||
641 |
/** |
|
642 |
* <p>De-serializes a byte array in the context of the class loader |
|
643 |
* of an MBean.</p> |
|
644 |
* |
|
645 |
* @param name The name of the MBean whose class loader should be |
|
646 |
* used for the de-serialization. |
|
647 |
* @param data The byte array to be de-sererialized. |
|
648 |
* |
|
649 |
* @return The de-serialized object stream. |
|
650 |
* |
|
651 |
* @exception InstanceNotFoundException The MBean specified is not |
|
652 |
* found. |
|
653 |
* @exception OperationsException Any of the usual Input/Output |
|
654 |
* related exceptions. |
|
655 |
* |
|
656 |
* @deprecated Use {@link #getClassLoaderFor getClassLoaderFor} to |
|
657 |
* obtain the appropriate class loader for deserialization. |
|
658 |
*/ |
|
659 |
@Deprecated |
|
660 |
public ObjectInputStream deserialize(ObjectName name, byte[] data) |
|
661 |
throws InstanceNotFoundException, OperationsException; |
|
662 |
||
663 |
||
664 |
/** |
|
665 |
* <p>De-serializes a byte array in the context of a given MBean |
|
666 |
* class loader. The class loader is found by loading the class |
|
667 |
* <code>className</code> through the {@link |
|
668 |
* javax.management.loading.ClassLoaderRepository Class Loader |
|
669 |
* Repository}. The resultant class's class loader is the one to |
|
670 |
* use. |
|
671 |
* |
|
672 |
* @param className The name of the class whose class loader should be |
|
673 |
* used for the de-serialization. |
|
674 |
* @param data The byte array to be de-sererialized. |
|
675 |
* |
|
676 |
* @return The de-serialized object stream. |
|
677 |
* |
|
678 |
* @exception OperationsException Any of the usual Input/Output |
|
679 |
* related exceptions. |
|
680 |
* @exception ReflectionException The specified class could not be |
|
681 |
* loaded by the class loader repository |
|
682 |
* |
|
683 |
* @deprecated Use {@link #getClassLoaderRepository} to obtain the |
|
684 |
* class loader repository and use it to deserialize. |
|
685 |
*/ |
|
686 |
@Deprecated |
|
687 |
public ObjectInputStream deserialize(String className, byte[] data) |
|
688 |
throws OperationsException, ReflectionException; |
|
689 |
||
690 |
||
691 |
/** |
|
692 |
* <p>De-serializes a byte array in the context of a given MBean |
|
693 |
* class loader. The class loader is the one that loaded the |
|
694 |
* class with name "className". The name of the class loader to |
|
695 |
* be used for loading the specified class is specified. If null, |
|
696 |
* the MBean Server's class loader will be used.</p> |
|
697 |
* |
|
698 |
* @param className The name of the class whose class loader should be |
|
699 |
* used for the de-serialization. |
|
700 |
* @param data The byte array to be de-sererialized. |
|
701 |
* @param loaderName The name of the class loader to be used for |
|
702 |
* loading the specified class. If null, the MBean Server's class |
|
703 |
* loader will be used. |
|
704 |
* |
|
705 |
* @return The de-serialized object stream. |
|
706 |
* |
|
707 |
* @exception InstanceNotFoundException The specified class loader |
|
708 |
* MBean is not found. |
|
709 |
* @exception OperationsException Any of the usual Input/Output |
|
710 |
* related exceptions. |
|
711 |
* @exception ReflectionException The specified class could not be |
|
712 |
* loaded by the specified class loader. |
|
713 |
* |
|
714 |
* @deprecated Use {@link #getClassLoader getClassLoader} to obtain |
|
715 |
* the class loader for deserialization. |
|
716 |
*/ |
|
717 |
@Deprecated |
|
718 |
public ObjectInputStream deserialize(String className, |
|
719 |
ObjectName loaderName, |
|
720 |
byte[] data) |
|
721 |
throws InstanceNotFoundException, OperationsException, |
|
722 |
ReflectionException; |
|
723 |
||
724 |
/** |
|
833
bfa2bef7517c
6323980: Annotations to simplify MBean development
emcmanus
parents:
267
diff
changeset
|
725 |
* <p>Return the {@link java.lang.ClassLoader} that was used for loading |
bfa2bef7517c
6323980: Annotations to simplify MBean development
emcmanus
parents:
267
diff
changeset
|
726 |
* the class of the named MBean. If the MBean implements the {@link |
bfa2bef7517c
6323980: Annotations to simplify MBean development
emcmanus
parents:
267
diff
changeset
|
727 |
* DynamicWrapperMBean} interface, then the returned value is the |
bfa2bef7517c
6323980: Annotations to simplify MBean development
emcmanus
parents:
267
diff
changeset
|
728 |
* result of the {@link DynamicWrapperMBean#getWrappedClassLoader()} |
bfa2bef7517c
6323980: Annotations to simplify MBean development
emcmanus
parents:
267
diff
changeset
|
729 |
* method.</p> |
2 | 730 |
* |
731 |
* @param mbeanName The ObjectName of the MBean. |
|
732 |
* |
|
733 |
* @return The ClassLoader used for that MBean. If <var>l</var> |
|
833
bfa2bef7517c
6323980: Annotations to simplify MBean development
emcmanus
parents:
267
diff
changeset
|
734 |
* is the value specified by the rules above, and <var>r</var> is the |
2 | 735 |
* returned value, then either: |
736 |
* |
|
737 |
* <ul> |
|
738 |
* <li><var>r</var> is identical to <var>l</var>; or |
|
739 |
* <li>the result of <var>r</var>{@link |
|
740 |
* ClassLoader#loadClass(String) .loadClass(<var>s</var>)} is the |
|
741 |
* same as <var>l</var>{@link ClassLoader#loadClass(String) |
|
742 |
* .loadClass(<var>s</var>)} for any string <var>s</var>. |
|
743 |
* </ul> |
|
744 |
* |
|
745 |
* What this means is that the ClassLoader may be wrapped in |
|
746 |
* another ClassLoader for security or other reasons. |
|
747 |
* |
|
748 |
* @exception InstanceNotFoundException if the named MBean is not found. |
|
749 |
* |
|
750 |
*/ |
|
751 |
public ClassLoader getClassLoaderFor(ObjectName mbeanName) |
|
752 |
throws InstanceNotFoundException; |
|
753 |
||
754 |
/** |
|
755 |
* <p>Return the named {@link java.lang.ClassLoader}.</p> |
|
756 |
* |
|
757 |
* @param loaderName The ObjectName of the ClassLoader. May be |
|
758 |
* null, in which case the MBean server's own ClassLoader is |
|
759 |
* returned. |
|
760 |
* |
|
761 |
* @return The named ClassLoader. If <var>l</var> is the actual |
|
762 |
* ClassLoader with that name, and <var>r</var> is the returned |
|
763 |
* value, then either: |
|
764 |
* |
|
765 |
* <ul> |
|
766 |
* <li><var>r</var> is identical to <var>l</var>; or |
|
767 |
* <li>the result of <var>r</var>{@link |
|
768 |
* ClassLoader#loadClass(String) .loadClass(<var>s</var>)} is the |
|
769 |
* same as <var>l</var>{@link ClassLoader#loadClass(String) |
|
770 |
* .loadClass(<var>s</var>)} for any string <var>s</var>. |
|
771 |
* </ul> |
|
772 |
* |
|
773 |
* What this means is that the ClassLoader may be wrapped in |
|
774 |
* another ClassLoader for security or other reasons. |
|
775 |
* |
|
776 |
* @exception InstanceNotFoundException if the named ClassLoader is |
|
777 |
* not found. |
|
778 |
* |
|
779 |
*/ |
|
780 |
public ClassLoader getClassLoader(ObjectName loaderName) |
|
781 |
throws InstanceNotFoundException; |
|
782 |
||
783 |
/** |
|
784 |
* <p>Return the ClassLoaderRepository for this MBeanServer. |
|
785 |
* @return The ClassLoaderRepository for this MBeanServer. |
|
786 |
* |
|
787 |
*/ |
|
788 |
public ClassLoaderRepository getClassLoaderRepository(); |
|
789 |
} |