KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > medor > eval > prefetch > api > PrefetchCache


1 /**
2  * MEDOR: Middleware Enabling Distributed Object Requests
3  *
4  * Copyright (C) 2001-2003 France Telecom R&D
5  * Contact: alexandre.lefebvre@rd.francetelecom.com
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  *
21  * Initial developers: M. Alia, A. Lefebvre, S. Chassande-Barrioz
22  */

23
24 package org.objectweb.medor.eval.prefetch.api;
25
26 import org.objectweb.medor.api.MedorException;
27 import org.objectweb.medor.tuple.api.Tuple;
28 import org.objectweb.medor.tuple.api.TupleCollection;
29
30 /**
31  * Caches a set of prefetched tuples as long as they are valid within the
32  * connection context within which they have been retrieved.
33  * @author P. Dechamboux
34  */

35 public interface PrefetchCache {
36     /**
37      * Retrieves the prefetched tuple from this cache associated with this
38      * index information, within the given caching context. The prefetched tuple
39      * also belongs to the given object category.
40      * @param index The index that allows the yielded prefetched data item to be
41      * identified into the cache.
42      * @param cat The category (e.g., class) to which the objects, that can be
43      * built using the prefetched data, belong to.
44      * @param ctxt The caching context within which the data has been
45      * prefetched.
46      * @return The prefetched tuple.
47      */

48     Tuple getPrefetchTuple(Object JavaDoc index, Object JavaDoc cat, Object JavaDoc ctxt)
49             throws MedorException;
50
51     /**
52      * Same as getPrefetchTuple, except it returns the TupleCollection.
53      */

54     TupleCollection getPrefetchTupleCollection(Object JavaDoc index, Object JavaDoc cat, Object JavaDoc ctxt)
55     throws MedorException;
56     
57     /**
58      * Invalidates all the prefetched tuples that are associated with the given
59      * caching connection context.
60      * @param ctxt The invalid caching context.
61      */

62     void invalidatePrefetchBuffer(Object JavaDoc ctxt);
63
64     /**
65      * Allocates a prefetched buffer for the object category and the connection
66      * context in order to register prefetched tuples.
67      * @param pbf The factory for creating actual PrefetchBuffer
68      * @param cat The associated object category.
69      * @param ctxt The associated caching context.
70      * @param indexpos The position of the index field within the prefetched
71      * tuples.
72      * @param register if true, call the register method
73      * @return The allocated PrefetchBuffer.
74      */

75     PrefetchBuffer createPrefetchBuffer(PrefetchBufferFactory pbf,
76                                         Object JavaDoc cat,
77                                         Object JavaDoc ctxt,
78                                         int indexpos,
79                                         boolean register)
80             throws MedorException;
81     /**
82      * Allocates a prefetched buffer for the object category and the connection
83      * context in order to register prefetched tuples.
84      * @param pbf The factory for creating actual PrefetchBuffer
85      * @param cat The associated object category.
86      * @param ctxt The associated caching context.
87      * @param indexpos The position of the index field within the prefetched
88      * @param multithread indicates if the context is used by several threads
89      * @param register if true, call the register method
90      * @return The allocated PrefetchBuffer.
91      */

92     PrefetchBuffer createPrefetchBuffer(PrefetchBufferFactory pbf,
93                                         Object JavaDoc cat,
94                                         Object JavaDoc ctxt,
95                                         int indexpos,
96                                         boolean multithread,
97                                         boolean register)
98             throws MedorException;
99     
100     /**
101      * Register the prefetched buffer pb for the object category and the connection
102      * context in order to register prefetched tuples.
103      * @param pbf The PrefetchBuffer to be registered for the object category
104      * @param cat The associated object category.
105      * @param ctxt The associated caching context.
106      * @return true if the registration is done, false else
107      */

108     boolean registerPrefetchBuffer(PrefetchBuffer pb,
109                                         Object JavaDoc cat,
110                                         Object JavaDoc ctxt)
111             throws MedorException;
112 }
113
Popular Tags