KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > persist > impl > Catalog


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: Catalog.java,v 1.9 2006/10/30 21:14:32 bostic Exp $
7  */

8
9 package com.sleepycat.persist.impl;
10
11 import java.util.IdentityHashMap JavaDoc;
12 import java.util.Map JavaDoc;
13
14 import com.sleepycat.persist.raw.RawObject;
15
16 /**
17  * Catalog operation interface used by format classes.
18  *
19  * @see PersistCatalog
20  * @see SimpleCatalog
21  * @see ReadOnlyCatalog
22  *
23  * @author Mark Hayes
24  */

25 interface Catalog {
26
27     /**
28      * Returns a format for a given ID, or throws an exception. This method is
29      * used when reading an object from the byte array format.
30      *
31      * @throws IllegalStateException if the formatId does not correspond to a
32      * persistent class. This is an internal consistency error.
33      */

34     Format getFormat(int formatId);
35
36     /**
37      * Returns a format for a given class, or throws an exception. This method
38      * is used when writing an object that was passed in by the user.
39      *
40      * @throws IllegalArgumentException if the class is not persistent. This
41      * is a user error.
42      */

43     Format getFormat(Class JavaDoc cls);
44
45     /**
46      * Returns a format by class name. Unlike {@link #getFormat(Class)}, the
47      * format will not be created if it is not already known.
48      */

49     Format getFormat(String JavaDoc className);
50
51     /**
52      * @see PersistCatalog#createFormat
53      */

54     Format createFormat(String JavaDoc clsName, Map JavaDoc<String JavaDoc,Format> newFormats);
55
56     /**
57      * @see PersistCatalog#createFormat
58      */

59     Format createFormat(Class JavaDoc type, Map JavaDoc<String JavaDoc,Format> newFormats);
60
61     /**
62      * @see PersistCatalog#isRawAccess
63      */

64     boolean isRawAccess();
65
66     /**
67      * @see PersistCatalog#convertRawObject
68      */

69     Object JavaDoc convertRawObject(RawObject o, IdentityHashMap JavaDoc converted);
70 }
71
Popular Tags