1 16 17 package org.apache.webapp.admin.realm; 18 19 import javax.servlet.http.HttpServletRequest ; 20 import org.apache.struts.action.ActionError; 21 import org.apache.struts.action.ActionErrors; 22 import org.apache.struts.action.ActionForm; 23 import org.apache.struts.action.ActionMapping; 24 import java.net.InetAddress ; 25 import java.util.List ; 26 27 import org.apache.webapp.admin.ApplicationServlet; 28 import org.apache.webapp.admin.LabelValueBean; 29 30 36 37 public final class JDBCRealmForm extends RealmForm { 38 39 41 45 private String realmName = null; 46 47 50 private String digest = null; 51 52 55 private String roleNameCol = null; 56 57 60 private String userNameCol = null; 61 62 65 private String passwordCol = null; 66 67 70 private String driver = null; 71 72 75 private String roleTable = null; 76 77 80 private String userTable = null; 81 82 85 private String connectionName = null; 86 87 90 private String connectionPassword = null; 91 92 95 private String connectionURL = null; 96 97 99 100 103 public String getDigest() { 104 105 return this.digest; 106 107 } 108 109 112 public void setDigest(String digest) { 113 114 this.digest = digest; 115 116 } 117 118 121 public String getRoleNameCol() { 122 123 return this.roleNameCol; 124 125 } 126 127 130 public void setRoleNameCol(String roleNameCol) { 131 132 this.roleNameCol = roleNameCol; 133 134 } 135 136 139 public String getUserNameCol() { 140 141 return this.userNameCol; 142 143 } 144 145 148 public void setUserNameCol(String userNameCol) { 149 150 this.userNameCol = userNameCol; 151 152 } 153 156 public String getDriver() { 157 158 return this.driver; 159 160 } 161 162 165 public void setDriver(String driver) { 166 167 this.driver = driver; 168 169 } 170 171 174 public String getRoleTable() { 175 176 return this.roleTable; 177 178 } 179 180 183 public void setRoleTable(String roleTable) { 184 185 this.roleTable = roleTable; 186 187 } 188 189 192 public String getUserTable() { 193 194 return this.userTable; 195 196 } 197 198 201 public void setUserTable(String userTable) { 202 203 this.userTable = userTable; 204 205 } 206 207 210 public String getPasswordCol() { 211 212 return this.passwordCol; 213 214 } 215 216 219 public void setPasswordCol(String passwordCol) { 220 221 this.passwordCol = passwordCol; 222 223 } 224 225 226 229 public String getConnectionName() { 230 231 return this.connectionName; 232 233 } 234 235 238 public void setConnectionName(String connectionName) { 239 240 this.connectionName = connectionName; 241 242 } 243 244 245 248 public String getConnectionPassword() { 249 250 return this.connectionPassword; 251 252 } 253 254 257 public void setConnectionPassword(String connectionPassword) { 258 259 this.connectionPassword = connectionPassword; 260 261 } 262 263 264 267 public String getConnectionURL() { 268 269 return this.connectionURL; 270 271 } 272 273 276 public void setConnectionURL(String connectionURL) { 277 278 this.connectionURL = connectionURL; 279 280 } 281 282 284 290 public void reset(ActionMapping mapping, HttpServletRequest request) { 291 292 super.reset(mapping, request); 293 this.digest = null; 294 this.driver = null; 295 296 this.roleNameCol = null; 297 this.userNameCol = null; 298 this.passwordCol = null; 299 this.userTable = null; 300 this.roleTable = null; 301 302 this.connectionName = null; 303 this.connectionPassword = null; 304 this.connectionURL = null; 305 306 } 307 308 311 public String toString() { 312 313 StringBuffer sb = new StringBuffer ("UserDatabaseRealmForm[adminAction="); 314 sb.append(getAdminAction()); 315 sb.append(",digest="); 316 sb.append(digest); 317 sb.append("',driver='"); 318 sb.append(driver); 319 sb.append("',roleNameCol="); 320 sb.append(roleNameCol); 321 sb.append("',userNameCol="); 322 sb.append(userNameCol); 323 sb.append(",passwordCol="); 324 sb.append(passwordCol); 325 sb.append("',userTable='"); 326 sb.append(userTable); 327 sb.append("',roleTable="); 328 sb.append(roleTable); 329 sb.append(",connectionName="); 330 sb.append(connectionName); 331 sb.append("',connectionPassword="); 332 sb.append(connectionPassword); 333 sb.append(",connectionURL="); 334 sb.append(connectionURL); 335 sb.append("',objectName='"); 336 sb.append(getObjectName()); 337 sb.append("',realmType="); 338 sb.append(getRealmType()); 339 sb.append("]"); 340 return (sb.toString()); 341 342 } 343 344 354 355 public ActionErrors validate(ActionMapping mapping, 356 HttpServletRequest request) { 357 358 ActionErrors errors = new ActionErrors(); 359 360 String submit = request.getParameter("submit"); 361 363 367 if ((driver == null) || (driver.length() < 1)) { 368 errors.add("driver", 369 new ActionError("error.driver.required")); 370 } 371 372 if ((roleNameCol == null) || (roleNameCol.length() < 1)) { 373 errors.add("roleNameCol", 374 new ActionError("error.roleNameCol.required")); 375 } 376 377 if ((userNameCol == null) || (userNameCol.length() < 1)) { 378 errors.add("userNameCol", 379 new ActionError("error.userNameCol.required")); 380 } 381 382 if ((passwordCol == null) || (passwordCol.length() < 1)) { 383 errors.add("passwordCol", 384 new ActionError("error.passwordCol.required")); 385 } 386 387 if ((userTable == null) || (userTable.length() < 1)) { 388 errors.add("userTable", 389 new ActionError("error.userTable.required")); 390 } 391 392 if ((roleTable == null) || (roleTable.length() < 1)) { 393 errors.add("roleTable", 394 new ActionError("error.roleTable.required")); 395 } 396 397 if ((connectionName == null) || (connectionName.length() < 1)) { 398 errors.add("connectionName", 399 new ActionError("error.connectionName.required")); 400 } 401 402 if ((connectionPassword == null) || (connectionPassword.length() < 1)) { 403 errors.add("connectionPassword", 404 new ActionError("error.connectionPassword.required")); 405 } 406 407 if ((connectionURL == null) || (connectionURL.length() < 1)) { 408 errors.add("connectionURL", 409 new ActionError("error.connectionURL.required")); 410 } 411 413 return errors; 414 } 415 } 416 | Popular Tags |