1 /*
2 * ========================================================================
3 *
4 * Copyright 2003-2005 The Apache Software Foundation.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 *
18 * ========================================================================
19 */
20 package org.apache.cactus.integration.ant.deployment.webapp;
21
22 /**
23 * Represents the various top-level tags in a web deployment descriptor as a
24 * typesafe enumeration.
25 *
26 * @since Cactus 1.5
27 * @version $Id: WebXmlTag.java,v 1.2 2005/02/10 19:51:34 vmassol Exp $
28 */
29 public final class WebXmlTag
30 {
31 // Public Constants --------------------------------------------------------
32
33 /**
34 * Element name 'icon'.
35 */
36 public static final WebXmlTag ICON =
37 new WebXmlTag("icon", false);
38
39 /**
40 * Element name 'display-name'.
41 */
42 public static final WebXmlTag DISPLAY_NAME =
43 new WebXmlTag("display-name", false);
44
45 /**
46 * Element name 'description'.
47 */
48 public static final WebXmlTag DESCRIPTION =
49 new WebXmlTag("description", false);
50
51 /**
52 * Element name 'distributable'.
53 */
54 public static final WebXmlTag DISTRIBUTABLE =
55 new WebXmlTag("distributable", false);
56
57 /**
58 * Element name 'context-param'.
59 */
60 public static final WebXmlTag CONTEXT_PARAM =
61 new WebXmlTag("context-param");
62
63 /**
64 * Element name 'param-name'.
65 */
66 public static final WebXmlTag PARAM_NAME =
67 new WebXmlTag("param-name");
68
69 /**
70 * Element name 'param-value'.
71 */
72 public static final WebXmlTag PARAM_VALUE =
73 new WebXmlTag("param-value");
74
75 /**
76 * Element name 'filter'.
77 */
78 public static final WebXmlTag FILTER =
79 new WebXmlTag("filter");
80
81 /**
82 * Element name 'filter-name'.
83 */
84 public static final WebXmlTag FILTER_NAME =
85 new WebXmlTag("filter-name");
86
87 /**
88 * Element name 'filter-class'.
89 */
90 public static final WebXmlTag FILTER_CLASS =
91 new WebXmlTag("filter-class");
92
93 /**
94 * Element name 'filter-mapping'.
95 */
96 public static final WebXmlTag FILTER_MAPPING =
97 new WebXmlTag("filter-mapping");
98
99 /**
100 * Element name 'init-param'.
101 */
102 public static final WebXmlTag INIT_PARAM =
103 new WebXmlTag("init-param");
104
105 /**
106 * Element name 'listener'.
107 */
108 public static final WebXmlTag LISTENER =
109 new WebXmlTag("listener");
110
111 /**
112 * Element name 'servlet'.
113 */
114 public static final WebXmlTag SERVLET =
115 new WebXmlTag("servlet");
116
117 /**
118 * Element name 'servlet-name'.
119 */
120 public static final WebXmlTag SERVLET_NAME =
121 new WebXmlTag("servlet-name");
122
123 /**
124 * Element name 'jsp-file'.
125 */
126 public static final WebXmlTag JSP_FILE =
127 new WebXmlTag("jsp-file");
128
129 /**
130 * Element name 'servlet-class'.
131 */
132 public static final WebXmlTag SERVLET_CLASS =
133 new WebXmlTag("servlet-class");
134
135 /**
136 * Element name 'load-on-startup'.
137 */
138 public static final WebXmlTag LOAD_ON_STARTUP =
139 new WebXmlTag("load-on-startup");
140
141 /**
142 * Element name 'run-as'.
143 */
144 public static final WebXmlTag RUN_AS =
145 new WebXmlTag("run-as");
146
147 /**
148 * Element name 'servlet-mapping'.
149 */
150 public static final WebXmlTag SERVLET_MAPPING =
151 new WebXmlTag("servlet-mapping");
152
153 /**
154 * Element name 'url-pattern'.
155 */
156 public static final WebXmlTag URL_PATTERN =
157 new WebXmlTag("url-pattern");
158
159 /**
160 * Element name 'session-config'.
161 */
162 public static final WebXmlTag SESSION_CONFIG =
163 new WebXmlTag("session-config", false);
164
165 /**
166 * Element name 'mime-mapping'.
167 */
168 public static final WebXmlTag MIME_MAPPING =
169 new WebXmlTag("mime-mapping");
170
171 /**
172 * Element name 'welcome-file-list'.
173 */
174 public static final WebXmlTag WELCOME_FILE_LIST =
175 new WebXmlTag("welcome-file-list", false);
176
177 /**
178 * Element name 'error-page'.
179 */
180 public static final WebXmlTag ERROR_PAGE =
181 new WebXmlTag("error-page");
182
183 /**
184 * Element name 'taglib'.
185 */
186 public static final WebXmlTag TAGLIB =
187 new WebXmlTag("taglib");
188
189 /**
190 * Element name 'resource-env-ref'.
191 */
192 public static final WebXmlTag RESOURCE_ENV_REF =
193 new WebXmlTag("resource-env-ref");
194
195 /**
196 * Element name 'resource-ref'.
197 */
198 public static final WebXmlTag RESOURCE_REF =
199 new WebXmlTag("resource-ref");
200
201 /**
202 * Element name 'security-constraint'.
203 */
204 public static final WebXmlTag SECURITY_CONSTRAINT =
205 new WebXmlTag("security-constraint");
206
207 /**
208 * Element name 'web-resource-collection'.
209 */
210 public static final WebXmlTag WEB_RESOURCE_COLLECTION =
211 new WebXmlTag("web-resource-collection");
212
213 /**
214 * Element name 'web-resource-name'.
215 */
216 public static final WebXmlTag WEB_RESOURCE_NAME =
217 new WebXmlTag("web-resource-name");
218
219 /**
220 * Element name 'auth-constraint'.
221 */
222 public static final WebXmlTag AUTH_CONSTRAINT =
223 new WebXmlTag("auth-constraint");
224
225 /**
226 * Element name 'login-config'.
227 */
228 public static final WebXmlTag LOGIN_CONFIG =
229 new WebXmlTag("login-config", false);
230
231 /**
232 * Element name 'auth-method'.
233 */
234 public static final WebXmlTag AUTH_METHOD =
235 new WebXmlTag("auth-method");
236
237 /**
238 * Element name 'realm-name'.
239 */
240 public static final WebXmlTag REALM_NAME =
241 new WebXmlTag("realm-name");
242
243 /**
244 * Element name 'security-role'.
245 */
246 public static final WebXmlTag SECURITY_ROLE =
247 new WebXmlTag("security-role");
248
249 /**
250 * Element name 'role-name'.
251 */
252 public static final WebXmlTag ROLE_NAME =
253 new WebXmlTag("role-name");
254
255 /**
256 * Element name 'env-entry'.
257 */
258 public static final WebXmlTag ENV_ENTRY =
259 new WebXmlTag("env-entry");
260
261 /**
262 * Element name 'ejb-ref'.
263 */
264 public static final WebXmlTag EJB_REF =
265 new WebXmlTag("ejb-ref");
266
267 /**
268 * Element name 'ejb-local-ref'.
269 */
270 public static final WebXmlTag EJB_LOCAL_REF =
271 new WebXmlTag("ejb-local-ref");
272
273 // Instance Variables ------------------------------------------------------
274
275 /**
276 * The tag name,
277 */
278 private String tagName;
279
280 /**
281 * Whether multiple occurrences of the tag in the descriptor are allowed.
282 */
283 private boolean multipleAllowed;
284
285 // Constructors ------------------------------------------------------------
286
287 /**
288 * Constructor.
289 *
290 * @param theTagName The tag name of the element
291 * @param isMultipleAllowed Whether the element may occur multiple times in
292 * the descriptor
293 */
294 private WebXmlTag(String theTagName, boolean isMultipleAllowed)
295 {
296 this.tagName = theTagName;
297 this.multipleAllowed = isMultipleAllowed;
298 }
299
300 /**
301 * Constructor.
302 *
303 * @param theTagName The tag name of the element
304 */
305 private WebXmlTag(String theTagName)
306 {
307 this(theTagName, true);
308 }
309
310 // Public Methods ----------------------------------------------------------
311
312 /**
313 * @see java.lang.Object#toString
314 */
315 public boolean equals(Object theOther)
316 {
317 return super.equals(theOther);
318 }
319
320 /**
321 * @see java.lang.Object#hashCode
322 */
323 public int hashCode()
324 {
325 return super.hashCode();
326 }
327
328 /**
329 * Returns the tag name.
330 *
331 * @return The tag name
332 */
333 public String getTagName()
334 {
335 return this.tagName;
336 }
337
338 /**
339 * Returns whether the tag may occur multiple times in the descriptor.
340 *
341 * @return Whether multiple occurrences are allowed
342 */
343 public boolean isMultipleAllowed()
344 {
345 return this.multipleAllowed;
346 }
347
348 /**
349 * @see java.lang.Object#toString
350 */
351 public String toString()
352 {
353 return getTagName();
354 }
355
356 }