0N/A/*
2362N/A * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage com.sun.jmx.mbeanserver;
0N/A
0N/Aimport javax.management.MBeanServer;
0N/Aimport javax.management.MBeanServerDelegate;
0N/Aimport javax.management.MBeanServerBuilder;
0N/A
0N/A/**
0N/A * This class represents a builder that creates
0N/A * {@link javax.management.MBeanServer} implementations.
0N/A * The JMX {@link javax.management.MBeanServerFactory} allows
0N/A * for applications to provide their custom MBeanServer
0N/A * implementation. This class is not used when the whole Sun Reference JMX
0N/A * Implementation is used. However it may be used to substitute Sun
0N/A * MBeanServer implementation to another JMX implementation.
0N/A * <p>
0N/A * Contrarily to the default {@link javax.management.MBeanServerBuilder
0N/A * javax.management.MBeanServerBuilder} this MBeanServerBuilder returns
0N/A * MBeanServers on which
0N/A * {@link com.sun.jmx.interceptor.MBeanServerInterceptor}s are enabled.
0N/A *
0N/A * @since 1.5
0N/A */
0N/Apublic class JmxMBeanServerBuilder extends MBeanServerBuilder {
0N/A /**
0N/A * This method creates a new MBeanServerDelegate for a new MBeanServer.
0N/A * When creating a new MBeanServer the
0N/A * {@link javax.management.MBeanServerFactory} first calls this method
0N/A * in order to create a new MBeanServerDelegate.
0N/A * <br>Then it calls
0N/A * <code>newMBeanServer(defaultDomain,outer,delegate)</code>
0N/A * passing the <var>delegate</var> that should be used by the MBeanServer
0N/A * implementation.
0N/A * <p>Note that the passed <var>delegate</var> might not be directly the
0N/A * MBeanServerDelegate that was returned by this method. It could
0N/A * be, for instance, a new object wrapping the previously
0N/A * returned object.
0N/A *
0N/A * @return A new {@link javax.management.MBeanServerDelegate}.
0N/A **/
0N/A public MBeanServerDelegate newMBeanServerDelegate() {
0N/A return JmxMBeanServer.newMBeanServerDelegate();
0N/A }
0N/A
0N/A /**
0N/A * This method creates a new MBeanServer implementation object.
0N/A * When creating a new MBeanServer the
0N/A * {@link javax.management.MBeanServerFactory} first calls
0N/A * <code>newMBeanServerDelegate()</code> in order to obtain a new
0N/A * {@link javax.management.MBeanServerDelegate} for the new
0N/A * MBeanServer. Then it calls
0N/A * <code>newMBeanServer(defaultDomain,outer,delegate)</code>
0N/A * passing the <var>delegate</var> that should be used by the
0N/A * MBeanServer implementation.
0N/A * <p>Note that the passed <var>delegate</var> might not be directly the
0N/A * MBeanServerDelegate that was returned by this implementation. It could
0N/A * be, for instance, a new object wrapping the previously
0N/A * returned delegate.
0N/A * <p>The <var>outer</var> parameter is a pointer to the MBeanServer that
0N/A * should be passed to the {@link javax.management.MBeanRegistration}
0N/A * interface when registering MBeans inside the MBeanServer.
0N/A * If <var>outer</var> is <code>null</code>, then the MBeanServer
0N/A * implementation is free to use its own <code>this</code> pointer when
0N/A * invoking the {@link javax.management.MBeanRegistration} interface.
0N/A * <p>This makes it possible for a MBeanServer implementation to wrap
0N/A * another MBeanServer implementation, in order to implement, e.g,
0N/A * security checks, or to prevent access to the actual MBeanServer
0N/A * implementation by returning a pointer to a wrapping object.
0N/A * <p>
0N/A * This MBeanServerBuilder makes it possible to create MBeanServer
0N/A * which support {@link com.sun.jmx.interceptor.MBeanServerInterceptor}s.
0N/A *
0N/A * @param defaultDomain Default domain of the new MBeanServer.
0N/A * @param outer A pointer to the MBeanServer object that must be
0N/A * passed to the MBeans when invoking their
0N/A * {@link javax.management.MBeanRegistration} interface.
0N/A * @param delegate A pointer to the MBeanServerDelegate associated
0N/A * with the new MBeanServer. The new MBeanServer must register
0N/A * this MBean in its MBean repository.
0N/A *
0N/A * @return A new private implementation of an MBeanServer.
0N/A **/
0N/A public MBeanServer newMBeanServer(String defaultDomain,
0N/A MBeanServer outer,
0N/A MBeanServerDelegate delegate) {
0N/A return JmxMBeanServer.newMBeanServer(defaultDomain,outer,delegate,
0N/A true);
0N/A }
0N/A
0N/A}