KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.Vector JavaDoc;
23
24 /**
25  * This abstract class contains data and mechanisms needed for caching data
26  * objects (or DataStruct objects) and queries and provides cache configuration
27  * and administration.
28  *
29  * @author Tanja Jovanovic
30  * @author Sinisa Milosevic
31  * @version 1.0 05.08.2003.
32  */

33 public abstract class TransactionQueryCache extends DOCache {
34
35     /**
36      * Creates new QueryCacheItem instance.
37      *
38      * @param dbName Database name.
39      * @return Created QueryCacheItem.
40      */

41     public abstract QueryCacheItem newQueryCacheItemInstance(String JavaDoc dbName);
42
43     /**
44      * Returns QueryCacheItem object for specified database and simple query,
45      * if exists, otherwise null.
46      *
47      * @param dbName Database name.
48      * @param query Query in form of String.
49      * @return QueryCacheItem object.
50      */

51     public abstract QueryCacheItem getSimpleQueryCacheItem(String JavaDoc dbName, String JavaDoc query);
52
53     /**
54      * Returns QueryCacheItem object for specified database and complex query,
55      * if exists, otherwise null.
56      *
57      * @param dbName Database name.
58      * @param query Query in form of String.
59      * @return QueryCacheItem object.
60      */

61     public abstract QueryCacheItem getComplexQueryCacheItem(String JavaDoc dbName, String JavaDoc query);
62
63     /**
64      * Adds simple query to simple query cache.
65      *
66      * @param queryItem Query that will be added to simple query cache.
67      * @return Query added to simple query cache.
68      */

69     public abstract QueryCacheItem addSimpleQuery(QueryCacheItem queryItem);
70
71     /**
72      * Removes simple query from simple query cache.
73      *
74      * @param queryItem QueryItem that will be removed from simple query cache.
75      * @return QueryItem removed from simple query cache.
76      */

77     public abstract QueryCacheItem removeSimpleQuery(QueryCacheItem queryItem);
78
79     /**
80      * Adds complex query to complex query cache.
81      *
82      * @param queryItem Query that will be added to complex query cache.
83      * @return Query added to complex query cache.
84      */

85     public abstract QueryCacheItem addComplexQuery(QueryCacheItem queryItem);
86
87     /**
88      * Removes complex query from complex query cache.
89      *
90      * @param queryItem Query that will be removed from complex query cache.
91      * @return Query removed from complex query cache.
92      */

93     public abstract QueryCacheItem removeComplexQuery(QueryCacheItem queryItem);
94
95     /**
96      * Returns query results from simple query cache.
97      *
98      * @param dbName Database name.
99      * @param query Query for which are results searched in simple query cache.
100      * @return Query results retrieved from simple cache, or null, if there are
101      * no results retrieved from simple query cache.
102      */

103     public abstract QueryResult getSimpleQueryResults(String JavaDoc dbName, String JavaDoc query);
104
105     /**
106      * Returns query results from simple query cache.
107      *
108      * @param dbName Database name.
109      * @param query Query for which are results searched in simple query cache.
110      * @param limit Specified number of results (database limit and read skip).
111      * @param maxdb Number of rows retrieved from database (or cache).
112      * @return Query results retrieved from simple cache, or null, if there are
113      * no results retrieved from simple query cache.
114      */

115     public abstract QueryResult getSimpleQueryResults(String JavaDoc dbName, String JavaDoc query, int limit, int maxdb);
116
117     /**
118      * Returns query results from simple query cache.
119      *
120      * @param dbName Database name.
121      * @param query Query for which are results searched in simple query cache.
122      * @param limit Specified number of results (database limit and read skip).
123      * @param maxdb Number of rows retrieved from database (or cache).
124      * @param unique If true, only unique results are returned.
125      * @return Query results retrieved from simple cache, or null, if there are
126      * no results retrieved from simple query cache.
127      */

128     public abstract QueryResult getSimpleQueryResults(String JavaDoc dbName, String JavaDoc query, int limit, int maxdb, boolean unique);
129
130     /**
131      * Returns query results from complex query cache.
132      *
133      * @param dbName Database name.
134      * @param query Query for which are results searched in complex query cache.
135      * @return Query results retrieved from complex cache, or null, if there are
136      * no results retrieved from complex query cache.
137      */

138     public abstract QueryResult getComplexQueryResults(String JavaDoc dbName, String JavaDoc query);
139
140     /**
141      * Returns query results from complex query cache.
142      *
143      * @param dbName Database name.
144      * @param query Query for which are results searched in complex query cache.
145      * @param limit Specified number of results (database limit and read skip).
146      * @param maxdb Number of rows retrieved from database (or cache).
147      * @return Query results retrieved from complex cache, or null, if there are
148      * no results retrieved from complex query cache.
149      */

150     public abstract QueryResult getComplexQueryResults(String JavaDoc dbName, String JavaDoc query, int limit, int maxdb);
151
152     /**
153      * Returns query results from complex query cache.
154      *
155      * @param dbName Database name.
156      * @param query Query for which are results searched in complex query cache.
157      * @param limit Specified number of results (database limit and read skip).
158      * @param maxdb Number of rows retrieved from database (or cache).
159      * @param unique If true, only unique results are returned.
160      * @return Query results retrieved from complex cache, or null, if there are
161      * no results retrieved from complex query cache.
162      */

163     public abstract QueryResult getComplexQueryResults(String JavaDoc dbName, String JavaDoc query, int limit, int maxdb, boolean unique);
164
165     /**
166      * Returns query results from simple or complex query cache.
167      *
168      * @param dbName Database name.
169      * @param query Query for which are results searched in simple and complex
170      * query cache.
171      * @return Query results retrieved from simple or complex cache, or null,
172      * if there are no results retrieved from simple and complex query cache.
173      */

174     public abstract QueryResult getQueryResults(String JavaDoc dbName, String JavaDoc query);
175     
176     /**
177      *
178      */

179     public abstract void removeEntries(Vector JavaDoc vec);
180
181     /**
182      *
183      * @param tableClass -
184      */

185     public abstract void removeEntries(Class JavaDoc tableClass);
186
187     /**
188      *
189      */

190     public abstract void emptyEntries(Vector JavaDoc vec, boolean incrementVersion);
191     
192     /**
193      * Dumps data structs for all instances of tableClass in transaction
194      * cache.
195      *
196      * @param tableClass - Class object whose instances will be emptied
197      */

198     public abstract void emptyEntries(Class JavaDoc tableClass) ;
199     
200 }
201
Popular Tags