KickJava   Java API By Example, From Geeks To Geeks.

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


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 Cache extends WebPropertyContainer
36 {
37     
38     static public final String JavaDoc CACHE_HELPER = "CacheHelper"; // NOI18N
39
static public final String JavaDoc DEFAULT_HELPER = "DefaultHelper"; // NOI18N
40
static public final String JavaDoc PROPERTY = "WebProperty"; // NOI18N
41
static public final String JavaDoc CACHE_MAPPING = "CacheMapping"; // NOI18N
42
static public final String JavaDoc MAX_ENTRIES = "MaxEntries";
43     static public final String JavaDoc TIMEOUT_IN_SECONDS = "TimeoutInSeconds";
44     static public final String JavaDoc ENABLED = "Enabled";
45     
46     public Cache() {
47     
48         // set default values
49
setAttributeValue("MaxEntries", "4096");
50     setAttributeValue("TimeoutInSeconds", "30");
51     }
52     
53     // This attribute is an array, possibly empty
54
public void setCacheHelper(int index, CacheHelper value)
55     {
56     setValue(CACHE_HELPER, index, value);
57     }
58     
59     //
60
public CacheHelper getCacheHelper(int index)
61     {
62     return (CacheHelper)getValue(CACHE_HELPER, index);
63     }
64     
65     // This attribute is an array, possibly empty
66
public void setCacheHelper(CacheHelper[] value)
67     {
68     setValue(CACHE_HELPER, value);
69     }
70     
71     //
72
public CacheHelper[] getCacheHelper()
73     {
74     return (CacheHelper[])getValues(CACHE_HELPER);
75     }
76     
77     // Return the number of properties
78
public int sizeCacheHelper()
79     {
80     return size(CACHE_HELPER);
81     }
82     
83     // Add a new element returning its index in the list
84
public int addCacheHelper(CacheHelper value)
85     {
86     return addValue(CACHE_HELPER, value);
87     }
88     
89     // Add a new element returning its index in the list
90
public void addNewCacheHelper(CacheHelper value)
91     {
92     addCacheHelper(value);
93     }
94     
95     //
96
// Remove an element using its reference
97
// Returns the index the element had in the list
98
//
99
public int removeCacheHelper(CacheHelper value)
100     {
101     return removeValue(CACHE_HELPER, value);
102     }
103     
104     // This attribute is optional
105
public void setDefaultHelper(DefaultHelper value)
106     {
107     setValue(DEFAULT_HELPER, value);
108     }
109     
110     //
111
public DefaultHelper getDefaultHelper()
112     {
113     return (DefaultHelper)getValue(DEFAULT_HELPER);
114     }
115     
116     // This attribute is an array, possibly empty
117
public void setCacheMapping(int index, CacheMapping value)
118     {
119     setValue(CACHE_MAPPING, index, value);
120     }
121     
122     //
123
public CacheMapping getCacheMapping(int index)
124     {
125     return (CacheMapping)getValue(CACHE_MAPPING, index);
126     }
127     
128     // This attribute is an array, possibly empty
129
public void setCacheMapping(CacheMapping[] value)
130     {
131     setValue(CACHE_MAPPING, value);
132     }
133     
134     //
135
public CacheMapping[] getCacheMapping()
136     {
137     return (CacheMapping[])getValues(CACHE_MAPPING);
138     }
139     
140     // Return the number of properties
141
public int sizeCacheMapping()
142     {
143     return size(CACHE_MAPPING);
144     }
145     
146     // Add a new element returning its index in the list
147
public int addCacheMapping(CacheMapping value)
148     {
149     return addValue(CACHE_MAPPING, value);
150     }
151     
152     // Add a new element returning its index in the list
153
public void addNewCacheMapping(CacheMapping value)
154     {
155     addCacheMapping(value);
156     }
157     
158     //
159
// Remove an element using its reference
160
// Returns the index the element had in the list
161
//
162
public int removeCacheMapping(CacheMapping value)
163     {
164     return removeValue(CACHE_MAPPING, value);
165     }
166     
167     // This method verifies that the mandatory properties are set
168
public boolean verify()
169     {
170     return true;
171     }
172     
173 }
174
Popular Tags