KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_web > deployment > xml > SecurityConstraint


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 2004 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 1any 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  * Initial developer: Florent BENOIT
22  * --------------------------------------------------------------------------
23  * $Id: SecurityConstraint.java,v 1.3 2004/05/25 14:26:34 sauthieg Exp $
24  * --------------------------------------------------------------------------
25  */

26
27 package org.objectweb.jonas_web.deployment.xml;
28
29 import org.objectweb.jonas_lib.deployment.xml.AbsElement;
30 import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
31
32 /**
33  * This class defines the implementation of the element security-constraint
34  * @author Florent Benoit
35  */

36 public class SecurityConstraint extends AbsElement {
37
38     /**
39      * web-resource-collection
40      */

41     private JLinkedList webResourceCollectionList = null;
42
43     /**
44      * auth-constraint
45      */

46     private AuthConstraint authConstraint = null;
47
48     /**
49      * user-data-constraint
50      */

51     private UserDataConstraint userDataConstraint = null;
52
53
54     /**
55      * Constructor
56      */

57     public SecurityConstraint() {
58         super();
59         webResourceCollectionList = new JLinkedList("web-resource-collection");
60     }
61
62
63     // Setters
64

65     /**
66      * Set the web-resource-collection
67      * @param webResourceCollectionList web-resource-collection
68      */

69     public void setWebResourceCollectionList(JLinkedList webResourceCollectionList) {
70         this.webResourceCollectionList = webResourceCollectionList;
71     }
72
73     /**
74      * Add a new web-resource-collection element to this object
75      * @param webResourceCollection web-resource-collection
76      */

77     public void addWebResourceCollection(WebResourceCollection webResourceCollection) {
78         webResourceCollectionList.add(webResourceCollection);
79     }
80
81     /**
82      * Set the auth-constraint
83      * @param authConstraint auth-constraint
84      */

85     public void setAuthConstraint(AuthConstraint authConstraint) {
86         this.authConstraint = authConstraint;
87     }
88
89     /**
90      * Set the user-data-constraint
91      * @param userDataConstraint user-data-constraint
92      */

93     public void setUserDataConstraint(UserDataConstraint userDataConstraint) {
94         this.userDataConstraint = userDataConstraint;
95     }
96
97
98
99
100     // Getters
101

102     /**
103      * Gets the webResourceCollection list
104      * @return the webResourceCollection list
105      */

106     public JLinkedList getWebResourceCollectionList() {
107         return webResourceCollectionList;
108     }
109
110     /**
111      * Gets the authConstraint
112      * @return the authConstraint
113      */

114     public AuthConstraint getAuthConstraint() {
115         return authConstraint;
116     }
117
118     /**
119      * Gets the userDataConstraint
120      * @return the userDataConstraint
121      */

122     public UserDataConstraint getUserDataConstraint() {
123         return userDataConstraint;
124     }
125
126
127     /**
128      * Represents this element by it's XML description.
129      * @param indent use this indent for prexifing XML representation.
130      * @return the XML description of this object.
131      */

132     public String JavaDoc toXML(int indent) {
133         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
134         sb.append(indent(indent));
135         sb.append("<security-constraint>\n");
136
137         indent += 2;
138
139         // web-resource-collection
140
sb.append(webResourceCollectionList.toXML(indent));
141
142         // auth-constraint
143
if (authConstraint != null) {
144             sb.append(authConstraint.toXML(indent));
145         }
146
147         // user-data-constraint
148
if (userDataConstraint != null) {
149             sb.append(userDataConstraint.toXML(indent));
150         }
151
152
153         indent -= 2;
154         sb.append(indent(indent));
155         sb.append("</security-constraint>\n");
156
157         return sb.toString();
158     }
159
160 }
161
Popular Tags