KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > jdo > datastore > DataStoreCache


1 /*
2  * Copyright 2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 /*
18  * DataStoreCache.java
19  *
20  */

21  
22 package javax.jdo.datastore;
23
24 import java.util.Collection JavaDoc;
25
26
27 /**
28  * Many JDO implementations allow instances to be cached in a
29  * second-level cache, and allow direct management of the cache by
30  * knowledgeable applications. This interface standardizes this
31  * behavior.
32  * @since 2.0
33  * @version 2.0
34  */

35 public interface DataStoreCache {
36
37     /** Evict the parameter instance from the second-level cache.
38      * @param oid the object id of the instance to evict.
39      * @since 2.0
40      */

41     void evict (Object JavaDoc oid);
42
43     /** Evict the parameter instances from the second-level cache.
44      * All instances in the PersistenceManager's cache are evicted
45      * from the second-level cache.
46      * @since 2.0
47      */

48     void evictAll ();
49
50     /** Evict the parameter instances from the second-level cache.
51      * @param oids the object ids of the instance to evict.
52      * @since 2.0
53      */

54     void evictAll (Object JavaDoc[] oids);
55
56     /** Evict the parameter instances from the second-level cache.
57      * @param oids the object ids of the instance to evict.
58      * @since 2.0
59      */

60     void evictAll (Collection JavaDoc oids);
61
62     /** Evict the parameter instances from the second-level cache.
63      * @param pcClass the class of instances to evict
64      * @param subclasses if true, evict instances of subclasses also
65      * @since 2.0
66      */

67     void evictAll (Class JavaDoc pcClass, boolean subclasses);
68
69     /** Pin the parameter instance in the second-level cache.
70      * @param oid the object id of the instance to pin.
71      * @since 2.0
72      */

73     void pin (Object JavaDoc oid);
74
75     /** Pin the parameter instances in the second-level cache.
76      * @param oids the object ids of the instances to pin.
77      * @since 2.0
78      */

79     void pinAll (Collection JavaDoc oids);
80
81     /** Pin the parameter instances in the second-level cache.
82      * @param oids the object ids of the instances to pin.
83      * @since 2.0
84      */

85     void pinAll (Object JavaDoc[] oids);
86
87     /** Pin instances in the second-level cache.
88      * @param pcClass the class of instances to pin
89      * @param subclasses if true, pin instances of subclasses also
90      * @since 2.0
91      */

92     void pinAll (Class JavaDoc pcClass, boolean subclasses);
93
94     /** Unpin the parameter instance from the second-level cache.
95      * @param oid the object id of the instance to unpin.
96      * @since 2.0
97      */

98     void unpin(Object JavaDoc oid);
99
100     /** Unpin the parameter instances from the second-level cache.
101      * @param oids the object ids of the instance to evict.
102      * @since 2.0
103      */

104     void unpinAll(Collection JavaDoc oids);
105
106     /** Unpin the parameter instance from the second-level cache.
107      * @param oids the object id of the instance to evict.
108      * @since 2.0
109      */

110     void unpinAll(Object JavaDoc[] oids);
111
112     /** Unpin instances from the second-level cache.
113      * @param pcClass the class of instances to unpin
114      * @param subclasses if true, unpin instances of subclasses also
115      * @since 2.0
116      */

117     void unpinAll(Class JavaDoc pcClass, boolean subclasses);
118     
119     /**
120      * This class is an empty implementation of the DataStoreCache
121      * interface. It can be used by an implementation that does not
122      * support a second-level cache.
123      * @since 2.0
124      */

125     public class EmptyDataStoreCache implements DataStoreCache {
126         
127         public EmptyDataStoreCache() {
128         }
129         
130         public void evict(Object JavaDoc oid) {
131         }
132
133         public void evictAll() {
134         }
135
136         public void evictAll(Object JavaDoc[] oids) {
137         }
138
139         public void evictAll(Collection JavaDoc oids) {
140         }
141
142         public void evictAll(Class JavaDoc pcClass, boolean subclasses) {
143         }
144
145         public void pin(Object JavaDoc oid) {
146         }
147
148         public void pinAll(Object JavaDoc[] oids) {
149         }
150
151         public void pinAll(Collection JavaDoc oids) {
152         }
153
154         public void pinAll(Class JavaDoc pcClass, boolean subclasses) {
155         }
156
157         public void unpin(Object JavaDoc oid) {
158         }
159
160         public void unpinAll(Object JavaDoc[] oids) {
161         }
162
163         public void unpinAll(Collection JavaDoc oids) {
164         }
165
166         public void unpinAll(Class JavaDoc pcClass, boolean subclasses) {
167         }
168     }
169 }
170
Popular Tags