com.sleepycat.persist.impl
Class SimpleCatalog

java.lang.Object
  extended by com.sleepycat.persist.impl.SimpleCatalog
All Implemented Interfaces:
Catalog
Direct Known Subclasses:
ComparatorCatalog

public class SimpleCatalog
extends Object
implements Catalog

A static catalog containing simple types only. Once created, this catalog is immutable. For bindings accessed by a PersistComparator during recovery, the SimpleCatalog provides formats for all simple types. To reduce redundant format objects, the SimpleCatalog's formats are copied when creating a regular PersistCatalog. This class also contains utility methods for dealing with primitives.

Author:
Mark Hayes

Field Summary
 
Fields inherited from interface com.sleepycat.persist.impl.Catalog
BETA_VERSION, CURRENT_VERSION
 
Constructor Summary
SimpleCatalog(ClassLoader classLoader)
           
 
Method Summary
(package private) static boolean addMissingSimpleFormats(ClassLoader loader, List<Format> copyToList)
           
static boolean allowRegisterProxy(Class type)
           
 Object convertRawObject(RawObject o, IdentityHashMap converted)
           
 Format createFormat(Class type, Map<String,Format> newFormats)
           
 Format createFormat(String clsName, Map<String,Format> newFormats)
           
(package private) static List<Format> getAllSimpleFormats(ClassLoader loader)
           
 Format getFormat(Class cls, boolean checkEntitySubclassIndexes)
          Returns a format for a given class, or throws an exception.
 Format getFormat(int formatId, boolean expectStored)
          Returns a format for a given ID, or throws an exception.
 Format getFormat(String className)
          Returns a format by class name.
 int getInitVersion(Format format, boolean forReader)
          See above.
 boolean isRawAccess()
           
(package private) static boolean isSimpleType(Class type)
           
static String keyClassName(String className)
           
(package private) static Class primitiveToWrapper(Class type)
           
 Class resolveClass(String clsName)
           
static Class resolveClass(String className, ClassLoader loader)
           
 Class resolveKeyClass(String clsName)
           
static Class resolveKeyClass(String className, ClassLoader loader)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleCatalog

SimpleCatalog(ClassLoader classLoader)
Method Detail

isSimpleType

static boolean isSimpleType(Class type)

primitiveToWrapper

static Class primitiveToWrapper(Class type)

resolveClass

public static Class resolveClass(String className,
                                 ClassLoader loader)
                          throws ClassNotFoundException
Throws:
ClassNotFoundException

resolveKeyClass

public static Class resolveKeyClass(String className,
                                    ClassLoader loader)

keyClassName

public static String keyClassName(String className)

getAllSimpleFormats

static List<Format> getAllSimpleFormats(ClassLoader loader)

addMissingSimpleFormats

static boolean addMissingSimpleFormats(ClassLoader loader,
                                       List<Format> copyToList)

getInitVersion

public int getInitVersion(Format format,
                          boolean forReader)
Description copied from interface: Catalog
See above.

Specified by:
getInitVersion in interface Catalog

getFormat

public Format getFormat(int formatId,
                        boolean expectStored)
Description copied from interface: Catalog
Returns a format for a given ID, or throws an exception. This method is used when reading an object from the byte array format.

Specified by:
getFormat in interface Catalog
expectStored - is true if reading a record from a database, and therefore the format ID is expected to be stored also. If the format ID is not stored, a RefreshException is thrown.

getFormat

public Format getFormat(Class cls,
                        boolean checkEntitySubclassIndexes)
Description copied from interface: Catalog
Returns a format for a given class, or throws an exception. This method is used when writing an object that was passed in by the user.

Specified by:
getFormat in interface Catalog
checkEntitySubclassIndexes - is true if we're expecting this format to be an entity subclass and therefore subclass secondary indexes should be opened.

getFormat

public Format getFormat(String className)
Description copied from interface: Catalog
Returns a format by class name. Unlike #getFormat(Class), the format will not be created if it is not already known.

Specified by:
getFormat in interface Catalog

createFormat

public Format createFormat(String clsName,
                           Map<String,Format> newFormats)
Specified by:
createFormat in interface Catalog
See Also:
PersistCatalog.createFormat(java.lang.String, java.util.Map)

createFormat

public Format createFormat(Class type,
                           Map<String,Format> newFormats)
Specified by:
createFormat in interface Catalog
See Also:
PersistCatalog.createFormat(java.lang.String, java.util.Map)

isRawAccess

public boolean isRawAccess()
Specified by:
isRawAccess in interface Catalog
See Also:
PersistCatalog.isRawAccess()

convertRawObject

public Object convertRawObject(RawObject o,
                               IdentityHashMap converted)
Specified by:
convertRawObject in interface Catalog
See Also:
PersistCatalog.convertRawObject(com.sleepycat.persist.raw.RawObject, com.sleepycat.je.utilint.IdentityHashMap)

resolveClass

public Class resolveClass(String clsName)
                   throws ClassNotFoundException
Specified by:
resolveClass in interface Catalog
Throws:
ClassNotFoundException
See Also:
PersistCatalog.resolveClass(java.lang.String)

resolveKeyClass

public Class resolveKeyClass(String clsName)
Specified by:
resolveKeyClass in interface Catalog
See Also:
PersistCatalog.resolveKeyClass(java.lang.String)

allowRegisterProxy

public static boolean allowRegisterProxy(Class type)


Copyright (c) 2004-2012 Oracle. All rights reserved.