All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.as.arquillian.container.MBeanProxy Maven / Gradle / Ivy

There is a newer version: 5.1.0.Beta6
Show newest version
/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */
package org.jboss.as.arquillian.container;

import javax.management.MBeanServerConnection;
import javax.management.MBeanServerInvocationHandler;
import javax.management.MalformedObjectNameException;
import javax.management.ObjectName;

/**
 * A simple MBeanProxy
 *
 * @author [email protected]
 * @since 24-Feb-2009
 */
public class MBeanProxy {

    public static  T get(MBeanServerConnection server, String name, Class interf) {
        ObjectName oname;
        try {
            oname = ObjectName.getInstance(name);
        } catch (MalformedObjectNameException ex) {
            throw new IllegalArgumentException("Invalid object name: " + name);
        }
        return (T) MBeanProxy.get(server, oname, interf);
    }

    public static  T get(MBeanServerConnection server, ObjectName name, Class interf) {
        return (T) MBeanServerInvocationHandler.newProxyInstance(server, name, interf, false);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy