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: AuthConstraint.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 auth-constraint
032: * @author Florent Benoit
033: */
034: public class AuthConstraint extends AbsElement {
035:
036: /**
037: * description
038: */
039: private JLinkedList descriptionList = null;
040:
041: /**
042: * role-name
043: */
044: private JLinkedList roleNameList = null;
045:
046: /**
047: * Constructor
048: */
049: public AuthConstraint() {
050: super ();
051: descriptionList = new JLinkedList("description");
052: roleNameList = new JLinkedList("role-name");
053: }
054:
055: // Setters
056:
057: /**
058: * Add a new description element to this object
059: * @param description description
060: */
061: public void addDescription(String description) {
062: descriptionList.add(description);
063: }
064:
065: /**
066: * Add a new role-name element to this object
067: * @param roleName role-name
068: */
069: public void addRoleName(String roleName) {
070: roleNameList.add(roleName);
071: }
072:
073: // Getters
074:
075: /**
076: * Gets the description list
077: * @return the description list
078: */
079: public JLinkedList getDescriptionList() {
080: return descriptionList;
081: }
082:
083: /**
084: * Gets the role-name list
085: * @return the role-name list
086: */
087: public JLinkedList getRoleNameList() {
088: return roleNameList;
089: }
090:
091: /**
092: * Represents this element by it's XML description.
093: * @param indent use this indent for prexifing XML representation.
094: * @return the XML description of this object.
095: */
096: public String toXML(int indent) {
097: StringBuffer sb = new StringBuffer();
098: sb.append(indent(indent));
099: sb.append("<auth-constraint>\n");
100:
101: indent += 2;
102: // description
103: sb.append(descriptionList.toXML(indent));
104:
105: // role-name
106: sb.append(roleNameList.toXML(indent));
107:
108: indent -= 2;
109: sb.append(indent(indent));
110: sb.append("</auth-constraint>\n");
111:
112: return sb.toString();
113: }
114:
115: }
|