Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/CustomMBeanServerBuilder.java
40948 views
/*1* Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package nsk.monitoring.share;2425import javax.management.*;2627/**28* The <code>CustomMBeanServerBuilder</code> class represents a builder that29* creates {@link CustomMBeanServer <tt>CustomMBeanServer</tt>} which is30* implemeted by NSK J2SE SQE Team to test Monitoring and Management API31* (JSR-174).32*33* <p>To instantiate <tt>CustomMBeanServer</tt>, the34* <b>javax.management.builder.initial</b> system property must contain35* <code>"nsk.monitoring.share.CustomMBeanServerBuilder"</code> string.36*/37public class CustomMBeanServerBuilder extends MBeanServerBuilder {3839// NSK default domain40private static final String DEFAULT_DOMAIN = "nsk.defaultDomain";4142/**43* Public default constructor.44*/45public CustomMBeanServerBuilder() {46super();47}4849/**50* Creates a new <code>CustomMBeanServer</code> object.51*52* @param defaultDomain Default domain of the new MBean server.53* @param outer A pointer to the MBean server object that must be passed54* to the MBeans when invoking their55* {@link javax.management.MBeanRegistration56* <code>MBeanRegistration</code>} interface.57* @param delegate A pointer to the MBeanServerDelegate associated with58* the new MBeanServer. The new MBeanServer must register this59* MBean in its MBean repository.60*61* @return A new <code>CustomMBeanServer</code> instance.62*63* @see javax.management.MBeanServerBuilder#newMBeanServer64*/65public MBeanServer newMBeanServer(String defaultDomain,66MBeanServer outer,67MBeanServerDelegate delegate) {68if (defaultDomain == null || defaultDomain.length() == 0)69return new CustomMBeanServer(DEFAULT_DOMAIN);70else71return new CustomMBeanServer(defaultDomain);72}7374/**75* Creates an instance of the {@link javax.management.MBeanServerDelegate76* <code>MBeanServerDelegate</code>} class.77*78* @return A new <code>MBeanServerDelegate</code> object.79*80* @see javax.management.MBeanServerBuilder#newMBeanServerDelegate81*/82public MBeanServerDelegate newMBeanServerDelegate() {83return new MBeanServerDelegate();84}85}868788