1 22 package org.jboss.mx.mxbean; 23 24 import java.lang.reflect.Proxy ; 25 26 import javax.management.DynamicMBean ; 27 import javax.management.MBeanServerConnection ; 28 import javax.management.ObjectName ; 29 30 36 public class MXBeanFactory 37 { 38 47 public static <T> T makeProxy(MBeanServerConnection mbeanServerConnection, ObjectName objectName, Class <T> mxbeanInterface) 48 { 49 MXBeanInvocationHandler handler = new MXBeanInvocationHandler(mbeanServerConnection, mxbeanInterface, objectName); 50 Object object = Proxy.newProxyInstance(mxbeanInterface.getClassLoader(), new Class [] { mxbeanInterface }, handler); 51 return mxbeanInterface.cast(object); 52 } 53 54 60 public static DynamicMBean newMXBean(Object resource) 61 { 62 return MXBeanUtils.createMXBean(resource, null); 63 } 64 65 73 public static <T> DynamicMBean newMXBean(T resource, Class <T> mxbeanInterface) 74 { 75 return MXBeanUtils.createMXBean(resource, mxbeanInterface); 76 } 77 } 78 | Popular Tags |