1 10 package org.exoplatform.container.jmx; 11 12 import java.lang.reflect.Method ; 13 import java.lang.reflect.Modifier ; 14 import java.util.ArrayList ; 15 import java.util.Collection ; 16 import javax.management.MBeanAttributeInfo ; 17 import javax.management.MBeanOperationInfo ; 18 import mx4j.AbstractDynamicMBean; 19 20 24 public class ExoContainerMBean extends AbstractDynamicMBean { 25 26 public ExoContainerMBean(Object componentInstance) { 27 setResource(componentInstance); 28 } 29 30 31 protected String getMBeanDescription() { 32 return "Dynamic mbean wrapper for instance : " + getResource().toString(); 33 } 34 35 protected MBeanAttributeInfo [] createMBeanAttributeInfo() { 36 return super.createMBeanAttributeInfo(); 37 } 38 39 protected MBeanOperationInfo [] createMBeanOperationInfo() { 40 Method [] methodArray = getResource().getClass().getDeclaredMethods(); 41 Collection cToReturn = new ArrayList (); 42 for (int i = 0; i < methodArray.length; i++) { 43 Method method = methodArray[i]; 44 if(Modifier.isPublic(method.getModifiers())) { 45 MBeanOperationInfo operationInfo = new MBeanOperationInfo (method.getName(), method) ; 46 cToReturn.add(operationInfo ); 47 } 48 } 49 return (MBeanOperationInfo []) cToReturn.toArray(new MBeanOperationInfo [cToReturn.size()]); 50 } 51 } 52 | Popular Tags |