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 30 public class MBeanEasyConfigTester 31 { 32 33 36 37 public MBeanEasyConfigTester() 38 { 39 } 40 41 44 45 public static void main (String args[]) 46 { 47 new MBeanEasyConfigTester().test(); 48 } 49 50 public void test() 51 { 52 try 53 { 54 printInfo((new EasyConfigTestMBean()).getMBeanInfo()); 55 } 56 catch(Exception e) 57 { 58 59 e.printStackTrace(); 60 } 61 } 62 private void printInfo(MBeanInfo info) 63 { 64 print("************** MBeanInfo ******************"); 65 print("ClassName="+info.getClassName()); 66 print("Description="+info.getDescription()); 67 printInfo(info.getAttributes()); 68 printInfo(info.getConstructors()); 69 printInfo(info.getNotifications()); 70 printInfo(info.getOperations()); 71 } 72 73 private void printInfo(MBeanAttributeInfo info) 75 { 76 print(" ************** MBeanAttributeInfo ******************"); 77 print(" name="+info.getName()); 78 print(" description="+info.getDescription()); 79 print(" type="+info.getType()); 80 print(" isReadable="+info.isReadable()); 81 print(" isWritable="+info.isWritable()); 82 print(" isIs="+info.isIs()); 83 } 84 85 private void printInfo(MBeanConstructorInfo info) 87 { 88 print(" ************** MBeanConstructorInfo ******************"); 89 print(" name="+info.getName()); 90 print(" description="+info.getDescription()); 91 printInfo(info.getSignature()); 92 } 93 94 private void printInfo(MBeanNotificationInfo info) 96 { 97 print(" ************** MBeanNotificationInfo ******************"); 98 print(" name="+info.getName()); 99 print(" description="+info.getDescription()); 100 printInfo(info.getNotifTypes()); 101 } 102 private void printInfo(MBeanOperationInfo info) 104 { 105 print(" ************** MBeanOperationInfo ******************"); 106 print(" name="+info.getName()); 107 print(" description="+info.getDescription()); 108 String str = "???"; 109 switch(info.getImpact()) 110 { 111 case MBeanOperationInfo.UNKNOWN: 112 str = "UNKNOWN"; 113 break; 114 case MBeanOperationInfo.ACTION: 115 str = "ACTION"; 116 break; 117 case MBeanOperationInfo.INFO: 118 str = "INFO"; 119 break; 120 case MBeanOperationInfo.ACTION_INFO: 121 str = "ACTION_INFO"; 122 break; 123 } 124 print(" returnType="+info.getReturnType()); 125 print(" impact="+str); 126 printInfo(info.getSignature()); 127 } 128 private void printInfo(MBeanParameterInfo info) 130 { 131 print(" ************** MBeanParameterInfo ******************"); 132 print(" name="+info.getName()); 133 print(" description="+info.getDescription()); 134 print(" type="+info.getType()); 135 } 136 137 138 private void printInfo(Object [] infos) 140 { 141 for(int i=0; i<infos.length; i++) 142 if(infos[i] instanceof MBeanAttributeInfo) 143 printInfo((MBeanAttributeInfo)infos[i]); 144 else 145 if(infos[i] instanceof MBeanConstructorInfo) 146 printInfo((MBeanConstructorInfo)infos[i]); 147 else 148 if(infos[i] instanceof MBeanNotificationInfo) 149 printInfo((MBeanNotificationInfo)infos[i]); 150 else 151 if(infos[i] instanceof MBeanOperationInfo) 152 printInfo((MBeanOperationInfo)infos[i]); 153 else 154 if(infos[i] instanceof MBeanParameterInfo) 155 printInfo((MBeanParameterInfo)infos[i]); 156 else 157 print(" "+infos[i]); } 159 160 private void print(String str) 162 { 163 System.out.println(str); 164 } 165 } | Popular Tags |