1 8 9 package mx4j.tools.adaptor.http; 10 11 import java.lang.reflect.Constructor ; 12 import java.lang.reflect.Method ; 13 14 import mx4j.MBeanDescriptionAdapter; 15 16 21 public class HttpAdaptorMBeanDescription extends MBeanDescriptionAdapter 22 { 23 public String getMBeanDescription() 24 { 25 return "HttpAdaptor MBean"; 26 } 27 28 public String getConstructorDescription(Constructor ctor) 29 { 30 if (ctor.toString().equals("public mx4j.tools.adaptor.http.HttpAdaptor()")) 31 { 32 return "Parameterless constructor"; 33 } 34 if (ctor.toString().equals("public mx4j.tools.adaptor.http.HttpAdaptor(int)")) 35 { 36 return "Constructor with a given port"; 37 } 38 if (ctor.toString().equals("public mx4j.tools.adaptor.http.HttpAdaptor(java.lang.String)")) 39 { 40 return "Constructor with a given host"; 41 } 42 if (ctor.toString().equals("public mx4j.tools.adaptor.http.HttpAdaptor(int,java.lang.String)")) 43 { 44 return "Constructor with a given port and host"; 45 } 46 return super.getConstructorDescription(ctor); 47 } 48 49 public String getConstructorParameterName(Constructor ctor, int index) 50 { 51 if (ctor.toString().equals("public mx4j.tools.adaptor.http.HttpAdaptor(int)")) 52 { 53 switch (index) 54 { 55 case 0: 56 return "port"; 57 } 58 } 59 if (ctor.toString().equals("public mx4j.tools.adaptor.http.HttpAdaptor(java.lang.String)")) 60 { 61 switch (index) 62 { 63 case 0: 64 return "host"; 65 } 66 } 67 if (ctor.toString().equals("public mx4j.tools.adaptor.http.HttpAdaptor(int,java.lang.String)")) 68 { 69 switch (index) 70 { 71 case 0: 72 return "port"; 73 case 1: 74 return "host"; 75 } 76 } 77 return super.getConstructorParameterName(ctor, index); 78 } 79 80 public String getConstructorParameterDescription(Constructor ctor, int index) 81 { 82 if (ctor.toString().equals("public mx4j.tools.adaptor.http.HttpAdaptor(int)")) 83 { 84 switch (index) 85 { 86 case 0: 87 return "Listening port"; 88 } 89 } 90 if (ctor.toString().equals("public mx4j.tools.adaptor.http.HttpAdaptor(java.lang.String)")) 91 { 92 switch (index) 93 { 94 case 0: 95 return "Listening host"; 96 } 97 } 98 if (ctor.toString().equals("public mx4j.tools.adaptor.http.HttpAdaptor(int,java.lang.String)")) 99 { 100 switch (index) 101 { 102 case 0: 103 return "Listening port"; 104 case 1: 105 return "Listening host"; 106 } 107 } 108 return super.getConstructorParameterDescription(ctor, index); 109 } 110 111 public String getAttributeDescription(String attribute) 112 { 113 if (attribute.equals("AuthenticationMethod")) 114 { 115 return "Authentication method (none/basic/digest)"; 116 } 117 if (attribute.equals("ProcessorClass")) 118 { 119 return "PostProcessor MBean"; 120 } 121 if (attribute.equals("ProcessorNameString")) 122 { 123 return "PostProcessor MBean's object name as string"; 124 } 125 if (attribute.equals("Processor")) 126 { 127 return "PostProcessor MBean"; 128 } 129 if (attribute.equals("ProcessorName")) 130 { 131 return "PostProcessor MBean's object name"; 132 } 133 if (attribute.equals("SocketFactory")) 134 { 135 return "Server Socket factory"; 136 } 137 if (attribute.equals("SocketFactoryName")) 138 { 139 return "Server Socket factory's objectname"; 140 } 141 if (attribute.equals("SocketFactoryNameString")) 142 { 143 return "Server Socket factory's objectname as string"; 144 } 145 if (attribute.equals("Active")) 146 { 147 return "Indicates whether the server is active"; 148 } 149 if (attribute.equals("StartDate")) 150 { 151 return "Indicates the date when the server was started"; 152 } 153 if (attribute.equals("RequestsCount")) 154 { 155 return "Total of requested served so far"; 156 } 157 if (attribute.equals("Version")) 158 { 159 return "HttpAdaptor's version"; 160 } 161 return super.getAttributeDescription(attribute); 162 } 163 164 public String getOperationDescription(Method operation) 165 { 166 String name = operation.getName(); 167 if (name.equals("addCommandProcessor")) 168 { 169 return "Adds a command processor object assigned to a given path"; 170 } 171 if (name.equals("addCommandProcessor")) 172 { 173 return "Adds a command processor object (given a classname) assigned to a given path"; 174 } 175 if (name.equals("removeCommandProcessor")) 176 { 177 return "Removes a command processor for a given path"; 178 } 179 if (name.equals("start")) 180 { 181 return "Starts the HttpAdaptor"; 182 } 183 if (name.equals("stop")) 184 { 185 return "Stops the HttpAdaptor"; 186 } 187 if (name.equals("addAuthorization")) 188 { 189 return "Adds an authorized pair name/password"; 190 } 191 return super.getOperationDescription(operation); 192 } 193 194 public String getOperationParameterName(Method method, int index) 195 { 196 String name = method.getName(); 197 if (name.equals("addCommandProcessor")) 198 { 199 switch (index) 200 { 201 case 0: 202 return "path"; 203 case 1: 204 return "processor"; 205 } 206 } 207 if (name.equals("addCommandProcessor")) 208 { 209 switch (index) 210 { 211 case 0: 212 return "path"; 213 case 1: 214 return "processorClass"; 215 } 216 } 217 if (name.equals("removeCommandProcessor")) 218 { 219 switch (index) 220 { 221 case 0: 222 return "path"; 223 } 224 } 225 if (name.equals("addAuthorization")) 226 { 227 switch (index) 228 { 229 case 0: 230 return "username"; 231 case 1: 232 return "password"; 233 } 234 } 235 return super.getOperationParameterName(method, index); 236 } 237 238 public String getOperationParameterDescription(Method method, int index) 239 { 240 String name = method.getName(); 241 if (name.equals("addCommandProcessor")) 242 { 243 switch (index) 244 { 245 case 0: 246 return "Path assigned to the new command processor"; 247 case 1: 248 return "HttpCommandProcessor object"; 249 } 250 } 251 if (name.equals("addCommandProcessor")) 252 { 253 switch (index) 254 { 255 case 0: 256 return "Path assigned to the new command processor"; 257 case 1: 258 return "HttpCommandProcessor classname to be instantiated and assigned to the give path"; 259 } 260 } 261 if (name.equals("removeCommandProcessor")) 262 { 263 switch (index) 264 { 265 case 0: 266 return "Path to be removed"; 267 } 268 } 269 if (name.equals("addAuthorization")) 270 { 271 switch (index) 272 { 273 case 0: 274 return "Username"; 275 case 1: 276 return "Password"; 277 } 278 } 279 return super.getOperationParameterDescription(method, index); 280 } 281 } 282 | Popular Tags |