1
2
3
4
5
6
7
8
9 package ca.uhn.cache.internal;
10
11 import ca.uhn.cache.IQuery;
12 import ca.uhn.cache.IQueryResult;
13 import ca.uhn.cache.internal.exception.QueryResultStoreException;
14
15 /***
16 * <p>Responsible for storing <code>IQueryResult</code>s. </p>
17 *
18 * <p>This is not a cache. The underlying implementation might cache internally,
19 * but objects that are stored MUST be retrieved reliably when requested.</p>
20 *
21 * @author <a href="mailto:alexei.guevara@uhn.on.ca">Alexei Guevara</a>
22 * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a>
23 * @author <a href="mailto:laura.bright@uhn.on.ca">Laura Bright</a>
24 *
25 * TODO split insert responsability into two separate method insert and update.
26 * TODO Make insert throw an exception if the item is already in the store.
27 *
28 * @version $Revision: 1.1 $ updated on $Date: 2005/01/24 22:53:27 $ by $Author: bryan_tripp $
29 */
30 public interface IQueryResultStore {
31
32 /***
33 * Stores the given query result.
34 *
35 * @param theQueryResult The <code>IQueryResult</code>.
36 *
37 * @throws QueryResultStoreException If the <b>insert</b> operation could not be successfully completed.
38 */
39 public void insert(IQueryResult theQueryResult) throws QueryResultStoreException;
40
41 /***
42 * Returns the query result from the store that matches the given query.
43 *
44 * @param theQuery The query.
45 * @return The <code>IQueryResult</code> matching the query.
46 *
47 * @throws QueryResultStoreException If the <b>select</b> operation could not be successfully completed.
48 */
49 public IQueryResult select(IQuery theQuery) throws QueryResultStoreException;
50
51 /***
52 * Removes the data matching the specified query from the store.
53 *
54 * @param theQuery The query.
55 * @return The number of data items deleted from the query result store.
56 *
57 * @throws QueryResultStoreException If the <b>delete</b> operation could not be successfully completed.
58 */
59 public int delete( IQuery theQuery ) throws QueryResultStoreException;
60
61 }