KickJava   Java API By Example, From Geeks To Geeks.

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


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 com.sun.enterprise.deployment.runtime.RuntimeDescriptor;
27
28 /**
29 * this class contains runtime information for the web bundle
30 * it was kept to be backward compatible with the schema2beans descriptors
31 * generated by iAS 7.0 engineering team.
32 *
33 * @author Jerome Dochez
34 */

35 public class CacheMapping extends RuntimeDescriptor
36 {
37     
38     static public final String JavaDoc SERVLET_NAME = "ServletName"; // NOI18N
39
static public final String JavaDoc URL_PATTERN = "UrlPattern"; // NOI18N
40
static public final String JavaDoc CACHE_HELPER_REF = "CacheHelperRef"; // NOI18N
41
static public final String JavaDoc TIMEOUT = "Timeout"; // NOI18N
42
static public final String JavaDoc NAME = "Name";
43     static public final String JavaDoc SCOPE = "Scope";
44     static public final String JavaDoc REFRESH_FIELD = "RefreshField"; // NOI18N
45
static public final String JavaDoc HTTP_METHOD = "HttpMethod"; // NOI18N
46
static public final String JavaDoc DISPATCHER = "Dispatcher"; // NOI18N
47
static public final String JavaDoc KEY_FIELD = "KeyField"; // NOI18N
48
static public final String JavaDoc CONSTRAINT_FIELD = "ConstraintField"; // NOI18N
49

50     public CacheMapping(CacheMapping other) {
51     super(other);
52     }
53
54     public CacheMapping() {
55     setAttributeValue(KEY_FIELD, SCOPE, "request.parameter");
56     setAttributeValue(REFRESH_FIELD, SCOPE, "request.parameter");
57     }
58     
59     // This attribute is mandatory
60
public void setServletName(String JavaDoc value)
61     {
62     this.setValue(SERVLET_NAME, value);
63     }
64     
65     //
66
public String JavaDoc getServletName()
67     {
68     return (String JavaDoc)this.getValue(SERVLET_NAME);
69     }
70     
71     // This attribute is mandatory
72
public void setUrlPattern(String JavaDoc value)
73     {
74     this.setValue(URL_PATTERN, value);
75     }
76     
77     //
78
public String JavaDoc getUrlPattern()
79     {
80     return (String JavaDoc)this.getValue(URL_PATTERN);
81     }
82     
83     // This attribute is mandatory
84
public void setCacheHelperRef(String JavaDoc value)
85     {
86     this.setValue(CACHE_HELPER_REF, value);
87     }
88     
89     //
90
public String JavaDoc getCacheHelperRef()
91     {
92     return (String JavaDoc)this.getValue(CACHE_HELPER_REF);
93     }
94     
95     // This attribute is optional
96
public void setTimeout(String JavaDoc value)
97     {
98     this.setValue(TIMEOUT, value);
99     }
100     
101     //
102
public String JavaDoc getTimeout()
103     {
104     return (String JavaDoc)this.getValue(TIMEOUT);
105     }
106     
107     // This attribute is optional
108
public void setRefreshField(boolean value)
109     {
110     this.setValue(REFRESH_FIELD, new Boolean JavaDoc(value));
111     }
112     
113     //
114
public boolean isRefreshField()
115     {
116     Boolean JavaDoc ret = (Boolean JavaDoc)this.getValue(REFRESH_FIELD);
117     if (ret == null)
118         return false;
119     return ret.booleanValue();
120     }
121
122     
123     // This attribute is an array, possibly empty
124
public void setDispatcher(int index, String JavaDoc value)
125     {
126     this.setValue(DISPATCHER, index, value);
127     }
128     
129     //
130
public String JavaDoc getDispatcher(int index)
131     {
132     return (String JavaDoc)this.getValue(DISPATCHER, index);
133     }
134     
135     // This attribute is an array, possibly empty
136
public void setDispatcher(String JavaDoc[] value)
137     {
138     this.setValue(DISPATCHER, value);
139     }
140     
141     //
142
public String JavaDoc[] getDispatcher()
143     {
144     return (String JavaDoc[])this.getValues(DISPATCHER);
145     }
146     
147     // Return the number of properties
148
public int sizeDispatcher()
149     {
150     return this.size(DISPATCHER);
151     }
152     
153     // Add a new element returning its index in the list
154
public int addDispatcher(String JavaDoc value)
155     {
156     return this.addValue(DISPATCHER, value);
157     }
158
159     // Add a new element returning its index in the list
160
public void addNewDispatcher(String JavaDoc value)
161     {
162     addValue(DISPATCHER, value);
163     }
164     
165     //
166
// Remove an element using its reference
167
// Returns the index the element had in the list
168
//
169
public int removeDispatcher(String JavaDoc value)
170     {
171     return this.removeValue(DISPATCHER, value);
172     }
173     
174     
175     // This attribute is an array, possibly empty
176
public void setHttpMethod(int index, String JavaDoc value)
177     {
178     this.setValue(HTTP_METHOD, index, value);
179     }
180     
181     //
182
public String JavaDoc getHttpMethod(int index)
183     {
184     return (String JavaDoc)this.getValue(HTTP_METHOD, index);
185     }
186     
187     // This attribute is an array, possibly empty
188
public void setHttpMethod(String JavaDoc[] value)
189     {
190     this.setValue(HTTP_METHOD, value);
191     }
192     
193     //
194
public String JavaDoc[] getHttpMethod()
195     {
196     return (String JavaDoc[])this.getValues(HTTP_METHOD);
197     }
198     
199     // Return the number of properties
200
public int sizeHttpMethod()
201     {
202     return this.size(HTTP_METHOD);
203     }
204     
205     // Add a new element returning its index in the list
206
public int addHttpMethod(String JavaDoc value)
207     {
208     return this.addValue(HTTP_METHOD, value);
209     }
210     // Add a new element returning its index in the list
211
public void addNewHttpMethod(String JavaDoc value)
212     {
213     addValue(HTTP_METHOD, value);
214     }
215     
216     //
217
// Remove an element using its reference
218
// Returns the index the element had in the list
219
//
220
public int removeHttpMethod(String JavaDoc value)
221     {
222     return this.removeValue(HTTP_METHOD, value);
223     }
224     
225     // This attribute is an array, possibly empty
226
public void setKeyField(int index, boolean value)
227     {
228     this.setValue(KEY_FIELD, index, new Boolean JavaDoc(value));
229     }
230     
231     //
232
public boolean isKeyField(int index)
233     {
234     Boolean JavaDoc ret = (Boolean JavaDoc)this.getValue(KEY_FIELD, index);
235     if (ret == null)
236         return false;
237     return ret.booleanValue();
238     }
239     
240     // This attribute is an array, possibly empty
241
public void setKeyField(boolean[] value)
242     {
243     Boolean JavaDoc[] values = null;
244     if (value != null)
245     {
246         values = new Boolean JavaDoc[value.length];
247         for (int i=0; i<value.length; i++)
248         values[i] = new Boolean JavaDoc(value[i]);
249     }
250     this.setValue(KEY_FIELD, values);
251     }
252     
253     //
254
public boolean[] getKeyField()
255     {
256     boolean[] ret = null;
257     Boolean JavaDoc[] values = (Boolean JavaDoc[])this.getValues(KEY_FIELD);
258     if (values != null)
259     {
260         ret = new boolean[values.length];
261         for (int i=0; i<values.length; i++)
262         ret[i] = values[i].booleanValue();
263     }
264     return ret;
265     }
266     
267     // Return the number of properties
268
public int sizeKeyField()
269     {
270     return this.size(KEY_FIELD);
271     }
272     
273     // Add a new element returning its index in the list
274
public int addKeyField(boolean value)
275     {
276     return this.addValue(KEY_FIELD, new Boolean JavaDoc(value));
277     }
278     
279     //
280
// Remove an element using its reference
281
// Returns the index the element had in the list
282
//
283
public int removeKeyField(boolean value)
284     {
285     return this.removeValue(KEY_FIELD, new Boolean JavaDoc(value));
286     }
287     
288     //
289
// Remove an element using its index
290
//
291
public void removeKeyField(int index)
292     {
293     this.removeValue(KEY_FIELD, index);
294     }
295     
296     // This attribute is an array, possibly empty
297
public void setConstraintField(int index, ConstraintField value)
298     {
299     this.setValue(CONSTRAINT_FIELD, index, value);
300     }
301     
302     //
303
public ConstraintField getConstraintField(int index)
304     {
305     return (ConstraintField)this.getValue(CONSTRAINT_FIELD, index);
306     }
307     
308     // This attribute is an array, possibly empty
309
public void setConstraintField(ConstraintField[] value)
310     {
311     this.setValue(CONSTRAINT_FIELD, value);
312     }
313     
314     //
315
public ConstraintField[] getConstraintField()
316     {
317     return (ConstraintField[])this.getValues(CONSTRAINT_FIELD);
318     }
319     
320     // Return the number of properties
321
public int sizeConstraintField()
322     {
323     return this.size(CONSTRAINT_FIELD);
324     }
325     
326     // Add a new element returning its index in the list
327
public int addConstraintField(ConstraintField value)
328     {
329     return this.addValue(CONSTRAINT_FIELD, value);
330     }
331     
332     // Add a new element returning its index in the list
333
public void addNewConstraintField(ConstraintField value)
334     {
335     this.addValue(CONSTRAINT_FIELD, value);
336     }
337     
338     //
339
// Remove an element using its reference
340
// Returns the index the element had in the list
341
//
342
public int removeConstraintField(ConstraintField value)
343     {
344     return this.removeValue(CONSTRAINT_FIELD, value);
345     }
346     
347     // This method verifies that the mandatory properties are set
348
public boolean verify()
349     {
350     return true;
351     }
352     
353 }
354
Popular Tags