1 16 17 18 package org.apache.webapp.admin.service; 19 20 import javax.servlet.http.HttpServletRequest ; 21 import org.apache.struts.action.ActionError; 22 import org.apache.struts.action.ActionErrors; 23 import org.apache.struts.action.ActionForm; 24 import org.apache.struts.action.ActionMapping; 25 import java.util.List ; 26 27 33 34 public final class ServiceForm extends ActionForm { 35 36 38 39 42 private String adminAction = "Edit"; 43 44 45 48 private String engineObjectName = null; 49 50 51 54 private String objectName = null; 55 56 57 60 private String serviceName = null; 61 62 65 private String serverObjectName = null; 66 67 70 private String nodeLabel = null; 71 72 75 private String engineName = null; 76 77 78 81 private String adminServiceName = null; 82 83 86 private String defaultHost = null; 87 88 private List hostNameVals = null; 89 90 91 93 94 97 public String getAdminAction() { 98 99 return this.adminAction; 100 101 } 102 103 104 107 public void setAdminAction(String adminAction) { 108 109 this.adminAction = adminAction; 110 111 } 112 113 114 117 public String getEngineObjectName() { 118 119 return this.engineObjectName; 120 121 } 122 123 124 127 public void setEngineObjectName(String engineObjectName) { 128 129 this.engineObjectName = engineObjectName; 130 131 } 132 133 134 137 public String getObjectName() { 138 139 return this.objectName; 140 141 } 142 143 144 147 public void setObjectName(String objectName) { 148 149 this.objectName = objectName; 150 151 } 152 153 154 157 public String getNodeLabel() { 158 159 return this.nodeLabel; 160 161 } 162 163 166 public void setNodeLabel(String nodeLabel) { 167 168 this.nodeLabel = nodeLabel; 169 170 } 171 172 175 public List getHostNameVals() { 176 177 return this.hostNameVals; 178 179 } 180 181 184 public void setHostNameVals(List hostNameVals) { 185 186 this.hostNameVals = hostNameVals; 187 188 } 189 190 193 194 public void setEngineName(String engineName) { 195 196 this.engineName = engineName; 197 198 } 199 200 201 204 205 public String getEngineName() { 206 207 return this.engineName; 208 209 } 210 211 214 public String getServerObjectName() { 215 216 return this.serverObjectName; 217 218 } 219 220 223 public void setServerObjectName(String serverObjectName) { 224 225 this.serverObjectName = serverObjectName; 226 227 } 228 229 232 public String getServiceName() { 233 234 return this.serviceName; 235 236 } 237 238 241 public void setServiceName(String serviceName) { 242 243 this.serviceName = serviceName; 244 245 } 246 247 250 public String getAdminServiceName() { 251 252 return this.adminServiceName; 253 254 } 255 256 259 public void setAdminServiceName(String adminServiceName) { 260 261 this.adminServiceName = adminServiceName; 262 263 } 264 265 268 public String getDefaultHost() { 269 270 return this.defaultHost; 271 272 } 273 274 277 public void setDefaultHost(String defaultHost) { 278 279 this.defaultHost = defaultHost; 280 281 } 282 283 284 286 292 public void reset(ActionMapping mapping, HttpServletRequest request) { 293 294 this.engineObjectName = null; 295 this.objectName = null; 296 this.serviceName = null; 297 this.engineName = null; 298 this.adminServiceName = null; 299 this.defaultHost = null; 300 } 301 302 303 306 public String toString() { 307 308 StringBuffer sb = new StringBuffer ("ServiceForm[adminAction="); 309 sb.append(adminAction); 310 sb.append(",defaultHost="); 311 sb.append(defaultHost); 312 sb.append(",engineName="); 313 sb.append(engineName); 314 sb.append(",engineObjectName='"); 315 sb.append(engineObjectName); 316 sb.append("',objectName='"); 317 sb.append(objectName); 318 sb.append("',serviceName="); 319 sb.append(serviceName); 320 sb.append("',serverObjectName="); 321 sb.append(serverObjectName); 322 sb.append("',adminServiceName="); 323 sb.append(adminServiceName); 324 sb.append("]"); 325 return (sb.toString()); 326 327 } 328 329 330 340 public ActionErrors validate(ActionMapping mapping, 341 HttpServletRequest request) { 342 343 ActionErrors errors = new ActionErrors(); 344 String submit = request.getParameter("submit"); 345 346 348 if ((serviceName == null) || (serviceName.length() < 1)) { 349 errors.add("serviceName", 350 new ActionError("error.serviceName.required")); 351 } 352 353 if ((engineName == null) || (engineName.length() < 1)) { 354 errors.add("engineName", 355 new ActionError("error.engineName.required")); 356 } 357 358 360 return errors; 361 } 362 363 } 364 | Popular Tags |