org.datanucleus.store
Class AbstractStoreManager

java.lang.Object
  extended by org.datanucleus.store.AbstractStoreManager
All Implemented Interfaces:
StoreManager
Direct Known Subclasses:
MappedStoreManager

public abstract class AbstractStoreManager
extends java.lang.Object
implements StoreManager

An abstract representation of a Store Manager. Manages the persistence of objects to the store. Will be implemented for the type of datastore (RDBMS, ODBMS, OLAP) in question. The store manager's responsibilities include:

A store manager's knowledge of its contents is typically not complete. It knows about the classes that it has encountered in its lifetime. The PersistenceManager can make the StoreManager aware of a class, and can check if the StoreManager knows about a particular class. The Auto-Start mechanism provides a way of inheriting knowledge from the last time the store was used.


Field Summary
protected  java.lang.String autoStartMechanism
          Name of the AutoStart mechanism.
protected  ConnectionManager connectionMgr
          ConnectionManager
protected  boolean fixedDatastore
          Whether this datastore is fixed (no mods to datastore classes allowed).
protected static Localiser LOCALISER
          Localiser for messages.
protected  java.lang.String nontxConnectionFactoryName
          Name of non-transactional connection factory (null if not present).
protected  OMFContext omfContext
          ObjectManagerFactory context.
protected  StorePersistenceHandler persistenceHandler2
          Persistence handler.
protected  boolean readOnlyDatastore
          Whether this datastore is read only.
protected  StoreSchemaHandler schemaHandler
          Schema handler.
protected  AutoStartMechanism starter
          Auto-Start mechanism to use.
protected  boolean starterInitialised
          Whether the AutoStart mechanism is initialised
protected  StoreDataManager storeDataMgr
          Manager for the data definition in the datastore.
protected  java.lang.String storeManagerKey
          Key for this StoreManager e.g "rdbms", "db4o"
protected  StoreManagerRuntime storeManagerRuntime
          StoreManager Runtime.
protected  java.lang.String txConnectionFactoryName
          Name of transactional connection factory.
protected  ValueGenerationManager valueGenerationMgr
          Manager for value generation.
 
Constructor Summary
protected AbstractStoreManager(java.lang.String key, ClassLoaderResolver clr, OMFContext omfContext)
          Constructor for a new StoreManager.
 
Method Summary
 void addClass(java.lang.String className, ClassLoaderResolver clr)
          Method to add a class to the managed list for this datastore manager.
 void addClasses(java.lang.String[] classNames, ClassLoaderResolver clr)
          Add classes to the persistence model for the datastore.
 void assertReadOnlyForUpdateOfObject(ObjectProvider op)
          Convenience method to assert when this StoreManager is read-only and the specified object is attempting to be updated.
protected  void clearAutoStarter()
          Method to clear the Auto-Starter status.
 void close()
          Release of resources.
protected  void deregisterAllStoreData()
          Method to deregister all existing store data so that we are managing nothing.
 ApiAdapter getApiAdapter()
          Accessor for the API adapter.
 Store getBackingStoreForField(ClassLoaderResolver clr, AbstractMemberMetaData fmd, java.lang.Class type)
          Accessor for the backing store for the specified field.
 java.lang.String getClassNameForObjectID(java.lang.Object id, ClassLoaderResolver clr, ExecutionContext ec)
          Returns the class corresponding to the given object identity.
 ManagedConnection getConnection(ExecutionContext ec)
          Accessor for a connection for the specified ObjectManager.
 ManagedConnection getConnection(ExecutionContext ec, java.util.Map options)
          Accessor for a connection for the specified ObjectManager.
 ManagedConnection getConnection(int isolation_level)
          Utility to return a non-transactional Connection.
 java.lang.String getConnectionDriverName()
          Convenience accessor for the driver name to use for the connection (if applicable for this datastore).
 java.lang.Object getConnectionFactory()
          Convenience accessor for the factory for the connection (transactional).
 java.lang.Object getConnectionFactory2()
          Convenience accessor for the factory for the connection (non-transactional).
 java.lang.String getConnectionFactory2Name()
          Convenience accessor for the factory name for the connection (non-transactional).
 java.lang.String getConnectionFactoryName()
          Convenience accessor for the factory name for the connection (transactional).
 ConnectionManager getConnectionManager()
          Accessor for the connection manager for this store manager.
 java.lang.String getConnectionPassword()
          Convenience accessor for the password to use for the connection.
 java.lang.String getConnectionURL()
          Convenience accessor for the URL for the connection
 java.lang.String getConnectionUserName()
          Convenience accessor for the username to use for the connection
 java.util.Date getDatastoreDate()
          Get the date/time of the datastore.
 Extent getExtent(ExecutionContext ec, java.lang.Class c, boolean subclasses)
          Interface to getting an Extent for a class.
 MetaDataManager getMetaDataManager()
           
 NucleusConnection getNucleusConnection(ExecutionContext ec)
          Method to return a connection for the ObjectManager.
 NucleusSequence getNucleusSequence(ExecutionContext ec, SequenceMetaData seqmd)
          Method to return a datastore sequence for this datastore matching the passed sequence MetaData.
 OMFContext getOMFContext()
          Accessor for the context in which this StoreManager is running
 StorePersistenceHandler getPersistenceHandler()
          Accessor for the store persistence handler.
