|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.properties.PropertyStore
org.datanucleus.store.AbstractStoreManager
org.datanucleus.store.db4o.DB4OStoreManager
public class DB4OStoreManager
Store Manager for DB4O (http://www.db4o.com).
DataNucleus will select this StoreManager with URLs of the form "db4o:...". Support for DB4O is for the following URLs
DB4O provides methods to hand out memory versions of the datastore objects. Each object has to be "activated" to have its values accessible. Similarly the object can be "deactivated" when it is no longer needed (freeing up resources, and the link to the disk object). When we retrieve an object from DB4O it activates the object. This makes all fields accessible. If however one of the fields is a PC object (or collection, or map, or array etc) that object itself is not activated. Consequently all fields are accessible from the start (unlike with RDBMS), but the StateManager manages the list of fields that are considered "loaded", and this is initially just those in the DFG (even though others are available). When the user accesses one of these "not-loaded" fields DB4OManager.fetchObject is called and that field is marked as loaded (if it is a SCO mutable it is wrapped, and if it is a PC object it has a StateManager connected and is activated).
Each object is persisted on its own, and we dont use DB4O's internal cascade mechanism. Instead the DB4OManager.insertObject, or DB4OManager.updateObject methods are called for each object that is to be persisted/updated. Each call to insertObject/updateObject provides reachability by use of PersistFieldManager.
Currently objects are deleted using DB4O's internal cascade mechanism.
Refer to ConnectionFactoryImpl. In simple terms each ObjectManager has a DB4O ObjectContainer associated with it, and this is retained until the end of life of the ObjectManager. With DB4O in server mode this allows use of multiple PMs on the same underlying datastore. With DB4O in file mode you can only have one PM operating on the same underlying datastore at once. This is a DB4O limitation rather than ours.
| Field Summary | |
|---|---|
protected static org.datanucleus.util.Localiser |
LOCALISER_DB4O
Localiser for messages. |
| Fields inherited from class org.datanucleus.store.AbstractStoreManager |
|---|
autoCreateColumns, autoCreateConstraints, autoCreateTables, autoCreateWarnOnError, autoStartMechanism, connectionMgr, fixedDatastore, LOCALISER, namingFactory, nontxConnectionFactoryName, nucleusContext, persistenceHandler, readOnlyDatastore, schemaHandler, starter, starterInitialised, storeDataMgr, storeManagerKey, storeManagerRuntime, txConnectionFactoryName, validateColumns, validateConstraints, validateTables |
| Fields inherited from class org.datanucleus.properties.PropertyStore |
|---|
properties |
| Constructor Summary | |
|---|---|
DB4OStoreManager(org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.NucleusContext ctx,
java.util.Map<java.lang.String,java.lang.Object> props)
Constructor for a new DB4O StoreManager. |
|
| Method Summary | |
|---|---|
void |
activateObject(com.db4o.ObjectContainer cont,
java.lang.Object obj)
Convenience method to activate an object, to a depth of 1. |
void |
activateObject(com.db4o.ObjectContainer cont,
java.lang.Object obj,
int depth)
Convenience method to activate an object, to a depth. |
void |
close()
Release of resources |
void |
deactivateObject(com.db4o.ObjectContainer cont,
java.lang.Object obj)
Convenience method to deactivate an object, to a depth of 1. |
void |
deactivateObject(com.db4o.ObjectContainer cont,
java.lang.Object obj,
int depth)
Convenience method to activate an object, to a depth. |
void |
deregisterObjectContainer(com.db4o.ObjectContainer cont)
Method to deregister an ObjectContainer from this store. |
org.datanucleus.store.Extent |
getExtent(org.datanucleus.store.ExecutionContext ec,
java.lang.Class c,
boolean subclasses)
Accessor for an Extent for a class. |
java.lang.Object |
getObjectIdForObject(org.datanucleus.store.ExecutionContext ec,
java.lang.Object pc)
Convenience method to get the identity for a Persistable object. |
protected java.lang.String |
getStrategyForNative(org.datanucleus.metadata.AbstractClassMetaData cmd,
int absFieldNumber)
|
java.util.Collection |
getSupportedOptions()
Accessor for the supported options in string form |
boolean |
isStrategyDatastoreAttributed(org.datanucleus.metadata.IdentityStrategy identityStrategy,
boolean datastoreIdentityField)
Check if the strategy is attributed by the database when the PersistenceCapable object is inserted into the database. |
protected void |
logConfiguration()
Convenience method to log the configuration of this store manager. |
void |
notifyObjectIsOutdated(org.datanucleus.store.ObjectProvider sm)
Hook for the StateManager to notify us that an object is outdated (no longer valid). |
void |
registerObjectContainer(com.db4o.ObjectContainer cont)
Method to register an ObjectContainer as active on this store. |
protected void |
registerStoreData(org.datanucleus.store.StoreData data)
Method to register some data with the store. |
| Methods inherited from class org.datanucleus.store.AbstractStoreManager |
|---|
addClass, addClasses, assertReadOnlyForUpdateOfObject, clearAutoStarter, deregisterAllStoreData, getApiAdapter, getBooleanObjectProperty, getBooleanProperty, getBooleanProperty, getClassNameForObjectID, getConnection, getConnection, getConnection, getConnectionDriverName, getConnectionFactory, getConnectionFactory2, getConnectionFactory2Name, getConnectionFactoryName, getConnectionManager, getConnectionPassword, getConnectionURL, getConnectionUserName, getDatastoreDate, getIntProperty, getMetaDataManager, getNamingFactory, getNucleusConnection, getNucleusContext, getNucleusSequence, getPersistenceHandler, getPropertiesForGenerator, getProperty, getQueryCacheKey, getQueryManager, getRuntimeManager, getSchemaHandler, getStoreManagerKey, getStrategyValue, getStrategyValueForGenerator, getStringProperty, getSubClassesForClass, getValueGenerationManager, initialiseAutoStart, isAutoCreateColumns, isAutoCreateConstraints, isAutoCreateTables, isValidateColumns, isValidateConstraints, isValidateTables, manageClassForIdentity, managesClass, newStoreData, printInformation, registerConnectionFactory, registerConnectionMgr, removeAllClasses, supportsQueryLanguage, supportsValueStrategy, transactionCommitted, transactionRolledBack, transactionStarted |
| Methods inherited from class org.datanucleus.properties.PropertyStore |
|---|
hasProperty, hasPropertyNotNull, setPropertyInternal |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.datanucleus.store.StoreManager |
|---|
hasProperty |
| Field Detail |
|---|
protected static final org.datanucleus.util.Localiser LOCALISER_DB4O
| Constructor Detail |
|---|
public DB4OStoreManager(org.datanucleus.ClassLoaderResolver clr,
org.datanucleus.NucleusContext ctx,
java.util.Map<java.lang.String,java.lang.Object> props)
clr - the ClassLoaderResolverctx - The corresponding context.props - Properties for the datastore| Method Detail |
|---|
public void close()
close in interface org.datanucleus.store.StoreManagerclose in class org.datanucleus.store.AbstractStoreManager
protected java.lang.String getStrategyForNative(org.datanucleus.metadata.AbstractClassMetaData cmd,
int absFieldNumber)
getStrategyForNative in class org.datanucleus.store.AbstractStoreManagerprotected void logConfiguration()
logConfiguration in class org.datanucleus.store.AbstractStoreManagerprotected void registerStoreData(org.datanucleus.store.StoreData data)
registerStoreData in class org.datanucleus.store.AbstractStoreManagerdata - The StoreData to addpublic void registerObjectContainer(com.db4o.ObjectContainer cont)
cont - ObjectContainerpublic void deregisterObjectContainer(com.db4o.ObjectContainer cont)
cont - ObjectContainerpublic void notifyObjectIsOutdated(org.datanucleus.store.ObjectProvider sm)
notifyObjectIsOutdated in interface org.datanucleus.store.ObjectReferencingStoreManagersm - StateManager of object
public void activateObject(com.db4o.ObjectContainer cont,
java.lang.Object obj)
cont - ObjectContainer where the object residesobj - The object
public void activateObject(com.db4o.ObjectContainer cont,
java.lang.Object obj,
int depth)
cont - ObjectContainer where the object residesobj - The objectdepth - The depth to activate to
public void deactivateObject(com.db4o.ObjectContainer cont,
java.lang.Object obj)
cont - ObjectContainer where the object residesobj - The object
public void deactivateObject(com.db4o.ObjectContainer cont,
java.lang.Object obj,
int depth)
cont - ObjectContainer where the object residesobj - The objectdepth - The depth to activate to
public java.lang.Object getObjectIdForObject(org.datanucleus.store.ExecutionContext ec,
java.lang.Object pc)
ec - execution contextpc - The object
public boolean isStrategyDatastoreAttributed(org.datanucleus.metadata.IdentityStrategy identityStrategy,
boolean datastoreIdentityField)
isStrategyDatastoreAttributed in interface org.datanucleus.store.StoreManagerisStrategyDatastoreAttributed in class org.datanucleus.store.AbstractStoreManageridentityStrategy - the identityStrategydatastoreIdentityField - Whether this is for the surrogate datastore identity field
public org.datanucleus.store.Extent getExtent(org.datanucleus.store.ExecutionContext ec,
java.lang.Class c,
boolean subclasses)
getExtent in interface org.datanucleus.store.StoreManagergetExtent in class org.datanucleus.store.AbstractStoreManagerec - execution contextc - The class requiring the Extentsubclasses - Whether to include subclasses of 'c'
public java.util.Collection getSupportedOptions()
getSupportedOptions in interface org.datanucleus.store.StoreManagergetSupportedOptions in class org.datanucleus.store.AbstractStoreManager
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||