org.jboss.as.arquillian.container.MBeanProxy Maven / Gradle / Ivy
/*
* 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);
}
}