protected  java.util.Properties getPropertiesForGenerator(AbstractClassMetaData cmd, int absoluteFieldNumber, ExecutionContext ec, SequenceMetaData seqmd, TableGeneratorMetaData tablegenmd)
          Method to return the properties to pass to the generator for the specified field.
 java.lang.String getQueryCacheKey()
          Accessor for the key used for representing this store manager in the query cache.
 StoreManagerRuntime getRuntimeManager()
          Accessor for the runtime management of this component (if specified as required to the PMF/EMF).
 StoreSchemaHandler getSchemaHandler()
          Accessor for the store schema handler (if this datastore supports the concept of a schema).
 java.lang.String getStoreManagerKey()
          Accessor for the key for this store manager.
protected  java.lang.String getStrategyForNative(AbstractClassMetaData cmd, int absFieldNumber)
          Method defining which value-strategy to use when the user specifies "native".
 java.lang.Object getStrategyValue(ExecutionContext ec, AbstractClassMetaData cmd, int absoluteFieldNumber)
          Method to retrieve the value for a strategy for a particular field.
protected  java.lang.Object getStrategyValueForGenerator(ValueGenerator generator, ExecutionContext ec)
          Accessor for the next value from the specified generator.
 java.util.HashSet<java.lang.String> getSubClassesForClass(java.lang.String className, boolean includeDescendents, ClassLoaderResolver clr)
          Utility to return the names of the classes that are known subclasses of the provided class.
 java.util.Collection<java.lang.String> getSupportedOptions()
          Accessor for the supported options in string form.
 ValueGenerationManager getValueGenerationManager()
          Accessor for the ValueGenerationManager for obtaining sequences.
protected  void initialiseAutoStart(ClassLoaderResolver clr)
          Method to initialise the auto-start mechanism, loading up the classes from its store into memory so that we start from where we got to last time.
 boolean isStrategyDatastoreAttributed(IdentityStrategy identityStrategy, boolean datastoreIdentityField)
          Method to return if a particular value strategy is attributed by the datastore.
protected  void logConfiguration()
          Convenience method to log the configuration of this store manager.
 java.lang.String manageClassForIdentity(java.lang.Object id, ClassLoaderResolver clr)
          Convenience method to ensure that the class defined by the passed OID/SingleFIeldIdentity is managed by the store.
 boolean managesClass(java.lang.String className)
          Accessor for whether the specified class is managed currently
protected  StoreData newStoreData(ClassMetaData cmd, ClassLoaderResolver clr)
          Instantiate a StoreData instance using the provided ClassMetaData and ClassLoaderResolver.
 void notifyObjectIsOutdated(ObjectProvider sm)
          Notifies this store manager that the main memory (RAM, heap) copy of the PC object of the supplied StateManager may not be regarded as valid anymore.
 void performVersionCheck(ObjectProvider sm, java.lang.Object versionDatastore, VersionMetaData versionMetaData)
          Perform an optimistic version check on the passed object, against the passed version in the datastore.
 void printInformation(java.lang.String category, java.io.PrintStream ps)
          Method to output the information about the StoreManager.
protected  void registerConnectionFactory()
          Register the Connection Factory defined in plugins
