KickJava   Java API By Example, From Geeks To Geeks.

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


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: WebResourceCollection.java,v 1.3 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 web-resource-collection
34  * @author Florent Benoit
35  */

36 public class WebResourceCollection extends AbsElement {
37
38     /**
39      * web-resource-name
40      */

41     private String JavaDoc webResourceName = null;
42
43     /**
44      * description
45      */

46     private JLinkedList descriptionList = null;
47
48     /**
49      * url-pattern
50      */

51     private JLinkedList urlPatternList = null;
52
53     /**
54      * http-method
55      */

56     private JLinkedList httpMethodList = null;
57
58     /**
59      * Constructor
60      */

61     public WebResourceCollection() {
62         super();
63         descriptionList = new JLinkedList("description");
64         urlPatternList = new JLinkedList("url-pattern");
65         httpMethodList = new JLinkedList("http-method");
66     }
67
68
69     // Setters
70

71     /**
72      * Set the web-resource-name of this object
73      * @param webResourceName name of this object
74      */

75     public void setWebResourceName(String JavaDoc webResourceName) {
76         this.webResourceName = webResourceName;
77     }
78
79
80     /**
81      * Add a new description element to this object
82      * @param description description
83      */

84     public void addDescription(String JavaDoc description) {
85         descriptionList.add(description);
86     }
87
88     /**
89      * Add a new url-pattern element to this object
90      * @param urlPattern url-pattern
91      */

92     public void addUrlPattern(String JavaDoc urlPattern) {
93         urlPatternList.add(urlPattern);
94     }
95
96     /**
97      * Add a new http-method element to this object
98      * @param httpMethod http-method
99      */

100     public void addHttpMethod(String JavaDoc httpMethod) {
101         httpMethodList.add(httpMethod);
102     }
103
104
105     // Getters
106

107     /**
108      * Gets the web-resource-name
109      * @return the web resource name
110      */

111     public String JavaDoc getWebResourceName() {
112         return webResourceName;
113     }
114
115     /**
116      * Gets the description list
117      * @return the description list
118      */

119     public JLinkedList getDescriptionList() {
120         return descriptionList;
121     }
122
123     /**
124      * Gets the url-pattern list
125      * @return the url-pattern list
126      */

127     public JLinkedList getUrlPatternList() {
128         return urlPatternList;
129     }
130
131     /**
132      * Gets the http-method list
133      * @return the http-method list
134      */

135     public JLinkedList getHttpMethodList() {
136         return httpMethodList;
137     }
138
139     /**
140      * Represents this element by it's XML description.
141      * @param indent use this indent for prexifing XML representation.
142      * @return the XML description of this object.
143      */

144     public String JavaDoc toXML(int indent) {
145         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
146         sb.append(indent(indent));
147         sb.append("<web-resource-collection>\n");
148
149         indent += 2;
150         // web-resource-name
151
if (webResourceName != null) {
152             sb.append(xmlElement(webResourceName, "web-resource-name", indent));
153         }
154
155         // description
156
sb.append(descriptionList.toXML(indent));
157
158         // url-pattern
159
sb.append(urlPatternList.toXML(indent));
160
161         // http-method
162
sb.append(httpMethodList.toXML(indent));
163
164
165         indent -= 2;
166         sb.append(indent(indent));
167         sb.append("</web-resource-collection>\n");
168
169         return sb.toString();
170     }
171
172 }
173
Popular Tags