KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > deployment > runtime > web > SunWebApp


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.enterprise.deployment.runtime.web;
25
26 import java.beans.*;
27 import java.util.*;
28
29 import com.sun.enterprise.deployment.node.XMLElement;
30
31 import com.sun.enterprise.deployment.runtime.RuntimeDescriptor;
32 import com.sun.enterprise.deployment.runtime.common.EjbRef;
33 import com.sun.enterprise.deployment.runtime.common.ResourceEnvRef;
34 import com.sun.enterprise.deployment.runtime.common.ResourceRef;
35 import com.sun.enterprise.deployment.runtime.common.SecurityRoleMapping;
36
37 // BEGIN_NOI18N
38

39 public class SunWebApp extends WebPropertyContainer
40 {
41     
42     static public final String JavaDoc SECURITY_ROLE_MAPPING = "SecurityRoleMapping"; // NOI18N
43
static public final String JavaDoc SERVLET = "Servlet"; // NOI18N
44
static public final String JavaDoc SESSION_CONFIG = "SessionConfig"; // NOI18N
45
static public final String JavaDoc RESOURCE_ENV_REF = "ResourceEnvRef"; // NOI18N
46
static public final String JavaDoc RESOURCE_REF = "ResourceRef"; // NOI18N
47
static public final String JavaDoc EJB_REF = "EjbRef"; // NOI18N
48
static public final String JavaDoc CACHE = "Cache"; // NOI18N
49
static public final String JavaDoc CLASS_LOADER = "ClassLoader"; // NOI18N
50
static public final String JavaDoc JSP_CONFIG = "JspConfig"; // NOI18N
51
static public final String JavaDoc LOCALE_CHARSET_INFO = "LocaleCharsetInfo"; // NOI18N
52
static public final String JavaDoc PARAMETER_ENCODING = "ParameterEncoding";
53     static public final String JavaDoc FORM_HINT_FIELD = "FormHintField";
54     static public final String JavaDoc DEFAULT_CHARSET = "DefaultCharset";
55     public static final String JavaDoc IDEMPOTENT_URL_PATTERN = "IdempotentUrlPattern";
56     public static final String JavaDoc ERROR_URL = "ErrorUrl";
57     public static final String JavaDoc HTTPSERVLET_SECURITY_PROVIDER = "HttpServletSecurityProvider";
58
59     
60     public SunWebApp()
61     {
62     // set default values
63
setAttributeValue(CACHE, "MaxEntries", "4096");
64     setAttributeValue(CACHE, "TimeoutInSeconds", "30");
65     setAttributeValue(CACHE, "Enabled", "false");
66     }
67     
68     // This attribute is an array, possibly empty
69
public void setSecurityRoleMapping(int index, SecurityRoleMapping value)
70     {
71     this.setValue(SECURITY_ROLE_MAPPING, index, value);
72     }
73     
74     //
75
public SecurityRoleMapping getSecurityRoleMapping(int index)
76     {
77     return (SecurityRoleMapping)this.getValue(SECURITY_ROLE_MAPPING, index);
78     }
79     
80     // This attribute is an array, possibly empty
81
public void setSecurityRoleMapping(SecurityRoleMapping[] value)
82     {
83     this.setValue(SECURITY_ROLE_MAPPING, value);
84     }
85     
86     //
87
public SecurityRoleMapping[] getSecurityRoleMapping()
88     {
89     return (SecurityRoleMapping[])this.getValues(SECURITY_ROLE_MAPPING);
90     }
91     
92     // Return the number of properties
93
public int sizeSecurityRoleMapping()
94     {
95     return this.size(SECURITY_ROLE_MAPPING);
96     }
97     
98     // Add a new element returning its index in the list
99
public int addSecurityRoleMapping(SecurityRoleMapping value)
100     {
101     return this.addValue(SECURITY_ROLE_MAPPING, value);
102     }
103     
104     //
105
// Remove an element using its reference
106
// Returns the index the element had in the list
107
//
108
public int removeSecurityRoleMapping(SecurityRoleMapping value)
109     {
110     return this.removeValue(SECURITY_ROLE_MAPPING, value);
111     }
112     
113     // This attribute is an array, possibly empty
114
public void setServlet(int index, Servlet value)
115     {
116     this.setValue(SERVLET, index, value);
117     }
118     
119     //
120
public Servlet getServlet(int index)
121     {
122     return (Servlet)this.getValue(SERVLET, index);
123     }
124     
125     // This attribute is an array, possibly empty
126
public void setServlet(Servlet[] value)
127     {
128     this.setValue(SERVLET, value);
129     }
130     
131     //
132
public Servlet[] getServlet()
133     {
134     return (Servlet[])this.getValues(SERVLET);
135     }
136     
137     // Return the number of properties
138
public int sizeServlet()
139     {
140     return this.size(SERVLET);
141     }
142     
143     // Add a new element returning its index in the list
144
public int addServlet(Servlet value)
145     {
146     return this.addValue(SERVLET, value);
147     }
148     
149     //
150
// Remove an element using its reference
151
// Returns the index the element had in the list
152
//
153
public int removeServlet(Servlet value)
154     {
155     return this.removeValue(SERVLET, value);
156     }
157     
158     // This attribute is an array, possibly empty
159
public void setIdempotentUrlPattern(int index, IdempotentUrlPattern value)
160     {
161         this.setValue(IDEMPOTENT_URL_PATTERN, index, value);
162     }
163
164     //
165
public IdempotentUrlPattern getIdempotentUrlPattern(int index)
166     {
167         return (IdempotentUrlPattern)this.getValue(IDEMPOTENT_URL_PATTERN, index);
168     }
169
170     // This attribute is an array, possibly empty
171
public void setIdempotentUrlPatterns(IdempotentUrlPattern[] value)
172     {
173         this.setValue(IDEMPOTENT_URL_PATTERN, value);
174     }
175
176     //
177
public IdempotentUrlPattern[] getIdempotentUrlPatterns()
178     {
179         return (IdempotentUrlPattern[])this.getValues(IDEMPOTENT_URL_PATTERN);
180     }
181
182     // Return the number of properties
183
public int sizeIdempotentUrlPattern()
184     {
185         return this.size(IDEMPOTENT_URL_PATTERN);
186     }
187
188     // Add a new element returning its index in the list
189
public int addIdempotentUrlPattern(IdempotentUrlPattern value)
190     {
191         return this.addValue(IDEMPOTENT_URL_PATTERN, value);
192     }
193
194     // Remove an element using its reference
195
// Returns the index the element had in the list
196
//
197
public int removeIdempotentUrlPattern(IdempotentUrlPattern value)
198     {
199         return this.removeValue(IDEMPOTENT_URL_PATTERN, value);
200     }
201
202     // This attribute is optional
203
public void setSessionConfig(SessionConfig value)
204     {
205     this.setValue(SESSION_CONFIG, value);
206     }
207     
208     //
209
public SessionConfig getSessionConfig()
210     {
211     return (SessionConfig)this.getValue(SESSION_CONFIG);
212     }
213     
214     // This attribute is an array, possibly empty
215
public void setResourceEnvRef(int index, ResourceEnvRef value)
216     {
217     this.setValue(RESOURCE_ENV_REF, index, value);
218     }
219     
220     //
221
public ResourceEnvRef getResourceEnvRef(int index)
222     {
223     return (ResourceEnvRef)this.getValue(RESOURCE_ENV_REF, index);
224     }
225     
226     // This attribute is an array, possibly empty
227
public void setResourceEnvRef(ResourceEnvRef[] value)
228     {
229     this.setValue(RESOURCE_ENV_REF, value);
230     }
231     
232     //
233
public ResourceEnvRef[] getResourceEnvRef()
234     {
235     return (ResourceEnvRef[])this.getValues(RESOURCE_ENV_REF);
236     }
237     
238     // Return the number of properties
239
public int sizeResourceEnvRef()
240     {
241     return this.size(RESOURCE_ENV_REF);
242     }
243     
244     // Add a new element returning its index in the list
245
public int addResourceEnvRef(ResourceEnvRef value)
246     {
247     return this.addValue(RESOURCE_ENV_REF, value);
248     }
249     
250     //
251
// Remove an element using its reference
252
// Returns the index the element had in the list
253
//
254
public int removeResourceEnvRef(ResourceEnvRef value)
255     {
256     return this.removeValue(RESOURCE_ENV_REF, value);
257     }
258     
259     // This attribute is an array, possibly empty
260
public void setResourceRef(int index, ResourceRef value)
261     {
262     this.setValue(RESOURCE_REF, index, value);
263     }
264     
265     //
266
public ResourceRef getResourceRef(int index)
267     {
268     return (ResourceRef)this.getValue(RESOURCE_REF, index);
269     }
270     
271     // This attribute is an array, possibly empty
272
public void setResourceRef(ResourceRef[] value)
273     {
274     this.setValue(RESOURCE_REF, value);
275     }
276     
277     //
278
public ResourceRef[] getResourceRef()
279     {
280     return (ResourceRef[])this.getValues(RESOURCE_REF);
281     }
282     
283     // Return the number of properties
284
public int sizeResourceRef()
285     {
286     return this.size(RESOURCE_REF);
287     }
288     
289     // Add a new element returning its index in the list
290
public int addResourceRef(ResourceRef value)
291     {
292     return this.addValue(RESOURCE_REF, value);
293     }
294     
295     //
296
// Remove an element using its reference
297
// Returns the index the element had in the list
298
//
299
public int removeResourceRef(ResourceRef value)
300     {
301     return this.removeValue(RESOURCE_REF, value);
302     }
303     
304     // This attribute is an array, possibly empty
305
public void setEjbRef(int index, EjbRef value)
306     {
307     this.setValue(EJB_REF, index, value);
308     }
309     
310     //
311
public EjbRef getEjbRef(int index)
312     {
313     return (EjbRef)this.getValue(EJB_REF, index);
314     }
315     
316     // This attribute is an array, possibly empty
317
public void setEjbRef(EjbRef[] value)
318     {
319     this.setValue(EJB_REF, value);
320     }
321     
322     //
323
public EjbRef[] getEjbRef()
324     {
325         // this is crazy
326
return (EjbRef[])this.getValues(EJB_REF);
327     }
328     
329     // Return the number of properties
330
public int sizeEjbRef()
331     {
332     return this.size(EJB_REF);
333     }
334     
335     // Add a new element returning its index in the list
336
public int addEjbRef(EjbRef value)
337     {
338     return this.addValue(EJB_REF, value);
339     }
340     
341     //
342
// Remove an element using its reference
343
// Returns the index the element had in the list
344
//
345
public int removeEjbRef(EjbRef value)
346     {
347     return this.removeValue(EJB_REF, value);
348     }
349     
350     // This attribute is optional
351
public void setCache(Cache value)
352     {
353     this.setValue(CACHE, value);
354     }
355     
356     //
357
public Cache getCache()
358     {
359     return (Cache)this.getValue(CACHE);
360     }
361     
362     // This attribute is optional
363
public void setClassLoader(ClassLoader JavaDoc value)
364     {
365         this.setValue(CLASS_LOADER, value);
366     }
367
368     //
369
public ClassLoader JavaDoc getClassLoader()
370     {
371         return (ClassLoader JavaDoc)this.getValue(CLASS_LOADER);
372     }
373
374     
375     // This attribute is optional
376
public void setJspConfig(JspConfig value)
377     {
378     this.setValue(JSP_CONFIG, value);
379     }
380     
381     //
382
public JspConfig getJspConfig()
383     {
384     return (JspConfig)this.getValue(JSP_CONFIG);
385     }
386     
387     // This attribute is optional
388
public void setLocaleCharsetInfo(LocaleCharsetInfo value)
389     {
390     this.setValue(LOCALE_CHARSET_INFO, value);
391     }
392     
393     //
394
public LocaleCharsetInfo getLocaleCharsetInfo()
395     {
396     return (LocaleCharsetInfo)this.getValue(LOCALE_CHARSET_INFO);
397     }
398     
399     // This method verifies that the mandatory properties are set
400
public boolean verify()
401     {
402     return true;
403     }
404
405     // This attribute is optional
406
public void setParameterEncoding(boolean value)
407     {
408         this.setValue(PARAMETER_ENCODING, new Boolean JavaDoc(value));
409     }
410
411     //
412
public boolean isParameterEncoding()
413     {
414         Boolean JavaDoc ret = (Boolean JavaDoc)this.getValue(PARAMETER_ENCODING);
415         if (ret == null) {
416             return false;
417         }
418         return ret.booleanValue();
419     }
420 }
421
Popular Tags