protected  void registerConnectionMgr()
          Register the default ConnectionManager implementation
protected  void registerStoreData(StoreData data)
          Method to register some data with the store.
 void removeAllClasses(ClassLoaderResolver clr)
          Remove all classes from the persistence model for the datastore.
 boolean supportsQueryLanguage(java.lang.String language)
          Accessor for whether this query language is supported.
 boolean supportsValueStrategy(java.lang.String strategy)
          Accessor for whether this value strategy is supported.
 void transactionCommitted(ExecutionContext ec)
          Method to inform the StoreManager that a transaction has committed for the specified execution context.
 void transactionRolledBack(ExecutionContext ec)
          Method to inform the StoreManager that a transaction has rolled back for the specified execution context.
 void transactionStarted(ExecutionContext ec)
          Method to inform the StoreManager that a transaction has started for the specified execution context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCALISER

protected static final Localiser LOCALISER
Localiser for messages.


storeManagerKey

protected final java.lang.String storeManagerKey
Key for this StoreManager e.g "rdbms", "db4o"


readOnlyDatastore

protected final boolean readOnlyDatastore
Whether this datastore is read only.


fixedDatastore

protected final boolean fixedDatastore
Whether this datastore is fixed (no mods to datastore classes allowed).


starter

protected AutoStartMechanism starter
Auto-Start mechanism to use.


starterInitialised

protected boolean starterInitialised
Whether the AutoStart mechanism is initialised


omfContext

protected final OMFContext omfContext
ObjectManagerFactory context.


valueGenerationMgr

protected final ValueGenerationManager valueGenerationMgr
Manager for value generation.


storeManagerRuntime

protected StoreManagerRuntime storeManagerRuntime
StoreManager Runtime. Used when providing management of services.


storeDataMgr

protected StoreDataManager storeDataMgr
Manager for the data definition in the datastore.


autoStartMechanism

protected java.lang.String autoStartMechanism
Name of the AutoStart mechanism.


persistenceHandler2

protected StorePersistenceHandler persistenceHandler2
Persistence handler.


schemaHandler

protected StoreSchemaHandler schemaHandler
Schema handler.


connectionMgr

protected ConnectionManager connectionMgr
ConnectionManager


txConnectionFactoryName

protected java.lang.String txConnectionFactoryName
Name of transactional connection factory.


nontxConnectionFactoryName

protected java.lang.String nontxConnectionFactoryName
Name of non-transactional connection factory (null if not present).

Constructor Detail

AbstractStoreManager

protected AbstractStoreManager(java.lang.String key,
                               ClassLoaderResolver clr,
                               OMFContext omfContext)
Constructor for a new StoreManager. Stores the basic information required for the datastore management.

Parameters:
key - Key for this StoreManager
clr - the ClassLoaderResolver
omfContext - The corresponding ObjectManagerFactory context.
Method Detail

registerConnectionMgr

protected void registerConnectionMgr()
Register the default ConnectionManager implementation


registerConnectionFactory

protected void registerConnectionFactory()
Register the Connection Factory defined in plugins


close

public void close()
Description copied from interface: StoreManager
Release of resources.

Specified by:
close in interface StoreManager

getConnectionManager

public ConnectionManager getConnectionManager()
Description copied from interface: StoreManager
Accessor for the connection manager for this store manager.

Specified by:
getConnectionManager in interface StoreManager
Returns:
connection manager

getConnection

public ManagedConnection getConnection(ExecutionContext ec)
Accessor for a connection for the specified ObjectManager.

If there is an active transaction, a connection from the transactional connection factory will be returned. If there is no active transaction, a connection from the nontransactional connection factory will be returned.

Specified by:
getConnection in interface StoreManager
Parameters:
ec - execution context
Returns:
The Connection
Throws:
NucleusException - Thrown if an error occurs getting the connection

getConnection

public ManagedConnection getConnection(ExecutionContext ec,
                                       java.util.Map options)
Accessor for a connection for the specified ObjectManager.

If there is an active transaction, a connection from the transactional connection factory will be returned. If there is no active transaction, a connection from the nontransactional connection factory will be returned.

Specified by:
getConnection in interface StoreManager
Parameters:
ec - execution context
options - connetion options
Returns:
The Connection
Throws:
NucleusException - Thrown if an error occurs getting the connection

