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 DataSourceRealmForm extends RealmForm { 38 39 41 44 private String dataSourceName = null; 45 46 49 private String digest = null; 50 51 54 private String localDataSource = "false"; 55 56 59 private String roleNameCol = null; 60 61 64 private String userCredCol = null; 65 66 69 private String userNameCol = null; 70 71 74 private String userRoleTable = null; 75 76 79 private String userTable = null; 80 81 84 private List booleanVals = null; 85 86 88 89 92 public String getDataSourceName() { 93 94 return this.dataSourceName; 95 96 } 97 98 101 public void setDataSourceName(String dataSourceName) { 102 103 this.dataSourceName = dataSourceName; 104 105 } 106 107 110 public String getDigest() { 111 112 return this.digest; 113 114 } 115 116 119 public void setDigest(String digest) { 120 121 this.digest = digest; 122 123 } 124 125 128 public String getLocalDataSource() { 129 130 return this.localDataSource; 131 132 } 133 134 137 public void setLocalDataSource(String localDataSource) { 138 139 this.localDataSource = localDataSource; 140 141 } 142 143 146 public String getRoleNameCol() { 147 148 return this.roleNameCol; 149 150 } 151 152 155 public void setRoleNameCol(String roleNameCol) { 156 157 this.roleNameCol = roleNameCol; 158 159 } 160 161 164 public String getUserCredCol() { 165 166 return this.userCredCol; 167 168 } 169 170 173 public void setUserCredCol(String userCredCol) { 174 175 this.userCredCol = userCredCol; 176 177 } 178 179 182 public String getUserNameCol() { 183 184 return this.userNameCol; 185 186 } 187 188 191 public void setUserNameCol(String userNameCol) { 192 193 this.userNameCol = userNameCol; 194 195 } 196 197 200 public String getUserRoleTable() { 201 202 return this.userRoleTable; 203 204 } 205 206 209 public void setUserRoleTable(String userRoleTable) { 210 211 this.userRoleTable = userRoleTable; 212 213 } 214 215 218 public String getUserTable() { 219 220 return this.userTable; 221 222 } 223 224 227 public void setUserTable(String userTable) { 228 229 this.userTable = userTable; 230 231 } 232 233 236 public List getBooleanVals() { 237 238 return this.booleanVals; 239 240 } 241 242 245 public void setBooleanVals(List booleanVals) { 246 247 this.booleanVals = booleanVals; 248 249 } 250 251 253 259 public void reset(ActionMapping mapping, HttpServletRequest request) { 260 261 super.reset(mapping, request); 262 this.dataSourceName = null; 263 this.digest = null; 264 this.localDataSource = "false"; 265 266 this.roleNameCol = null; 267 this.userCredCol = null; 268 this.userNameCol = null; 269 this.userTable = null; 270 this.userRoleTable = null; 271 272 } 273 274 277 public String toString() { 278 279 StringBuffer sb = new StringBuffer ("DataSourceRealmForm[adminAction="); 280 sb.append(getAdminAction()); 281 sb.append(",dataSourceName="); 282 sb.append(dataSourceName); 283 sb.append(",digest="); 284 sb.append(digest); 285 sb.append("',localDataSource='"); 286 sb.append(localDataSource); 287 sb.append("',roleNameCol="); 288 sb.append(roleNameCol); 289 sb.append("',userCredCol="); 290 sb.append(userCredCol); 291 sb.append("',userNameCol="); 292 sb.append(userNameCol); 293 sb.append("',userRoleTable="); 294 sb.append(userRoleTable); 295 sb.append("',userTable='"); 296 sb.append(userTable); 297 sb.append("',objectName='"); 298 sb.append(getObjectName()); 299 sb.append("',realmType="); 300 sb.append(getRealmType()); 301 sb.append("]"); 302 return (sb.toString()); 303 304 } 305 306 316 317 public ActionErrors validate(ActionMapping mapping, 318 HttpServletRequest request) { 319 320 ActionErrors errors = new ActionErrors(); 321 322 String submit = request.getParameter("submit"); 323 325 329 if ((dataSourceName == null) || (dataSourceName.length() < 1)) { 330 errors.add("dataSourceName", 331 new ActionError("error.dataSourceName.required")); 332 } 333 334 if ((roleNameCol == null) || (roleNameCol.length() < 1)) { 335 errors.add("roleNameCol", 336 new ActionError("error.roleNameCol.required")); 337 } 338 339 if ((userCredCol == null) || (userCredCol.length() < 1)) { 340 errors.add("userCredCol", 341 new ActionError("error.userCredCol.required")); 342 } 343 344 if ((userNameCol == null) || (userNameCol.length() < 1)) { 345 errors.add("userNameCol", 346 new ActionError("error.userNameCol.required")); 347 } 348 349 if ((userRoleTable == null) || (userRoleTable.length() < 1)) { 350 errors.add("userRoleTable", 351 new ActionError("error.userRoleTable.required")); 352 } 353 354 if ((userTable == null) || (userTable.length() < 1)) { 355 errors.add("userTable", 356 new ActionError("error.userTable.required")); 357 } 358 359 361 return errors; 362 } 363 } 364 | Popular Tags |