KickJava   Java API By Example, From Geeks To Geeks.

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


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: AuthConstraint.java,v 1.2 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 auth-constraint
34  * @author Florent Benoit
35  */

36 public class AuthConstraint extends AbsElement {
37
38     /**
39      * description
40      */

41     private JLinkedList descriptionList = null;
42
43     /**
44      * role-name
45      */

46     private JLinkedList roleNameList = null;
47
48
49     /**
50      * Constructor
51      */

52     public AuthConstraint() {
53         super();
54         descriptionList = new JLinkedList("description");
55         roleNameList = new JLinkedList("role-name");
56     }
57
58
59     // Setters
60

61     /**
62      * Add a new description element to this object
63      * @param description description
64      */

65     public void addDescription(String JavaDoc description) {
66         descriptionList.add(description);
67     }
68
69     /**
70      * Add a new role-name element to this object
71      * @param roleName role-name
72      */

73     public void addRoleName(String JavaDoc roleName) {
74         roleNameList.add(roleName);
75     }
76
77     // Getters
78

79     /**
80      * Gets the description list
81      * @return the description list
82      */

83     public JLinkedList getDescriptionList() {
84         return descriptionList;
85     }
86
87     /**
88      * Gets the role-name list
89      * @return the role-name list
90      */

91     public JLinkedList getRoleNameList() {
92         return roleNameList;
93     }
94
95     /**
96      * Represents this element by it's XML description.
97      * @param indent use this indent for prexifing XML representation.
98      * @return the XML description of this object.
99      */

100     public String JavaDoc toXML(int indent) {
101         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
102         sb.append(indent(indent));
103         sb.append("<auth-constraint>\n");
104
105         indent += 2;
106         // description
107
sb.append(descriptionList.toXML(indent));
108
109         // role-name
110
sb.append(roleNameList.toXML(indent));
111
112         indent -= 2;
113         sb.append(indent(indent));
114         sb.append("</auth-constraint>\n");
115
116         return sb.toString();
117     }
118
119 }
120
Popular Tags