001: /**
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 2004 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or 1any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * Initial developer: Florent BENOIT
022: * --------------------------------------------------------------------------
023: * $Id: SecurityConstraint.java 4799 2004-05-25 14:26:36Z sauthieg $
024: * --------------------------------------------------------------------------
025: */package org.objectweb.jonas_web.deployment.xml;
026:
027: import org.objectweb.jonas_lib.deployment.xml.AbsElement;
028: import org.objectweb.jonas_lib.deployment.xml.JLinkedList;
029:
030: /**
031: * This class defines the implementation of the element security-constraint
032: * @author Florent Benoit
033: */
034: public class SecurityConstraint extends AbsElement {
035:
036: /**
037: * web-resource-collection
038: */
039: private JLinkedList webResourceCollectionList = null;
040:
041: /**
042: * auth-constraint
043: */
044: private AuthConstraint authConstraint = null;
045:
046: /**
047: * user-data-constraint
048: */
049: private UserDataConstraint userDataConstraint = null;
050:
051: /**
052: * Constructor
053: */
054: public SecurityConstraint() {
055: super ();
056: webResourceCollectionList = new JLinkedList(
057: "web-resource-collection");
058: }
059:
060: // Setters
061:
062: /**
063: * Set the web-resource-collection
064: * @param webResourceCollectionList web-resource-collection
065: */
066: public void setWebResourceCollectionList(
067: JLinkedList webResourceCollectionList) {
068: this .webResourceCollectionList = webResourceCollectionList;
069: }
070:
071: /**
072: * Add a new web-resource-collection element to this object
073: * @param webResourceCollection web-resource-collection
074: */
075: public void addWebResourceCollection(
076: WebResourceCollection webResourceCollection) {
077: webResourceCollectionList.add(webResourceCollection);
078: }
079:
080: /**
081: * Set the auth-constraint
082: * @param authConstraint auth-constraint
083: */
084: public void setAuthConstraint(AuthConstraint authConstraint) {
085: this .authConstraint = authConstraint;
086: }
087:
088: /**
089: * Set the user-data-constraint
090: * @param userDataConstraint user-data-constraint
091: */
092: public void setUserDataConstraint(
093: UserDataConstraint userDataConstraint) {
094: this .userDataConstraint = userDataConstraint;
095: }
096:
097: // Getters
098:
099: /**
100: * Gets the webResourceCollection list
101: * @return the webResourceCollection list
102: */
103: public JLinkedList getWebResourceCollectionList() {
104: return webResourceCollectionList;
105: }
106:
107: /**
108: * Gets the authConstraint
109: * @return the authConstraint
110: */
111: public AuthConstraint getAuthConstraint() {
112: return authConstraint;
113: }
114:
115: /**
116: * Gets the userDataConstraint
117: * @return the userDataConstraint
118: */
119: public UserDataConstraint getUserDataConstraint() {
120: return userDataConstraint;
121: }
122:
123: /**
124: * Represents this element by it's XML description.
125: * @param indent use this indent for prexifing XML representation.
126: * @return the XML description of this object.
127: */
128: public String toXML(int indent) {
129: StringBuffer sb = new StringBuffer();
130: sb.append(indent(indent));
131: sb.append("<security-constraint>\n");
132:
133: indent += 2;
134:
135: // web-resource-collection
136: sb.append(webResourceCollectionList.toXML(indent));
137:
138: // auth-constraint
139: if (authConstraint != null) {
140: sb.append(authConstraint.toXML(indent));
141: }
142:
143: // user-data-constraint
144: if (userDataConstraint != null) {
145: sb.append(userDataConstraint.toXML(indent));
146: }
147:
148: indent -= 2;
149: sb.append(indent(indent));
150: sb.append("</security-constraint>\n");
151:
152: return sb.toString();
153: }
154:
155: }
|