KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jmx > mbeanserver > JmxMBeanServerBuilder


1 /*
2  * @(#)JmxMBeanServerBuilder.java 1.17 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package com.sun.jmx.mbeanserver;
9
10 import javax.management.MBeanServer JavaDoc;
11 import javax.management.MBeanServerDelegate JavaDoc;
12 import javax.management.MBeanServerBuilder JavaDoc;
13
14 /**
15  * This class represents a builder that creates
16  * {@link javax.management.MBeanServer} implementations.
17  * The JMX {@link javax.management.MBeanServerFactory} allows
18  * for applications to provide their custom MBeanServer
19  * implementation. This class is not used when the whole Sun Reference JMX
20  * Implementation is used. However it may be used to substitute Sun
21  * MBeanServer implementation to another JMX implementation.
22  * <p>
23  * Contrarily to the default {@link javax.management.MBeanServerBuilder
24  * javax.management.MBeanServerBuilder} this MBeanServerBuilder returns
25  * MBeanServers on which
26  * {@link com.sun.jmx.interceptor.MBeanServerInterceptor}s are enabled.
27  *
28  * @since 1.5
29  * @since.unbundled JMX RI 1.2
30  */

31 public class JmxMBeanServerBuilder extends MBeanServerBuilder JavaDoc {
32     /**
33      * This method creates a new MBeanServerDelegate for a new MBeanServer.
34      * When creating a new MBeanServer the
35      * {@link javax.management.MBeanServerFactory} first calls this method
36      * in order to create a new MBeanServerDelegate.
37      * <br>Then it calls
38      * <code>newMBeanServer(defaultDomain,outer,delegate)</code>
39      * passing the <var>delegate</var> that should be used by the MBeanServer
40      * implementation.
41      * <p>Note that the passed <var>delegate</var> might not be directly the
42      * MBeanServerDelegate that was returned by this method. It could
43      * be, for instance, a new object wrapping the previously
44      * returned object.
45      *
46      * @return A new {@link javax.management.MBeanServerDelegate}.
47      **/

48     public MBeanServerDelegate JavaDoc newMBeanServerDelegate() {
49     return JmxMBeanServer.newMBeanServerDelegate();
50     }
51
52     /**
53      * This method creates a new MBeanServer implementation object.
54      * When creating a new MBeanServer the
55      * {@link javax.management.MBeanServerFactory} first calls
56      * <code>newMBeanServerDelegate()</code> in order to obtain a new
57      * {@link javax.management.MBeanServerDelegate} for the new
58      * MBeanServer. Then it calls
59      * <code>newMBeanServer(defaultDomain,outer,delegate)</code>
60      * passing the <var>delegate</var> that should be used by the
61      * MBeanServer implementation.
62      * <p>Note that the passed <var>delegate</var> might not be directly the
63      * MBeanServerDelegate that was returned by this implementation. It could
64      * be, for instance, a new object wrapping the previously
65      * returned delegate.
66      * <p>The <var>outer</var> parameter is a pointer to the MBeanServer that
67      * should be passed to the {@link javax.management.MBeanRegistration}
68      * interface when registering MBeans inside the MBeanServer.
69      * If <var>outer</var> is <code>null</code>, then the MBeanServer
70      * implementation is free to use its own <code>this</code> pointer when
71      * invoking the {@link javax.management.MBeanRegistration} interface.
72      * <p>This makes it possible for a MBeanServer implementation to wrap
73      * another MBeanServer implementation, in order to implement, e.g,
74      * security checks, or to prevent access to the actual MBeanServer
75      * implementation by returning a pointer to a wrapping object.
76      * <p>
77      * This MBeanServerBuilder makes it possible to create MBeanServer
78      * which support {@link com.sun.jmx.interceptor.MBeanServerInterceptor}s.
79      *
80      * @param defaultDomain Default domain of the new MBeanServer.
81      * @param outer A pointer to the MBeanServer object that must be
82      * passed to the MBeans when invoking their
83      * {@link javax.management.MBeanRegistration} interface.
84      * @param delegate A pointer to the MBeanServerDelegate associated
85      * with the new MBeanServer. The new MBeanServer must register
86      * this MBean in its MBean repository.
87      *
88      * @return A new private implementation of an MBeanServer.
89      **/

90     public MBeanServer JavaDoc newMBeanServer(String JavaDoc defaultDomain,
91                       MBeanServer JavaDoc outer,
92                       MBeanServerDelegate JavaDoc delegate) {
93     return JmxMBeanServer.newMBeanServer(defaultDomain,outer,delegate,
94                          true);
95     }
96
97 }
98
Popular Tags