getConnection

public ManagedConnection getConnection(int isolation_level)
Utility to return a non-transactional Connection. This returns a connection from a secondary DataSource (e.g. javax.jdo.option.connectionFactory2Name), if it is provided.

Parameters:
isolation_level - The transaction isolation scheme to use e.g Connection.TRANSACTION_NONE Pass in -1 if just want the default
Returns:
The Connection to the datastore
Throws:
NucleusException - if an error occurs getting the connection

getConnectionDriverName

public java.lang.String getConnectionDriverName()
Convenience accessor for the driver name to use for the connection (if applicable for this datastore).

Specified by:
getConnectionDriverName in interface StoreManager
Returns:
Driver name for the connection

getConnectionURL

public java.lang.String getConnectionURL()
Convenience accessor for the URL for the connection

Specified by:
getConnectionURL in interface StoreManager
Returns:
Connection URL

getConnectionUserName

public java.lang.String getConnectionUserName()
Convenience accessor for the username to use for the connection

Specified by:
getConnectionUserName in interface StoreManager
Returns:
Username

getConnectionPassword

public java.lang.String getConnectionPassword()
Convenience accessor for the password to use for the connection. Will perform decryption if the persistence property "datanucleus.ConnectionPasswordDecrypter" has also been specified.

Specified by:
getConnectionPassword in interface StoreManager
Returns:
Password

getConnectionFactory

public java.lang.Object getConnectionFactory()
Convenience accessor for the factory for the connection (transactional).

Specified by:
getConnectionFactory in interface StoreManager
Returns:
Connection Factory (transactional)

getConnectionFactoryName

public java.lang.String getConnectionFactoryName()
Convenience accessor for the factory name for the connection (transactional).

Specified by:
getConnectionFactoryName in interface StoreManager
Returns:
Connection Factory name (transactional)

getConnectionFactory2

public java.lang.Object getConnectionFactory2()
Convenience accessor for the factory for the connection (non-transactional).

Specified by:
getConnectionFactory2 in interface StoreManager
Returns:
Connection Factory (non-transactional)

getConnectionFactory2Name

public java.lang.String getConnectionFactory2Name()
Convenience accessor for the factory name for the connection (non-transactional).

Specified by:
getConnectionFactory2Name in interface StoreManager
Returns:
Connection Factory name (non-transactional)

getRuntimeManager

public StoreManagerRuntime getRuntimeManager()
Description copied from interface: StoreManager
Accessor for the runtime management of this component (if specified as required to the PMF/EMF).

Specified by:
getRuntimeManager in interface StoreManager
Returns:
Runtime manager (JMX) for this store

getPersistenceHandler

public StorePersistenceHandler getPersistenceHandler()
Description copied from interface: StoreManager
Accessor for the store persistence handler.

Specified by:
getPersistenceHandler in interface StoreManager
Returns:
Store persistence handler.

getSchemaHandler

public StoreSchemaHandler getSchemaHandler()
Description copied from interface: StoreManager
Accessor for the store schema handler (if this datastore supports the concept of a schema).

Specified by:
getSchemaHandler in interface StoreManager
Returns:
Store schema handler.

getNucleusSequence

public NucleusSequence getNucleusSequence(ExecutionContext ec,
                                          SequenceMetaData seqmd)
Method to return a datastore sequence for this datastore matching the passed sequence MetaData.

Specified by:
getNucleusSequence in interface StoreManager
Parameters:
ec - execution context
seqmd - SequenceMetaData
Returns:
The Sequence

getNucleusConnection

public NucleusConnection getNucleusConnection(ExecutionContext ec)
Description copied from interface: StoreManager
Method to return a connection for the ObjectManager.

Specified by:
getNucleusConnection in interface StoreManager
Parameters:
ec - execution context
Returns:
The datastore Connection

getValueGenerationManager

public ValueGenerationManager getValueGenerationManager()
Description copied from interface: StoreManager
Accessor for the ValueGenerationManager for obtaining sequences.

Specified by:
getValueGenerationManager in interface StoreManager
Returns:
The ValueGenerationManagerr for this datastore

getApiAdapter

public ApiAdapter getApiAdapter()
Description copied from interface: StoreManager
Accessor for the API adapter.

