1 8 9 package mx4j.tools.naming; 10 11 import java.lang.reflect.Constructor ; 12 import java.lang.reflect.Method ; 13 14 import mx4j.MBeanDescriptionAdapter; 15 16 21 public class CosNamingServiceMBeanDescription extends MBeanDescriptionAdapter 22 { 23 public String getMBeanDescription() 24 { 25 return "MBean that wraps tnameserv"; 26 } 27 28 public String getConstructorDescription(Constructor ctor) 29 { 30 if (ctor.toString().equals("public mx4j.tools.naming.CosNamingService()")) 31 { 32 return "Creates a new instance of CosNamingService with the default port (900)"; 33 } 34 if (ctor.toString().equals("public mx4j.tools.naming.CosNamingService(int)")) 35 { 36 return "Creates a new instance of CosNamingService with the specified port"; 37 } 38 return super.getConstructorDescription(ctor); 39 } 40 41 public String getConstructorParameterName(Constructor ctor, int index) 42 { 43 if (ctor.toString().equals("public mx4j.tools.naming.CosNamingService(int)")) 44 { 45 switch (index) 46 { 47 case 0: 48 return "port"; 49 } 50 } 51 return super.getConstructorParameterName(ctor, index); 52 } 53 54 public String getConstructorParameterDescription(Constructor ctor, int index) 55 { 56 if (ctor.toString().equals("public mx4j.tools.naming.CosNamingService(int)")) 57 { 58 switch (index) 59 { 60 case 0: 61 return "The port on which tnameserv will listen for incoming connections"; 62 } 63 } 64 return super.getConstructorParameterDescription(ctor, index); 65 } 66 67 public String getAttributeDescription(String attribute) 68 { 69 if (attribute.equals("Port")) 70 { 71 return "The port on which tnameserv listens for incoming connections"; 72 } 73 if (attribute.equals("Running")) 74 { 75 return "The running status of this MBean"; 76 } 77 if (attribute.equals("Delay")) 78 { 79 return "The delay (ms) for the start() and stop() methods"; 80 } 81 return super.getAttributeDescription(attribute); 82 } 83 84 public String getOperationDescription(Method operation) 85 { 86 String name = operation.getName(); 87 if (name.equals("start")) 88 { 89 return "Starts tnameserv"; 90 } 91 if (name.equals("stop")) 92 { 93 return "Stops tnameserv"; 94 } 95 return super.getOperationDescription(operation); 96 } 97 } 98 | Popular Tags |