001: /**********************************************************************
002: Copyright (c) 2004 Andy Jefferson and others. All rights reserved.
003: Licensed under the Apache License, Version 2.0 (the "License");
004: you may not use this file except in compliance with the License.
005: You may obtain a copy of the License at
006:
007: http://www.apache.org/licenses/LICENSE-2.0
008:
009: Unless required by applicable law or agreed to in writing, software
010: distributed under the License is distributed on an "AS IS" BASIS,
011: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012: See the License for the specific language governing permissions and
013: limitations under the License.
014:
015:
016: Contributors:
017: ...
018: **********************************************************************/package org.jpox.cache;
019:
020: import java.util.Collection;
021:
022: /**
023: * Null implementation of a Level 2 Cache.
024: * Exists to meet the JDO 2 spec which states that the PMF will return a
025: * DataStoreCache that silently does nothing when its methods are called.
026: * Extends the JDO2 spec provided EmptyDataStoreCache to provide the add-on JPOX methods.
027: *
028: * @version $Revision: 1.9 $
029: */
030: public class NullLevel2Cache implements Level2Cache {
031: /**
032: * Evict the parameter instance from the second-level cache.
033: * @param oid the object id of the instance to evict.
034: */
035: public void evict(Object oid) {
036: }
037:
038: /**
039: * Evict the parameter instances from the second-level cache.
040: * All instances in the PersistenceManager's cache are evicted
041: * from the second-level cache.
042: */
043: public void evictAll() {
044: }
045:
046: /**
047: * Evict the parameter instances from the second-level cache.
048: * @param pcClass the class to evict
049: * @param subclasses Whether to evict all subclasses of this class also
050: */
051: public void evictAll(Class pcClass, boolean subclasses) {
052: }
053:
054: /**
055: * Evict the parameter instances from the second-level cache.
056: * @param oids the object ids of the instance to evict.
057: */
058: public void evictAll(Collection oids) {
059: }
060:
061: /**
062: * Evict the parameter instances from the second-level cache.
063: * @param oids the object ids of the instances to evict
064: */
065: public void evictAll(Object[] oids) {
066: }
067:
068: /**
069: * Pin the parameter instance in the second-level cache.
070: * @param oid the object id of the instance to pin.
071: */
072: public void pin(Object oid) {
073: }
074:
075: /**
076: * Evict the parameter instances from the second-level cache.
077: * @param pcClass the class of instances to evict
078: * @param subclasses if true, evict instances of subclasses also
079: */
080: public void pinAll(Class pcClass, boolean subclasses) {
081: }
082:
083: /**
084: * Pin the parameter instances in the second-level cache.
085: * @param oids the object ids of the instances to pin.
086: */
087: public void pinAll(Collection oids) {
088: }
089:
090: /**
091: * Pin the parameter instances in the second-level cache.
092: * @param oids the object ids of the instances to pin.
093: */
094: public void pinAll(Object[] oids) {
095: }
096:
097: /**
098: * Unpin the parameter instance from the second-level cache.
099: * @param oid the object id of the instance to unpin.
100: */
101: public void unpin(Object oid) {
102: }
103:
104: /**
105: * Unpin instances from the second-level cache.
106: * @param pcClass the class of instances to unpin
107: * @param subclasses if true, unpin instances of subclasses also
108: */
109: public void unpinAll(Class pcClass, boolean subclasses) {
110: }
111:
112: /**
113: * Unpin the parameter instances from the second-level cache.
114: * @param oids the object ids of the instance to evict.
115: */
116: public void unpinAll(Collection oids) {
117: }
118:
119: /**
120: * Unpin the parameter instances from the second-level cache.
121: * @param oids the object ids of the instance to evict.
122: */
123: public void unpinAll(Object[] oids) {
124: }
125:
126: /**
127: * Method to clear the cache.
128: */
129: public void clear() {
130: }
131:
132: /**
133: * Accessor for whether an object with the specified id is in the cache
134: * @param oid The object id
135: * @return Whether it is in the cache
136: */
137: public boolean containsOid(Object oid) {
138: return false;
139: }
140:
141: /**
142: * Accessor for an object from the cache
143: * @param oid The identity
144: * @return The cacheable object
145: */
146: public CachedPC get(Object oid) {
147: return null;
148: }
149:
150: /**
151: *
152: * @see org.jpox.cache.Level2Cache#getNumberOfPinnedObjects()
153: */
154: public int getNumberOfPinnedObjects() {
155: return 0;
156: }
157:
158: /**
159: *
160: * @see org.jpox.cache.Level2Cache#getNumberOfUnpinnedObjects()
161: */
162: public int getNumberOfUnpinnedObjects() {
163: return 0;
164: }
165:
166: /**
167: *
168: * @see org.jpox.cache.Level2Cache#getSize()
169: */
170: public int getSize() {
171: return 0;
172: }
173:
174: /**
175: *
176: * @see org.jpox.cache.Level2Cache#isEmpty()
177: */
178: public boolean isEmpty() {
179: return false;
180: }
181:
182: /**
183: * Method to put an object in the L2 cache
184: * @param oid The identity
185: * @param pc Cacheable form of the PC
186: * @return Previous value stored for this id
187: */
188: public CachedPC put(Object oid, CachedPC pc) {
189: return null;
190: }
191: }
|