Specified by:
getApiAdapter in interface StoreManager
Returns:
API adapter

getStoreManagerKey

public java.lang.String getStoreManagerKey()
Description copied from interface: StoreManager
Accessor for the key for this store manager.

Specified by:
getStoreManagerKey in interface StoreManager
Returns:
StoreManager key

getQueryCacheKey

public java.lang.String getQueryCacheKey()
Description copied from interface: StoreManager
Accessor for the key used for representing this store manager in the query cache.

Specified by:
getQueryCacheKey in interface StoreManager
Returns:
Key for the query cache

getOMFContext

public OMFContext getOMFContext()
Description copied from interface: StoreManager
Accessor for the context in which this StoreManager is running

Specified by:
getOMFContext in interface StoreManager
Returns:
Returns the context.

getMetaDataManager

public MetaDataManager getMetaDataManager()

getDatastoreDate

public java.util.Date getDatastoreDate()
Description copied from interface: StoreManager
Get the date/time of the datastore.

Specified by:
getDatastoreDate in interface StoreManager
Returns:
Date/time of the datastore

registerStoreData

protected void registerStoreData(StoreData data)
Method to register some data with the store. This will also register the data with the starter process.

Parameters:
data - The StoreData to add

deregisterAllStoreData

protected void deregisterAllStoreData()
Method to deregister all existing store data so that we are managing nothing.


logConfiguration

protected void logConfiguration()
Convenience method to log the configuration of this store manager.


printInformation

public void printInformation(java.lang.String category,
                             java.io.PrintStream ps)
                      throws java.lang.Exception
Method to output the information about the StoreManager. Supports the category "DATASTORE".

Specified by:
printInformation in interface StoreManager
Parameters:
category - Category of information
ps - PrintStream
Throws:
java.lang.Exception - Thrown if an error occurs in the output process

initialiseAutoStart

protected void initialiseAutoStart(ClassLoaderResolver clr)
                            throws DatastoreInitialisationException
Method to initialise the auto-start mechanism, loading up the classes from its store into memory so that we start from where we got to last time. Utilises the "autoStartMechanism" field that should have been set before now.

Parameters:
clr - The ClassLoaderResolver
Throws:
DatastoreInitialisationException

clearAutoStarter

protected void clearAutoStarter()
Method to clear the Auto-Starter status.


managesClass

public boolean managesClass(java.lang.String className)
Description copied from interface: StoreManager
Accessor for whether the specified class is managed currently

Specified by:
managesClass in interface StoreManager
Parameters:
className - The name of the class
Returns:
Whether it is managed

addClass

public void addClass(java.lang.String className,
                     ClassLoaderResolver clr)
Description copied from interface: StoreManager
Method to add a class to the managed list for this datastore manager.

Specified by:
addClass in interface StoreManager
Parameters:
className - Name of the class
clr - The ClassLoaderResolver

addClasses

public void addClasses(java.lang.String[] classNames,
                       ClassLoaderResolver clr)
Description copied from interface: StoreManager
Add classes to the persistence model for the datastore.

This method is primarily useful for applications that wish to perform all of their datastore initialization up front, rather than wait for the runtime to do it on-demand.

Specified by:
addClasses in interface StoreManager
Parameters:
classNames - The class(es) to be added.
clr - The ClassLoaderResolver

newStoreData

protected StoreData newStoreData(ClassMetaData cmd,
                                 ClassLoaderResolver clr)
Instantiate a StoreData instance using the provided ClassMetaData and ClassLoaderResolver. Override this method if you want to instantiate a subclass of StoreData.

Parameters:
cmd - MetaData for the class
clr - ClassLoader resolver

removeAllClasses

public void removeAllClasses(ClassLoaderResolver clr)
Description copied from interface: StoreManager
Remove all classes from the persistence model for the datastore. This empties the datastore of all datastore objects managed by us. All objects of types not managed are left untouched. In the case of RDBMS this means drop all tables for types managed by us.

Specified by:
removeAllClasses in interface StoreManager
Parameters:
clr - The ClassLoaderResolver

manageClassForIdentity

public java.lang.String manageClassForIdentity(java.lang.Object id,
                                               ClassLoaderResolver clr)
Description copied from interface: StoreManager
Convenience method to ensure that the class defined by the passed OID/SingleFIeldIdentity is managed by the store.

