| Modifier and Type | Field and Description |
|---|---|
static boolean |
expectNoClassChanges
Used by unit tests.
|
static boolean |
unevolvedFormatsEncountered |
BETA_VERSION, CURRENT_VERSION| Constructor and Description |
|---|
PersistCatalog(Environment env,
java.lang.String storePrefix,
java.lang.String dbName,
DatabaseConfig dbConfig,
EntityModel modelParam,
Mutations mutationsParam,
boolean rawAccess,
Store store)
Creates a new catalog, opening the database and reading it from a given
catalog database if it already exists.
|
PersistCatalog(PersistCatalog oldCatalog,
java.lang.String storePrefix)
Creates a new catalog when a Replica refresh occurs.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
checkWriteInReplicaUpgradeMode()
Metadata needs refreshing when a Replica with stale metadata is elected
master, and then a user write operation is attempted.
|
boolean |
close()
Decrements the reference count and closes the catalog DB when it reaches
zero.
|
java.lang.Object |
convertRawObject(RawObject o,
IdentityHashMap converted) |
Format |
createFormat(java.lang.Class type,
java.util.Map<java.lang.String,Format> newFormats)
If the given class format is not already present in the given map and
a format for this class name does not already exist, creates an
uninitialized format, adds it to the map, and also collects related
formats in the map.
|
Format |
createFormat(java.lang.String clsName,
java.util.Map<java.lang.String,Format> newFormats)
Convenience method that gets the class for the given class name and
calls createFormat with the class object.
|
void |
flush(Transaction txn)
Used to write the catalog when a format has been changed, for example,
when Store.evolve has updated a Format's EvolveNeeded property.
|
java.util.List<RawType> |
getAllRawTypes()
Returns all formats as RawTypes.
|
java.lang.String |
getDatabaseClassName(java.lang.String className)
Returns the name of an entity class to be used to form the database
name.
|
java.lang.String |
getDatabaseKeyName(java.lang.String className,
java.lang.String keyName)
Similar to getDatabaseClassName but instead handles an earlier version
of a renamed key.
|
void |
getEntityFormats(java.util.Collection<Format> entityFormats) |
Format |
getFormat(java.lang.Class cls,
boolean checkEntitySubclassIndexes)
Get a format for a given class, creating it if it does not exist.
|
Format |
getFormat(int formatId,
boolean expectStored)
Returns a format for a given ID, or throws an exception.
|
Format |
getFormat(java.lang.String className)
Returns a format by class name.
|
int |
getInitVersion(Format format,
boolean forReader)
When a format is intialized, this method is called to get the version
of the serialized object to be initialized.
|
Format |
getLatestVersion(java.lang.String className) |
(package private) java.util.Set<java.lang.String> |
getModelClasses()
Returns a set of all persistent (non-simple type) class names.
|
Mutations |
getMutations()
Returns the current merged mutations.
|
(package private) int |
getNFormats()
Returns the number of stored formats.
|
EntityModel |
getResolvedModel()
Returns the model parameter, default model or stored model.
|
(package private) java.util.Map<Format,java.util.Set<Format>> |
getSubclassMap()
Returns a map from format to a set of its superclass formats.
|
(package private) boolean |
isMetadataStale(Transaction txn)
Metadata needs refreshing when a Replica with stale metadata is elected
master, and then a user write operation is attempted that also requires
a metadata update.
|
boolean |
isRawAccess() |
boolean |
isReadOnly()
Returns true if the user opened the store read-only, or we're running in
Replica upgrade mode.
|
(package private) boolean |
isReplicaUpgradeMode()
For unit testing.
|
void |
openExisting()
Increments the reference count for a catalog that is already open.
|
java.lang.Class |
resolveClass(java.lang.String clsName) |
java.lang.Class |
resolveKeyClass(java.lang.String clsName) |
(package private) void |
useExistingFormat(Format oldFormat)
Installs an existing format when no evolution is needed, i.e, when the
new and old formats are identical.
|
public static boolean expectNoClassChanges
public static boolean unevolvedFormatsEncountered
public PersistCatalog(Environment env, java.lang.String storePrefix, java.lang.String dbName, DatabaseConfig dbConfig, EntityModel modelParam, Mutations mutationsParam, boolean rawAccess, Store store) throws StoreExistsException, StoreNotFoundException, IncompatibleClassException, DatabaseException
PersistCatalog(PersistCatalog oldCatalog, java.lang.String storePrefix) throws DatabaseException
DatabaseExceptionpublic void getEntityFormats(java.util.Collection<Format> entityFormats)
java.util.Map<Format,java.util.Set<Format>> getSubclassMap()
public EntityModel getResolvedModel()
public void openExisting()
public boolean isReadOnly()
public boolean close()
throws DatabaseException
DatabaseExceptionpublic Mutations getMutations()
public Format createFormat(java.lang.String clsName, java.util.Map<java.lang.String,Format> newFormats)
createFormat in interface CatalogcreateFormat(java.lang.String, java.util.Map<java.lang.String, com.sleepycat.persist.impl.Format>)public Format createFormat(java.lang.Class type, java.util.Map<java.lang.String,Format> newFormats)
createFormat in interface CatalogcreateFormat(java.lang.String, java.util.Map<java.lang.String, com.sleepycat.persist.impl.Format>)void useExistingFormat(Format oldFormat)
java.util.Set<java.lang.String> getModelClasses()
public java.util.List<RawType> getAllRawTypes()
public int getInitVersion(Format format, boolean forReader)
getInitVersion in interface Catalogpublic Format getFormat(int formatId, boolean expectStored) throws RefreshException
CataloggetFormat in interface CatalogexpectStored - 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.RefreshExceptionpublic Format getFormat(java.lang.Class cls, boolean checkEntitySubclassIndexes) throws RefreshException
This method is called for top level entity instances by PersistEntityBinding. When a new entity subclass format is added we call Store.checkEntitySubclassSecondaries to ensure that all secondary databases have been opened, before storing the entity. We do this here while not holding a synchronization mutex, not in addNewFormat, to avoid deadlocks. checkEntitySubclassSecondaries synchronizes on the Store. [#16399]
Historical note: At one time we opened / created the secondary databases rather than requiring the user to open them, see [#15247]. Later we found this to be problematic since a user txn may have locked primary records, see [#16399].
getFormat in interface CatalogcheckEntitySubclassIndexes - is true if we're expecting this format
to be an entity subclass and therefore subclass secondary indexes should
be opened.RefreshExceptionpublic Format getFormat(java.lang.String className)
Catalog#getFormat(Class), the
format will not be created if it is not already known.public Format getLatestVersion(java.lang.String className)
public java.lang.String getDatabaseClassName(java.lang.String className)
public java.lang.String getDatabaseKeyName(java.lang.String className,
java.lang.String keyName)
void checkWriteInReplicaUpgradeMode()
throws RefreshException
RefreshExceptionboolean isReplicaUpgradeMode()
public void flush(Transaction txn) throws DatabaseException
DatabaseExceptionint getNFormats()
boolean isMetadataStale(Transaction txn) throws DatabaseException
DatabaseExceptionpublic boolean isRawAccess()
isRawAccess in interface CatalogisRawAccess()public java.lang.Object convertRawObject(RawObject o, IdentityHashMap converted) throws RefreshException
convertRawObject in interface CatalogRefreshExceptionconvertRawObject(com.sleepycat.persist.raw.RawObject, com.sleepycat.je.utilint.IdentityHashMap)public java.lang.Class resolveClass(java.lang.String clsName)
throws java.lang.ClassNotFoundException
resolveClass in interface Catalogjava.lang.ClassNotFoundExceptionresolveClass(java.lang.String)public java.lang.Class resolveKeyClass(java.lang.String clsName)
resolveKeyClass in interface CatalogresolveKeyClass(java.lang.String)Copyright (c) 2004-2012 Oracle. All rights reserved.