1 23 24 package com.sun.enterprise.admin.server.core.mbean.test; 25 26 import javax.management.*; 27 import com.sun.enterprise.admin.util.*; 29 import com.sun.enterprise.admin.server.core.mbean.config.*; 30 import com.sun.enterprise.admin.server.core.jmx.*; 31 32 public class PrintMBeanDescriptionUtil 33 { 34 35 38 39 public PrintMBeanDescriptionUtil() 40 { 41 } 42 43 46 47 public static void main(String args[]) 48 { 49 new PrintMBeanDescriptionUtil().test(args); 50 } 51 52 private void printPropertyEntries(DynamicMBean mbean) 53 { 54 print("\n#**************************************************************"); 55 String name = mbean.getClass().getName(); 56 name = name.substring(name.lastIndexOf('.')+1); 57 print("# Text Descriptions for MBean: "+name); 58 print("#**************************************************************"); 59 printDescr(mbean.getMBeanInfo()); 60 } 61 public void test(String args[]) 62 { 63 try 64 { 65 MBeanServer mbs = SunoneInterceptor.getMBeanServerInstance(); 66 printPropertyEntries(new GenericConfigurator()); 67 printPropertyEntries(new JMSAdminHandler("ias1")); 69 printPropertyEntries(new ManagedCustomResource("ias1","any")); 70 printPropertyEntries(new ManagedEjbContainer("ias1")); 71 printPropertyEntries(new ManagedHTTPListener("ias1","any")); 73 printPropertyEntries(new ManagedHTTPService("ias1")); 74 printPropertyEntries(new ManagedJDBCConnectionPool("ias1","any")); 75 printPropertyEntries(new ManagedJDBCResource("ias1","any")); 76 printPropertyEntries(new ManagedJMSResource("ias1","any")); 77 printPropertyEntries(new ManagedJNDIResource("ias1","any")); 78 printPropertyEntries(new ManagedJVM("ias1")); 79 printPropertyEntries(new ManagedJavaMailResource("ias1","any")); 80 printPropertyEntries(new ManagedLogService("ias1")); 81 printPropertyEntries(new ManagedMdbContainer("ias1")); 82 printPropertyEntries(new ManagedORBComponent("ias1")); 83 printPropertyEntries(new ManagedORBListener("ias1","any")); 84 printPropertyEntries(new ManagedPMFactoryResource("ias1","any")); 85 printPropertyEntries(new ManagedSecurityService("ias1")); 86 printPropertyEntries(new ManagedServerInstance("ias1",new HostAndPort("any",1), false)); 87 printPropertyEntries(new ManagedStandaloneConnectorModule("ias1","any")); 88 printPropertyEntries(new ManagedStandaloneJ2EEEjbJarModule("ias1","any")); 89 printPropertyEntries(new ManagedStandaloneJ2EEWebModule("ias1","any")); 90 printPropertyEntries(new ManagedTransactionService("ias1")); 91 printPropertyEntries(new ManagedWebContainer("ias1")); 92 printPropertyEntries(new ServerController()); 93 } 94 catch(Throwable e) 95 { 96 print(e.getMessage()); 97 e.printStackTrace(); 98 } 99 } 100 101 private void printDescr(MBeanInfo info) 102 { 103 printDescr(info.getDescription()); 104 printDescr(info.getAttributes()); 105 printDescr(info.getConstructors()); 106 printDescr(info.getNotifications()); 107 printDescr(info.getOperations()); 108 } 109 110 private void printDescr(MBeanAttributeInfo info) 112 { 113 printDescr(info.getDescription()); 114 } 115 116 private void printDescr(MBeanConstructorInfo info) 118 { 119 printDescr(info.getDescription()); 120 printDescr(info.getSignature()); 121 } 122 123 private void printDescr(MBeanNotificationInfo info) 125 { 126 printDescr(info.getDescription()); 127 printDescr(info.getNotifTypes()); 128 } 129 private void printDescr(MBeanOperationInfo info) 131 { 132 printDescr(info.getDescription()); 133 printDescr(info.getSignature()); 134 } 135 private void printDescr(MBeanParameterInfo info) 137 { 138 printDescr(info.getDescription()); 139 } 140 141 private void printDescr(String descr) 143 { 144 if(descr!=null && descr.length()>0) 145 print(descr+" = "+descr); 146 } 147 148 private void printDescr(Object [] infos) 150 { 151 for(int i=0; i<infos.length; i++) 152 if(infos[i] instanceof MBeanAttributeInfo) 153 printDescr((MBeanAttributeInfo)infos[i]); 154 else 155 if(infos[i] instanceof MBeanConstructorInfo) 156 printDescr((MBeanConstructorInfo)infos[i]); 157 else 158 if(infos[i] instanceof MBeanNotificationInfo) 159 printDescr((MBeanNotificationInfo)infos[i]); 160 else 161 if(infos[i] instanceof MBeanOperationInfo) 162 printDescr((MBeanOperationInfo)infos[i]); 163 else 164 if(infos[i] instanceof MBeanParameterInfo) 165 printDescr((MBeanParameterInfo)infos[i]); 166 } 167 168 private void print(String str) 170 { 171 System.out.println(str); 172 } 173 } 174 | Popular Tags |