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