KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > spi > persistence > support > sqlstore > VersionConsistencyCache


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 package com.sun.jdo.spi.persistence.support.sqlstore;
25
26 /**
27  * A cache of "version consistent" StateManager instances. These instances
28  * are used so that we can avoid loading state from the database.
29  *
30  * @author Dave Bristor
31  */

32 public interface VersionConsistencyCache {
33     /**
34      * Puts the given StateManager into a map that is keyed by the given OID.
35      * We anticipate that implementations will want to use a two-level map,
36      * and so the pc's class can be used as a key into a map to access a
37      * second map, which would be that keyed by OID.
38      * @param pcType class of instance, used as key in outer map.
39      * @param oid Object id, used as key in inner map.
40      * @param sm StateManager bound to <code>oid</code> in inner map.
41      */

42     public StateManager put(Class JavaDoc pcType, Object JavaDoc oid, StateManager sm);
43
44     /**
45      * Returns an SM, if found, else null.
46      * @param pcType class of instance, used as key in outer map.
47      * @param oid Object id, used as key in inner map.
48      */

49     public StateManager get(Class JavaDoc pcType, Object JavaDoc oid);
50
51     /**
52      * Removes entry based on pc and oid. If map is empty after remove,
53      * removes it from its containint map.
54      * @param pcType class of instance, used as key in outer map.
55      * @param oid Object id, used as key in inner map.
56      */

57     public StateManager remove(Class JavaDoc pcType, Object JavaDoc oid);
58
59     /**
60      * Informs the cache to expect that the given pcType will be used as a key
61      * for the outer map in subsequent <code>putEntry</code> operations.
62      * @param pcType class of instance, used as key in outer map.
63      */

64     public void addPCType(Class JavaDoc pcType);
65
66     /**
67      * Removes the map for the given pcType and all its elements.
68      * @param pcType class of instance, used as key in outer map.
69      */

70     public void removePCType(Class JavaDoc pcType);
71 }
72
Popular Tags