KickJava   Java API By Example, From Geeks To Geeks.

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


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: UserDataConstraint.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 user-data-constraint
34  * @author Florent Benoit
35  */

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

41     private JLinkedList descriptionList = null;
42
43     /**
44      * transport-guarantee
45      */

46     private String JavaDoc transportGuarantee = null;
47
48
49     /**
50      * Constructor
51      */

52     public UserDataConstraint() {
53         super();
54         descriptionList = new JLinkedList("description");
55     }
56
57
58     // Setters
59

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

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

72     public void setTransportGuarantee(String JavaDoc transportGuarantee) {
73         this.transportGuarantee = transportGuarantee;
74     }
75
76     // Getters
77

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

82     public JLinkedList getDescriptionList() {
83         return descriptionList;
84     }
85
86     /**
87      * Gets the transport-guarantee
88      * @return the transport-guarantee
89      */

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

99     public String JavaDoc toXML(int indent) {
100         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
101         sb.append(indent(indent));
102         sb.append("<user-data-constraint>\n");
103
104         indent += 2;
105         // description
106
sb.append(descriptionList.toXML(indent));
107
108         // transport-guarantee
109
if (transportGuarantee != null) {
110             sb.append(xmlElement(transportGuarantee, "transport-guarantee", indent));
111         }
112
113         indent -= 2;
114         sb.append(indent(indent));
115         sb.append("</user-data-constraint>\n");
116
117         return sb.toString();
118     }
119
120 }
121
Popular Tags