KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > dods > cache > ConfigurationAdministration


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  */

20 package org.enhydra.dods.cache;
21
22 import org.enhydra.dods.statistics.Statistics;
23 import org.enhydra.dods.exceptions.CacheObjectException;
24 import com.lutris.util.Config;
25
26 /**
27  * This interface contains part of caches' (data object (or DataStruct object)
28  * and query) mechanisms needed for cache administration.
29  *
30  * @author Tanja Jovanovic
31  * @author Nenad Vico
32  * @author Zorica Suvajdzin
33  * @version 2.0 15.06.2003.
34  */

35 public abstract class ConfigurationAdministration {
36
37     /**
38      * Returns CacheAdministration for data object (or DataStruct object) cache,
39      * simple, or complex query cache. Object CacheAdministration handles
40      * configuration settings about these caches.
41      * Parameter cacheType can have one of these values:
42      * 0 - for CacheAdministration of data object (or DataStruct object) cache
43      * 1 - for CacheAdministration of simple query cache
44      * 2 - for CacheAdministration of complex query cache
45      *
46      * @param cacheType 0 - for data object (or DataStruct object),
47      * 1 for simple query and 2 for complex query cache.
48      */

49     public abstract CacheAdministration getCacheAdministration(int cacheType);
50
51     /**
52      * Returns initialQueryCache. This attribute contains "where" clause
53      * which is used during data object (or DataStruct object) cache
54      * initialization.
55      *
56      * @return Attribute initialQueryCache.
57      */

58     public abstract String JavaDoc getInitialQueryCache();
59
60     /**
61      * Sets initialQueryCache attribute. This attribute contains "where" clause
62      * which is used during data object (or DataStruct object) cache
63      * initialization.
64      *
65      * @param initQ New value of initialQueryCache attribute.
66      */

67     protected abstract void setInitialQueryCache(String JavaDoc initQ);
68
69     /**
70      * Returns statistics of used table (and of the caches, if exist).
71      *
72      * @return statistics of used table (and of the caches, if exist).
73      */

74     public abstract Statistics getStatistics();
75
76     /**
77      * Refreshes statistics.
78      */

79     public abstract void refreshStatistics();
80
81     /**
82      * Returns information if data object (or DataStruct object) cache if "full".
83      * "Full" cache contains all data objects (or DataStruct objects) from
84      * the table. The cache is "full", if data (or DataStruct) object cache is
85      * unbounded, if the cached table is read-only, and if initialQueryCache
86      * attribute is set to "*".
87      *
88      * @return true if data object (or DataStruct object) cache if "full",
89      * otherwise false.
90      */

91     public abstract void checkFull();
92
93     /**
94      * Returns information if data object (or DataStruct object) cache if "full".
95      * "Full" cache contains all data objects (or DataStruct objects) from
96      * the table. The cache is "full", if data (or DataStruct) object cache is
97      * unbounded, and if initialQueryCache attribute is set to "*".
98      *
99      * @return true if data object (or DataStruct object) cache if "full",
100      * otherwise false.
101      */

102     public abstract boolean isFull();
103
104     /**
105      * Returns data object (or DataStruct object) cache type.
106      * Possible values are:
107      * "none" - no caching available
108      * "lru" - cache with LRU (least-recently used) algorithm
109      * "full" - special case of LRU cache - the whole table is cached
110      *
111      * @return data object (or DataStruct object) cache type.
112      */

113     public abstract String JavaDoc getCacheType();
114
115     /**
116      * Returns caching level.
117      * Possible values:
118      * org.enhydra.dods.cache.CacheConstants.DATA_CACHING (value 1) for
119      * data object (or DataStruct object) caching without query caching, and
120      * org.enhydra.dods.cache.CacheConstants.QUERY_CACHING (value 2) for
121      * data object (or DataStruct object) caching with query caching.
122      *
123      * @return Caching level (1 or 2).
124      */

125     public abstract int getLevelOfCaching();
126
127     /**
128      * Returns object TableConfiguration.
129      * TableConfiguration contains parameters (and their set and get methods)
130      * for table configuration.
131      *
132      * @return TableConfiguration.
133      */

134     public abstract TableConfiguration getTableConfiguration();
135
136     /**
137      * Returns reserveFactor.
138      * reserveFactor attribute is used in query caching. It is percent of how
139      * many more object are taken for evaluation. If <CODE>num</CODE> is number
140      * of needed results, then it is used
141      * <CODE>num</CODE> + DEFAULT_RESERVE_FACTOR * <CODE>num</CODE> of
142      * objects for estimating what is quicker: go to database for all object that
143      * are not in the cache, or run again query on database.
144      * This value is given in percents, as number between 0 and 1
145      * (0.25 means 25%).
146      * For example, if DEFAULT_RESERVE_FACTOR is 0.5, and wanted number of
147      * results is 50, the estimation will be done on 75 (50 + 0.5 * 50) objects.
148      *
149      * @return reserveFactor.
150      */

151     public abstract double getReserveFactor();
152
153     /**
154      * Sets reserveFactor.
155      * reserveFactor attribute is used in query caching. It is percent of how
156      * many more object are taken for evaluation. If <CODE>num</CODE> is number
157      * of needed results, then it is used
158      * <CODE>num</CODE> + DEFAULT_RESERVE_FACTOR * <CODE>num</CODE> of
159      * objects for estimating what is quicker: go to database for all object that
160      * are not in the cache, or run again query on database.
161      * This value is given in percents, as number between 0 and 1
162      * (0.25 means 25%).
163      * For example, if DEFAULT_RESERVE_FACTOR is 0.5, and wanted number of
164      * results is 50, the estimation will be done on 75 (50 + 0.5 * 50) objects.
165      *
166      * @param res New reserveFactor.
167      */

168     protected abstract void setReserveFactor(double res);
169
170     /**
171      * Returns information whether caching is disabled.
172      *
173      * @return true is caching is disabled, otherwise false.
174      */

175     public abstract boolean isDisabled();
176
177     /**
178      * Read cache configuration from application's configuration file.
179      */

180     public abstract double getCachePercentage();
181     
182     protected abstract void setCachePercentage(double cp);
183   
184     
185     /**
186      * @return
187      */

188     public abstract int getInitialCacheFetchSize() ;
189
190     /**
191      * @return
192      */

193     public abstract int getInitialDSCacheSize() ;
194
195     /**
196      * @param i
197      */

198     public abstract void setInitialCacheFetchSize(int i);
199
200
201     /**
202      * @param i
203      */

204     public abstract void setInitialDSCacheSize(int i) ;
205
206
207
208     
209     public abstract void readConfiguration(Config tableConfig, Config cacheConfig, String JavaDoc dbName) throws CacheObjectException;
210 }
211
Popular Tags