1 23 24 package com.sun.enterprise.admin.server.core.mbean.test; 25 26 import javax.management.*; 27 import com.sun.enterprise.admin.server.core.mbean.meta.MBeanInfoBuilder; 28 import com.sun.enterprise.admin.util.*; 29 30 public class MBeanInfoBuilderTester 31 { 32 33 36 37 public MBeanInfoBuilderTester() 38 { 39 } 40 41 44 45 public static void main (String args[]) 46 { 47 new MBeanInfoBuilderTester().test(); 48 } 49 50 public void test() 51 { 52 String [] mbeanNames = new String []{ 53 "com.sun.enterprise.admin.server.core.mbean.test.ManagedTest", 54 "com.sun.enterprise.admin.server.core.mbean.config.ServerController", 55 "com.sun.enterprise.admin.server.core.mbean.config.ManagedServerInstance" 56 }; 57 try 58 { 59 for (int i1 = 0 ; i1 < mbeanNames.length ; i1 ++) 60 { 61 Class cl = Class.forName(mbeanNames[i1]); 62 MBeanInfoBuilder builder = new MBeanInfoBuilder(cl); 63 MBeanInfo mi = builder.getMBeanInfo (); 64 MBeanAttributeInfo[] attrs = mi.getAttributes(); 65 for (int i = 0 ; i < attrs.length ; i++) 66 { 67 Logger.log("Attr: " + attrs[i].getName ()); 68 } 69 MBeanOperationInfo[] operations = mi.getOperations(); 70 for (int i = 0 ; i < operations.length ; i++) 71 { 72 MBeanOperationInfo oper = operations[i]; 73 Logger.log("Oper: name = " + oper.getName()); 74 Logger.log("Signature: "); 75 MBeanParameterInfo[] params = oper.getSignature (); 76 for (int j = 0 ; j < params.length ; j++) 77 { 78 Logger.log("ParamType = " + params[j].getType()); 79 } 80 81 } 82 } 83 } 84 catch(Exception e) 85 { 86 e.printStackTrace(); 87 } 88 } 89 } | Popular Tags |