Specified by:
manageClassForIdentity in interface StoreManager
Parameters:
id - OID
clr - ClassLoader resolver
Returns:
The class name of the class associated to this identity

getExtent

public Extent getExtent(ExecutionContext ec,
                        java.lang.Class c,
                        boolean subclasses)
Description copied from interface: StoreManager
Interface to getting an Extent for a class.

Specified by:
getExtent in interface StoreManager
Parameters:
ec - execution context
c - The class requiring the Extent
subclasses - Whether to include subclasses of 'c'
Returns:
The Extent.

supportsQueryLanguage

public boolean supportsQueryLanguage(java.lang.String language)
Description copied from interface: StoreManager
Accessor for whether this query language is supported.

Specified by:
supportsQueryLanguage in interface StoreManager
Parameters:
language - The language
Returns:
Whether it is supported.

supportsValueStrategy

public boolean supportsValueStrategy(java.lang.String strategy)
Accessor for whether this value strategy is supported.

Specified by:
supportsValueStrategy in interface StoreManager
Parameters:
strategy - The strategy
Returns:
Whether it is supported.

getClassNameForObjectID

public java.lang.String getClassNameForObjectID(java.lang.Object id,
                                                ClassLoaderResolver clr,
                                                ExecutionContext ec)
Description copied from interface: StoreManager
Returns the class corresponding to the given object identity. If the object is an OID (datastore-identity), return the PC class specified in the identity. If the object is SingleFieldIdentity, return the PC class specified in the identity If the object is an AppID PK, return the PC class that uses it. If the object is a SCOID, return the SCO class. If the object is a PersistenceCapable class, return the class.

Specified by:
getClassNameForObjectID in interface StoreManager
Parameters:
id - The identity of some object.
clr - ClassLoader resolver
ec - execution context
Returns:
For datastore identity, return the class of the corresponding object. For application identity, return the class of the corresponding object or null if object does not exist.

isStrategyDatastoreAttributed

public boolean isStrategyDatastoreAttributed(IdentityStrategy identityStrategy,
                                             boolean datastoreIdentityField)
Method to return if a particular value strategy is attributed by the datastore. In this implementation we return true for IDENTITY, and false for others. Override in subclass if the datastore will attribute e.g SEQUENCE in the datastore.

Specified by:
isStrategyDatastoreAttributed in interface StoreManager
Parameters:
identityStrategy - The strategy
datastoreIdentityField - Whether this is a datastore id field
Returns:
Whether the strategy is attributed in the datastore

getStrategyValue

public java.lang.Object getStrategyValue(ExecutionContext ec,
                                         AbstractClassMetaData cmd,
                                         int absoluteFieldNumber)
Description copied from interface: StoreManager
Method to retrieve the value for a strategy for a particular field.

Specified by:
getStrategyValue in interface StoreManager
Parameters:
ec - execution context
cmd - AbstractClassMetaData for the class
absoluteFieldNumber - The field number
Returns:
The value

getStrategyForNative

protected java.lang.String getStrategyForNative(AbstractClassMetaData cmd,
                                                int absFieldNumber)
Method defining which value-strategy to use when the user specifies "native". Returns "increment" no matter what the field is. Override if your datastore requires something else.

Parameters:
cmd - Class requiring the strategy
absFieldNumber - Field of the class
Returns:
Just returns "increment".

getStrategyValueForGenerator

protected java.lang.Object getStrategyValueForGenerator(ValueGenerator generator,
                                                        ExecutionContext ec)
Accessor for the next value from the specified generator. This implementation simply returns generator.next(). Any case where the generator requires datastore connections should override this method.

Parameters:
generator - The generator
ec - execution context
Returns:
The next value.

getPropertiesForGenerator

protected java.util.Properties getPropertiesForGenerator(AbstractClassMetaData cmd,
                                                         int absoluteFieldNumber,
                                                         ExecutionContext ec,
                                                         SequenceMetaData seqmd,
                                                         TableGeneratorMetaData tablegenmd)
Method to return the properties to pass to the generator for the specified field.

Parameters:
cmd - MetaData for the class
absoluteFieldNumber - Number of the field (-1 = datastore identity)
ec - execution context
seqmd - Any sequence metadata
tablegenmd - Any table generator metadata
Returns:
The properties to use for this field

