KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > webapp > jonasadmin > security > DatasourceRealmForm


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: DatasourceRealmForm.java,v 1.7 2005/04/21 08:59:54 kemlerp Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.webapp.jonasadmin.security;
27
28 import java.util.List JavaDoc;
29
30 import javax.servlet.http.HttpServletRequest JavaDoc;
31
32 import org.apache.struts.action.ActionMessage;
33 import org.apache.struts.action.ActionErrors;
34 import org.apache.struts.action.ActionMapping;
35 import org.objectweb.jonas.webapp.jonasadmin.Jlists;
36
37 /**
38  * @author Michel-Ange ANTON
39  */

40 public class DatasourceRealmForm extends FactoryRealmForm {
41
42 // --------------------------------------------------------- Constants
43

44 // --------------------------------------------------------- Properties variables
45

46     private String JavaDoc dsName = null;
47     private String JavaDoc roleTable = null;
48     private String JavaDoc roleTableRolenameCol = null;
49     private String JavaDoc roleTableUsernameCol = null;
50     private String JavaDoc userTable = null;
51     private String JavaDoc userTablePasswordCol = null;
52     private String JavaDoc userTableUsernameCol = null;
53     private String JavaDoc algorithm = null;
54
55     private List JavaDoc securityAlgorithms = Jlists.getSecurityAlgorithms();
56
57 // --------------------------------------------------------- Public Methods
58

59     /**
60      * Validate the properties that have been set from this HTTP request,
61      * and return an <code>ActionErrors</code> object that encapsulates any
62      * validation errors that have been found. If no errors are found, return
63      * <code>null</code> or an <code>ActionErrors</code> object with no
64      * recorded error messages.
65      *
66      * @param mapping The mapping used to select this instance
67      * @param request The servlet request we are processing
68      * @return List of errors
69      */

70     public ActionErrors validate(ActionMapping mapping, HttpServletRequest JavaDoc request) {
71         ActionErrors oErrors = new ActionErrors();
72
73         if ((getName() == null) || (getName().length() == 0)) {
74             oErrors.add("name"
75                 , new ActionMessage("error.security.factory.datasource.realm.name.required"));
76         }
77         if ((dsName == null) || (dsName.length() == 0)) {
78             oErrors.add("dsName"
79                 , new ActionMessage("error.security.factory.datasource.realm.dsName.required"));
80         }
81         if ((roleTable == null) || (roleTable.length() == 0)) {
82             oErrors.add("roleTable"
83                 , new ActionMessage("error.security.factory.datasource.realm.roleTable.required"));
84         }
85         if ((roleTableRolenameCol == null) || (roleTableRolenameCol.length() == 0)) {
86             oErrors.add("roleTableRolenameCol"
87                 , new ActionMessage("error.security.factory.datasource.realm.roleTableRolenameCol.required"));
88         }
89         if ((roleTableUsernameCol == null) || (roleTableUsernameCol.length() == 0)) {
90             oErrors.add("roleTableUsernameCol"
91                 , new ActionMessage("error.security.factory.datasource.realm.roleTableUsernameCol.required"));
92         }
93         if ((userTable == null) || (userTable.length() == 0)) {
94             oErrors.add("userTable"
95                 , new ActionMessage("error.security.factory.datasource.realm.userTable.required"));
96         }
97         if ((userTablePasswordCol == null) || (userTablePasswordCol.length() == 0)) {
98             oErrors.add("userTablePasswordCol"
99                 , new ActionMessage("error.security.factory.datasource.realm.userTablePasswordCol.required"));
100         }
101         if ((userTableUsernameCol == null) || (userTableUsernameCol.length() == 0)) {
102             oErrors.add("userTableUsernameCol"
103                 , new ActionMessage("error.security.factory.datasource.realm.userTableUsernameCol.required"));
104         }
105
106         return oErrors;
107     }
108
109 // --------------------------------------------------------- Properties Methods
110

111     public String JavaDoc getDsName() {
112         return dsName;
113     }
114
115     public void setDsName(String JavaDoc dsName) {
116         this.dsName = dsName;
117     }
118
119     public String JavaDoc getRoleTable() {
120         return roleTable;
121     }
122
123     public void setRoleTable(String JavaDoc roleTable) {
124         this.roleTable = roleTable;
125     }
126
127     public String JavaDoc getRoleTableRolenameCol() {
128         return roleTableRolenameCol;
129     }
130
131     public void setRoleTableRolenameCol(String JavaDoc roleTableRolenameCol) {
132         this.roleTableRolenameCol = roleTableRolenameCol;
133     }
134
135     public String JavaDoc getRoleTableUsernameCol() {
136         return roleTableUsernameCol;
137     }
138
139     public void setRoleTableUsernameCol(String JavaDoc roleTableUsernameCol) {
140         this.roleTableUsernameCol = roleTableUsernameCol;
141     }
142
143     public String JavaDoc getUserTable() {
144         return userTable;
145     }
146
147     public void setUserTable(String JavaDoc userTable) {
148         this.userTable = userTable;
149     }
150
151     public String JavaDoc getUserTablePasswordCol() {
152         return userTablePasswordCol;
153     }
154
155     public void setUserTablePasswordCol(String JavaDoc userTablePasswordCol) {
156         this.userTablePasswordCol = userTablePasswordCol;
157     }
158
159     public String JavaDoc getUserTableUsernameCol() {
160         return userTableUsernameCol;
161     }
162
163     public void setUserTableUsernameCol(String JavaDoc userTableUsernameCol) {
164         this.userTableUsernameCol = userTableUsernameCol;
165     }
166
167     public String JavaDoc getAlgorithm() {
168         return algorithm;
169     }
170
171     public void setAlgorithm(String JavaDoc algorithm) {
172         this.algorithm = algorithm;
173     }
174
175     public List JavaDoc getSecurityAlgorithms() {
176         return securityAlgorithms;
177     }
178
179 }
Popular Tags