325N/A/*
325N/A * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
325N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
325N/A *
325N/A * This code is free software; you can redistribute it and/or modify it
325N/A * under the terms of the GNU General Public License version 2 only, as
325N/A * published by the Free Software Foundation. Oracle designates this
325N/A * particular file as subject to the "Classpath" exception as provided
325N/A * by Oracle in the LICENSE file that accompanied this code.
325N/A *
325N/A * This code is distributed in the hope that it will be useful, but WITHOUT
325N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
325N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
325N/A * version 2 for more details (a copy is included in the LICENSE file that
325N/A * accompanied this code).
325N/A *
325N/A * You should have received a copy of the GNU General Public License version
325N/A * 2 along with this work; if not, write to the Free Software Foundation,
325N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
325N/A *
325N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
325N/A * or visit www.oracle.com if you need additional information or have any
325N/A * questions.
325N/A */
325N/A
325N/A
325N/Apackage com.sun.org.glassfish.external.amx;
325N/A
325N/Aimport javax.management.MBeanServerConnection;
325N/Aimport javax.management.ObjectName;
325N/A
325N/A/**
325N/A Small utilities for AMXBooter and related.
325N/A */
325N/A@com.sun.org.glassfish.external.arc.Taxonomy(stability = com.sun.org.glassfish.external.arc.Stability.UNCOMMITTED)
325N/Apublic final class AMXUtil
325N/A{
325N/A private AMXUtil() {}
325N/A
325N/A /**
325N/A Make a new ObjectName (unchecked exception).
325N/A */
325N/A public static ObjectName newObjectName(final String s)
325N/A {
325N/A try
325N/A {
325N/A return new ObjectName( s );
325N/A }
325N/A catch( final Exception e )
325N/A {
325N/A throw new RuntimeException("bad ObjectName", e);
325N/A }
325N/A }
325N/A
325N/A /**
325N/A Make a new ObjectName (unchecked exception).
325N/A @param domain
325N/A @param props
325N/A */
325N/A public static ObjectName newObjectName(
325N/A final String domain,
325N/A final String props)
325N/A {
325N/A return newObjectName(domain + ":" + props);
325N/A }
325N/A
325N/A /**
325N/A Get the ObjectName of the MBeanServerDelegateObjectName.
325N/A */
325N/A public static ObjectName getMBeanServerDelegateObjectName()
325N/A {
325N/A return newObjectName( "JMImplementation:type=MBeanServerDelegate" );
325N/A }
325N/A
325N/A public static String prop(final String key, final String value)
325N/A {
325N/A return key + "=" + value;
325N/A }
325N/A}