performVersionCheck

public void performVersionCheck(ObjectProvider sm,
                                java.lang.Object versionDatastore,
                                VersionMetaData versionMetaData)
Description copied from interface: StoreManager
Perform an optimistic version check on the passed object, against the passed version in the datastore.

Specified by:
performVersionCheck in interface StoreManager
Parameters:
sm - StateManager of the object to check
versionDatastore - Version of the object in the datastore
versionMetaData - VersionMetaData to use for checking

getSubClassesForClass

public java.util.HashSet<java.lang.String> getSubClassesForClass(java.lang.String className,
                                                                 boolean includeDescendents,
                                                                 ClassLoaderResolver clr)
Description copied from interface: StoreManager
Utility to return the names of the classes that are known subclasses of the provided class. Actually uses the MetaDataManager for determining what is a subclass since the MetaData is often registered before being needed by the Store.

Specified by:
getSubClassesForClass in interface StoreManager
Parameters:
className - Class for which we search for subclasses.
includeDescendents - Whether to include subclasses of subclasses etc
clr - The ClassLoaderResolver
Returns:
Set of classes that are subclasses of the input class. TODO Use method in MetaDataManager and remove this

notifyObjectIsOutdated

public void notifyObjectIsOutdated(ObjectProvider sm)
Description copied from interface: StoreManager
Notifies this store manager that the main memory (RAM, heap) copy of the PC object of the supplied StateManager may not be regarded as valid anymore. (The most common case is that the state of the PC becomes HOLLOW). This is especially important for object databases employing implicit storing from the main memory to the database (like DB4O). These databases may stop tracking the main memory copy and linking it with its on-disk copy, thus releasing memory. More importantly, these databases then know that the object should be reloaded when it is (maybe even implicitly) accessed again. To be clear: There may be multiple copies of the data of one PC object (from the user perspective), namely a copy in main memory (on the Java heap) and a copy in the database (usually on disk). As there may be multiple copies, some of these copies may be outdated or invalid. In case such a copy is to be accessed, its contents should not be used. Rather than that, the outdated copy should be overwritten by an authorative copy. This method marks the main memory copy of the object (on the Java heap) to be outdated in that sense.

Specified by:
notifyObjectIsOutdated in interface StoreManager

getBackingStoreForField

public Store getBackingStoreForField(ClassLoaderResolver clr,
                                     AbstractMemberMetaData fmd,
                                     java.lang.Class type)
Description copied from interface: StoreManager
Accessor for the backing store for the specified field. Override it if the store needs this

Specified by:
getBackingStoreForField in interface StoreManager
Parameters:
clr - ClassLoader resolver
fmd - MetaData for the field/property
type - Type
Returns:
Backing store

getSupportedOptions

public java.util.Collection<java.lang.String> getSupportedOptions()
Accessor for the supported options in string form. Typical values specified here are :-

Specified by:
getSupportedOptions in interface StoreManager

assertReadOnlyForUpdateOfObject

public void assertReadOnlyForUpdateOfObject(ObjectProvider op)
Convenience method to assert when this StoreManager is read-only and the specified object is attempting to be updated.

Parameters:
op - ObjectProvider for the object

transactionStarted

public void transactionStarted(ExecutionContext ec)
Description copied from interface: StoreManager
Method to inform the StoreManager that a transaction has started for the specified execution context. This allows the StoreManager to initialise any objects as required.

Specified by:
transactionStarted in interface StoreManager
Parameters:
ec - ExecutionContext

transactionCommitted

public void transactionCommitted(ExecutionContext ec)
Description copied from interface: StoreManager
Method to inform the StoreManager that a transaction has committed for the specified execution context. This allows the StoreManager to close any objects as required.

Specified by:
transactionCommitted in interface StoreManager
Parameters:
ec - ExecutionContext

transactionRolledBack

public void transactionRolledBack(ExecutionContext ec)
Description copied from interface: StoreManager
Method to inform the StoreManager that a transaction has rolled back for the specified execution context. This allows the StoreManager to close any objects as required.

Specified by:
transactionRolledBack in interface StoreManager
Parameters:
ec - ExecutionContext


Copyright © 2011. All Rights Reserved.