Java MBean onameForBean(final Object mbean, final String name)

Here you can find the source of onameForBean(final Object mbean, final String name)

Description

oname For Bean

License

Apache License

Declaration

public static ObjectName onameForBean(final Object mbean, final String name)
            throws MalformedObjectNameException 

Method Source Code

//package com.java2s;
/*/* w w  w .ja  v a 2s. c  o m*/
 * Copyright (C) 2011 ELASTICSCRIPT.ORG
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 *
 *
 *          _           _   _                    _       _
 *         | |         | | (_)                  (_)     | |
 *      ___| | __ _ ___| |_ _  ___ ___  ___ _ __ _ _ __ | |_
 *     / _ \ |/ _` / __| __| |/ __/ __|/ __| '__| | '_ \| __|
 * ----  __/ | (_| \__ \ |_| | (__\__ \ (__| |  | | |_) | |_ ----
 *     \___|_|\__,_|___/\__|_|\___|___/\___|_|  |_| .__/ \__|
 *                                                | |
 *                                                |_|
 */

import java.util.Hashtable;

import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;

public class Main {
    public static ObjectName onameForBean(final Object mbean, final String name)
            throws MalformedObjectNameException {
        @SuppressWarnings("UseOfObsoleteCollectionType")
        Hashtable<String, String> ht = new Hashtable<String, String>();
        Class klass = mbean.getClass();

        ht.put("class", klass.getSimpleName());
        ht.put("name", name);
        return new ObjectName(klass.getPackage().getName(), ht);
    }
}

Related

  1. makeSignatureString(MBeanParameterInfo[] info)
  2. matchType(MBeanNotificationInfo aInfo, String aMatch)
  3. mBeanAttributes2String(MBeanAttributeInfo[] attributeInfoArray)
  4. newMBeanProxy(final MBeanServerConnection conn, final ObjectName objectName, final Class interfaceClass)
  5. objectNameFor(Logger logger, String mbeanName)
  6. operationEquals(MBeanOperationInfo one, MBeanOperationInfo two)
  7. paramEquals(MBeanParameterInfo o1, MBeanParameterInfo o2)
  8. queryAndGetAttribute(MBeanServerConnection connection, String domain, String name, String type, String scope, String attribute)
  9. queryConnectionBy(MBeanServerConnection connection, ObjectName objectName)