Java MBean queryConnectionBy(MBeanServerConnection connection, ObjectName objectName)

Here you can find the source of queryConnectionBy(MBeanServerConnection connection, ObjectName objectName)

Description

query Connection By

License

Open Source License

Declaration

public static Set<ObjectInstance> queryConnectionBy(MBeanServerConnection connection, ObjectName objectName)
            throws Exception 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Hashtable;

import java.util.Set;
import javax.management.MBeanServerConnection;
import javax.management.ObjectInstance;
import javax.management.ObjectName;

public class Main {
    public static Set<ObjectInstance> queryConnectionBy(MBeanServerConnection connection, ObjectName objectName)
            throws Exception {
        return connection.queryMBeans(objectName, null);
    }/*from www. ja v a 2s . co  m*/

    public static Set<ObjectInstance> queryConnectionBy(MBeanServerConnection connection, String domain,
            String name, String type, String scope) throws Exception {
        return queryConnectionBy(connection, getObjectName(domain, name, type, scope));
    }

    public static ObjectName getObjectName(String domain, String name, String type, String scope) throws Exception {
        Hashtable<String, String> map = new Hashtable<String, String>();
        if (name != null)
            map.put("name", name);
        if (type != null)
            map.put("type", type);
        if (scope != null)
            map.put("scope", scope);
        return ObjectName.getInstance(domain, map);
    }
}

Related

  1. objectNameFor(Logger logger, String mbeanName)
  2. onameForBean(final Object mbean, final String name)
  3. operationEquals(MBeanOperationInfo one, MBeanOperationInfo two)
  4. paramEquals(MBeanParameterInfo o1, MBeanParameterInfo o2)
  5. queryAndGetAttribute(MBeanServerConnection connection, String domain, String name, String type, String scope, String attribute)
  6. readAttribute(MBeanServer mbeanServer, String mbeanName, String attributeName)
  7. registerMBean(MBeanServer mbs, Object object, ObjectName name, boolean unreg)
  8. registerMBean(MBeanServer server, String agentName, Map attrs, Object mbeanObject)
  9. registerMBean(Object bean, MBeanServer mBeanServer, ObjectName objectName)