1 12 13 package org.ejtools.jmx.browser.web.form; 14 15 16 17 import javax.servlet.http.HttpServletRequest ; 18 19 20 21 import org.apache.log4j.Logger; 22 23 import org.apache.struts.action.ActionError; 24 25 import org.apache.struts.action.ActionErrors; 26 27 import org.apache.struts.action.ActionForm; 28 29 import org.apache.struts.action.ActionMapping; 30 31 32 33 48 49 public class RegisterForm extends ActionForm 50 51 { 52 53 54 55 protected String classLoader = ""; 56 57 58 59 protected String className = ""; 60 61 62 63 protected String objectName = ""; 64 65 66 67 protected String parameters = ""; 68 69 70 71 protected String signature = ""; 72 73 74 75 private static Logger logger = Logger.getLogger(RegisterForm.class); 76 77 78 79 80 81 82 83 public RegisterForm() { } 84 85 86 87 88 89 98 99 public String getClassLoader() 100 101 { 102 103 return this.classLoader; 104 105 } 106 107 108 109 110 111 120 121 public String getClassName() 122 123 { 124 125 return this.className; 126 127 } 128 129 130 131 132 133 142 143 public String getObjectName() 144 145 { 146 147 return this.objectName; 148 149 } 150 151 152 153 154 155 164 165 public String getParameters() 166 167 { 168 169 return this.parameters; 170 171 } 172 173 174 175 176 177 186 187 public String getSignature() 188 189 { 190 191 return this.signature; 192 193 } 194 195 196 197 198 199 210 211 public void reset(ActionMapping mapping, HttpServletRequest request) 212 213 { 214 215 this.objectName = ""; 216 217 this.className = ""; 218 219 this.classLoader = ""; 220 221 this.parameters = ""; 222 223 this.signature = ""; 224 225 } 226 227 228 229 230 231 240 241 public void setClassLoader(String classLoader) 242 243 { 244 245 this.classLoader = classLoader; 246 247 } 248 249 250 251 252 253 262 263 public void setClassName(String className) 264 265 { 266 267 this.className = className; 268 269 } 270 271 272 273 274 275 284 285 public void setObjectName(String objectName) 286 287 { 288 289 this.objectName = objectName; 290 291 } 292 293 294 295 296 297 306 307 public void setParameters(String parameters) 308 309 { 310 311 this.parameters = parameters; 312 313 } 314 315 316 317 318 319 328 329 public void setSignature(String signature) 330 331 { 332 333 this.signature = signature; 334 335 } 336 337 338 339 340 341 354 355 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) 356 357 { 358 359 ActionErrors errors = new ActionErrors(); 360 361 362 363 logger.debug("className=<" + this.className + ">"); 364 365 logger.debug("objectName=<" + this.objectName + ">"); 366 367 logger.debug("classLoader=<" + this.classLoader + ">"); 368 369 logger.debug("signature=<" + this.signature + ">"); 370 371 logger.debug("parameters=<" + this.parameters + ">"); 372 373 374 375 if (this.className.length() == 0) 376 377 { 378 379 errors.add("className", new ActionError("web.error.className.required")); 380 381 } 382 383 if (this.objectName.length() == 0) 384 385 { 386 387 errors.add("objectName", new ActionError("web.error.objectName.required")); 388 389 } 390 391 392 393 if ((this.parameters.length() > 0) && (this.signature.length() == 0)) 394 395 { 396 397 errors.add("signatures", new ActionError("web.error.signature.required")); 398 399 } 400 401 if ((this.signature.length() > 0) && (this.parameters.length() == 0)) 402 403 { 404 405 errors.add("arguments", new ActionError("web.error.parameters.required")); 406 407 } 408 409 410 411 return errors; 412 413 } 414 415 } 416 417
| Popular Tags
|