public abstract class AbstractStoreManager extends PropertyStore implements StoreManager
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.
| Modifier and Type | Field and Description |
|---|---|
protected ConnectionManager |
connectionMgr
ConnectionManager
|
protected FlushProcess |
flushProcess
The flush process appropriate for this datastore.
|
protected NamingFactory |
namingFactory
Naming factory.
|
protected PersistenceNucleusContext |
nucleusContext
Nucleus Context.
|
protected StorePersistenceHandler |
persistenceHandler
Persistence handler.
|
protected String |
primaryConnectionFactoryName
Name of primary connection factory.
|
protected QueryManager |
queryMgr
Query Manager.
|
protected StoreSchemaHandler |
schemaHandler
Schema handler.
|
protected String |
secondaryConnectionFactoryName
Name of secondary connection factory (null if not present).
|
protected StoreDataManager |
storeDataMgr
Manager for the data definition in the datastore.
|
protected String |
storeManagerKey
Key for this StoreManager e.g "rdbms", "neo4j"
|
protected ValueGenerationManager |
valueGenerationMgr
Manager for value generation.
|
frequentProperties, propertiesOPTION_APPLICATION_COMPOSITE_ID, OPTION_APPLICATION_ID, OPTION_DATASTORE_ID, OPTION_DATASTORE_TIME_STORES_MILLISECS, OPTION_DATASTORE_TIME_STORES_NANOSECS, OPTION_DATASTORE_TIMEOUT, OPTION_NONDURABLE_ID, OPTION_ORM, OPTION_ORM_EMBEDDED_ARRAY, OPTION_ORM_EMBEDDED_ARRAY_NESTED, OPTION_ORM_EMBEDDED_COLLECTION, OPTION_ORM_EMBEDDED_COLLECTION_NESTED, OPTION_ORM_EMBEDDED_MAP, OPTION_ORM_EMBEDDED_MAP_NESTED, OPTION_ORM_EMBEDDED_PC, OPTION_ORM_EMBEDDED_PC_NESTED, OPTION_ORM_FOREIGN_KEYS, OPTION_ORM_INHERITANCE_COMPLETE_TABLE, OPTION_ORM_INHERITANCE_JOINED_TABLE, OPTION_ORM_INHERITANCE_SINGLE_TABLE, OPTION_ORM_SECONDARY_TABLE, OPTION_ORM_SERIALISED_ARRAY_ELEMENT, OPTION_ORM_SERIALISED_COLLECTION_ELEMENT, OPTION_ORM_SERIALISED_MAP_KEY, OPTION_ORM_SERIALISED_MAP_VALUE, OPTION_ORM_SERIALISED_PC, OPTION_QUERY_CANCEL, OPTION_QUERY_JDOQL_BITWISE_OPS, OPTION_QUERY_JDOQL_BULK_DELETE, OPTION_QUERY_JDOQL_BULK_INSERT, OPTION_QUERY_JDOQL_BULK_UPDATE, OPTION_QUERY_JPQL_BULK_DELETE, OPTION_QUERY_JPQL_BULK_INSERT, OPTION_QUERY_JPQL_BULK_UPDATE, OPTION_TXN_ISOLATION_READ_COMMITTED, OPTION_TXN_ISOLATION_READ_UNCOMMITTED, OPTION_TXN_ISOLATION_REPEATABLE_READ, OPTION_TXN_ISOLATION_SERIALIZABLE| Modifier | Constructor and Description |
|---|---|
protected |
AbstractStoreManager(String key,
ClassLoaderResolver clr,
PersistenceNucleusContext nucleusContext,
Map<String,Object> props)
Constructor for a new StoreManager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
protected void |
deregisterAllStoreData()
Method to deregister all existing store data so that we are managing nothing.
|
ApiAdapter |
getApiAdapter()
Accessor for the API adapter.
|
Boolean |
getBooleanObjectProperty(String name)
Accessor for the specified property as a Boolean.
|
boolean |
getBooleanProperty(String name)
Accessor for the specified property as a boolean.
|
boolean |
getBooleanProperty(String name,
boolean resultIfNotSet)
Accessor for the specified property as a boolean.
|
String |
getClassNameForObjectID(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 ExecutionContext.
|
ManagedConnection |
getConnection(ExecutionContext ec,
Map options)
Accessor for a connection for the specified ExecutionContext.
|
ManagedConnection |
getConnection(int isolation_level)
Utility to return a managed connection not tied to any ExecutionContext.
|
String |
getConnectionDriverName()
Convenience accessor for the driver name to use for the connection (if applicable for this datastore).
|
Object |
getConnectionFactory()
Convenience accessor for the factory for the connection (transactional).
|
Object |
getConnectionFactory2()
Convenience accessor for the factory for the connection (non-transactional).
|
String |
getConnectionFactory2Name()
Convenience accessor for the factory name for the connection (non-transactional).
|
String |
getConnectionFactoryName()
Convenience accessor for the factory name for the connection (transactional).
|
ConnectionManager |
getConnectionManager()
Accessor for the connection manager for this store manager.
|
String |
getConnectionPassword()
Convenience accessor for the password to use for the connection.
|
String |
getConnectionURL()
Convenience accessor for the URL for the connection
|
String |
getConnectionUserName()
Convenience accessor for the username to use for the connection
|
Date |
getDatastoreDate()
Get the date/time of the datastore.
|
String |
getDefaultObjectProviderClassName() |
<T> Extent<T> |
getExtent(ExecutionContext ec,
Class<T> c,
boolean subclasses)
Interface to getting an Extent for a class.
|
FlushProcess |
getFlushProcess() |
int |
getIntProperty(String name)
Accessor for the specified property as an int.
|
MetaDataManager |
getMetaDataManager() |
NamingFactory |
getNamingFactory() |
String |
getNativeQueryLanguage()
Accessor for the native query language of this store.
|
NucleusConnection |
getNucleusConnection(ExecutionContext ec)
Method to return a connection to the user for the ExecutionContext.
|
PersistenceNucleusContext |
getNucleusContext()
Accessor for the context in which this StoreManager is running.
|
NucleusSequence |
getNucleusSequence(ExecutionContext ec,
SequenceMetaData seqmd)
Method to return a datastore sequence for this datastore matching the passed sequence MetaData.
|
StorePersistenceHandler |
getPersistenceHandler() |
protected 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.
|
Object |
getProperty(String name)
Method to get the value of a property from the store.
|
String |
getQueryCacheKey()
Accessor for the key used for representing this store manager in the query cache.
|
QueryManager |
getQueryManager() |
StoreSchemaHandler |
getSchemaHandler() |
StoreData |
getStoreDataForClass(String className) |
String |
getStoreManagerKey()
Accessor for the key for this store manager.
|
String |
getStrategyForNative(AbstractClassMetaData cmd,
int absFieldNumber)
Method defining which value-strategy to use when the user specifies "native".
|
Object |
getStrategyValue(ExecutionContext ec,
AbstractClassMetaData cmd,
int absoluteFieldNumber)
Method to retrieve the value for a strategy for a particular field.
|
protected Object |
getStrategyValueForGenerator(ValueGenerator generator,
ExecutionContext ec)
Accessor for the next value from the specified generator.
|
String |
getStringProperty(String name)
Accessor for the specified property as a String.
|
Collection<String> |
getSubClassesForClass(String className,
boolean includeDescendents,
ClassLoaderResolver clr)
Utility to return the names of the classes that are known subclasses of the provided
class.
|
Collection<String> |
getSupportedOptions()
Accessor for the supported options in string form.
|
ValueGenerationManager |
getValueGenerationManager()
Accessor for the ValueGenerationManager for obtaining sequences.
|
boolean |
hasProperty(String name)
Accessor for whether a particular property is defined (but may be null).
|
boolean |
isJdbcStore()
Returns whether the datastore is a "JDBC datastore".
|
boolean |
isStrategyDatastoreAttributed(AbstractClassMetaData cmd,
int absFieldNumber)
Convenience method to return whether the strategy used by the specified class/member is generated
by the datastore (during a persist).
|
protected void |
logConfiguration()
Convenience method to log the configuration of this store manager.
|
void |
manageClasses(ClassLoaderResolver clr,
String... classNames)
Manage the specified classes.
|
String |
manageClassForIdentity(Object id,
ClassLoaderResolver clr)
Convenience method to ensure that the class defined by the passed OID/SingleFIeldIdentity is
managed by the store.
|
boolean |
managesClass(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 |
printInformation(String category,
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.
|
boolean |
supportsQueryLanguage(String language)
Accessor for whether this query language is supported.
|
boolean |
supportsValueStrategy(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.
|
void |
unmanageAllClasses(ClassLoaderResolver clr)
Remove all classes from the persistence model for the datastore.
|
void |
unmanageClass(ClassLoaderResolver clr,
String className,
boolean removeFromDatastore)
Method to remove knowledge of the specified class from this StoreManager.
|
boolean |
useBackedSCOWrapperForMember(AbstractMemberMetaData mmd,
ExecutionContext ec)
Method to return whether the specified member should use a backed SCO wrapper.
|
boolean |
usesBackedSCOWrappers()
Whether this store manager uses backing-store based SCO wrappers.
|
getFrequentProperties, hasPropertyNotNull, setPropertyInternalprotected final String storeManagerKey
protected PersistenceNucleusContext nucleusContext
protected ValueGenerationManager valueGenerationMgr
protected StoreDataManager storeDataMgr
protected StorePersistenceHandler persistenceHandler
protected FlushProcess flushProcess
protected QueryManager queryMgr
protected StoreSchemaHandler schemaHandler
protected NamingFactory namingFactory
protected ConnectionManager connectionMgr
protected String primaryConnectionFactoryName
protected String secondaryConnectionFactoryName
protected AbstractStoreManager(String key, ClassLoaderResolver clr, PersistenceNucleusContext nucleusContext, Map<String,Object> props)
key - Key for this StoreManagerclr - the ClassLoaderResolvernucleusContext - The corresponding nucleus context.props - Any properties controlling this datastoreprotected void registerConnectionMgr()
protected void registerConnectionFactory()
public void close()
close in interface StoreManagerpublic ConnectionManager getConnectionManager()
StoreManagergetConnectionManager in interface StoreManagerpublic ManagedConnection getConnection(ExecutionContext ec)
getConnection in interface StoreManagerec - ExecutionContextNucleusException - Thrown if an error occurs getting the connectionpublic ManagedConnection getConnection(ExecutionContext ec, Map options)
getConnection in interface StoreManagerec - ExecutionContextoptions - Any options for the connectionNucleusException - Thrown if an error occurs getting the connectionpublic ManagedConnection getConnection(int isolation_level)
getConnection in interface StoreManagerisolation_level - The transaction isolation scheme to use See org.datanucleus.transaction.TransactionIsolation
Pass in -1 if just want the defaultNucleusException - if an error occurs getting the connectionpublic String getConnectionDriverName()
getConnectionDriverName in interface StoreManagerpublic String getConnectionURL()
getConnectionURL in interface StoreManagerpublic String getConnectionUserName()
getConnectionUserName in interface StoreManagerpublic String getConnectionPassword()
getConnectionPassword in interface StoreManagerpublic Object getConnectionFactory()
getConnectionFactory in interface StoreManagerpublic String getConnectionFactoryName()
getConnectionFactoryName in interface StoreManagerpublic Object getConnectionFactory2()
getConnectionFactory2 in interface StoreManagerpublic String getConnectionFactory2Name()
getConnectionFactory2Name in interface StoreManagerpublic boolean isJdbcStore()
StoreManagerisJdbcStore in interface StoreManagerpublic StorePersistenceHandler getPersistenceHandler()
getPersistenceHandler in interface StoreManagerpublic FlushProcess getFlushProcess()
getFlushProcess in interface StoreManagerpublic QueryManager getQueryManager()
getQueryManager in interface StoreManagerpublic StoreSchemaHandler getSchemaHandler()
getSchemaHandler in interface StoreManagerpublic NamingFactory getNamingFactory()
getNamingFactory in interface StoreManagerpublic NucleusSequence getNucleusSequence(ExecutionContext ec, SequenceMetaData seqmd)
getNucleusSequence in interface StoreManagerec - execution contextseqmd - SequenceMetaDatapublic NucleusConnection getNucleusConnection(ExecutionContext ec)
StoreManagergetNucleusConnection in interface StoreManagerec - execution contextpublic ValueGenerationManager getValueGenerationManager()
StoreManagergetValueGenerationManager in interface StoreManagerpublic ApiAdapter getApiAdapter()
StoreManagergetApiAdapter in interface StoreManagerpublic String getStoreManagerKey()
StoreManagergetStoreManagerKey in interface StoreManagerpublic String getQueryCacheKey()
StoreManagergetQueryCacheKey in interface StoreManagerpublic PersistenceNucleusContext getNucleusContext()
StoreManagergetNucleusContext in interface StoreManagerpublic MetaDataManager getMetaDataManager()
getMetaDataManager in interface StoreManagerpublic Date getDatastoreDate()
StoreManagergetDatastoreDate in interface StoreManagerpublic StoreData getStoreDataForClass(String className)
getStoreDataForClass in interface StoreManagerprotected void registerStoreData(StoreData data)
data - The StoreData to addprotected void deregisterAllStoreData()
protected void logConfiguration()
public void printInformation(String category, PrintStream ps) throws Exception
printInformation in interface StoreManagercategory - Category of informationps - PrintStreamException - Thrown if an error occurs in the output processpublic boolean managesClass(String className)
StoreManagermanagesClass in interface StoreManagerclassName - The name of the classpublic void manageClasses(ClassLoaderResolver clr, String... classNames)
StoreManagermanageClasses in interface StoreManagerclr - The ClassLoaderResolverclassNames - The class(es) to be managedprotected StoreData newStoreData(ClassMetaData cmd, ClassLoaderResolver clr)
cmd - MetaData for the classclr - ClassLoader resolverpublic void unmanageAllClasses(ClassLoaderResolver clr)
StoreManagerunmanageAllClasses in interface StoreManagerclr - The ClassLoaderResolverpublic void unmanageClass(ClassLoaderResolver clr, String className, boolean removeFromDatastore)
StoreManagerunmanageClass in interface StoreManagerclr - ClassLoader resolverclassName - Name of the classremoveFromDatastore - Whether to also remove it from the datastore (otherwise just from the StoreManager)public String manageClassForIdentity(Object id, ClassLoaderResolver clr)
StoreManagermanageClassForIdentity in interface StoreManagerid - OIDclr - ClassLoader resolverpublic <T> Extent<T> getExtent(ExecutionContext ec, Class<T> c, boolean subclasses)
StoreManagergetExtent in interface StoreManagerT - Type of the extentec - execution contextc - The class requiring the Extentsubclasses - Whether to include subclasses of 'c'public boolean supportsQueryLanguage(String language)
StoreManagersupportsQueryLanguage in interface StoreManagerlanguage - The languagepublic String getNativeQueryLanguage()
StoreManagergetNativeQueryLanguage in interface StoreManagerpublic boolean supportsValueStrategy(String strategy)
supportsValueStrategy in interface StoreManagerstrategy - The strategypublic String getClassNameForObjectID(Object id, ClassLoaderResolver clr, ExecutionContext ec)
StoreManagergetClassNameForObjectID in interface StoreManagerid - The identity of some object.clr - ClassLoader resolverec - execution contextpublic boolean isStrategyDatastoreAttributed(AbstractClassMetaData cmd, int absFieldNumber)
isStrategyDatastoreAttributed in interface StoreManagercmd - Metadata for the classabsFieldNumber - Absolute field number for the field (or -1 if datastore id)public Object getStrategyValue(ExecutionContext ec, AbstractClassMetaData cmd, int absoluteFieldNumber)
StoreManagergetStrategyValue in interface StoreManagerec - execution contextcmd - AbstractClassMetaData for the classabsoluteFieldNumber - The field numberpublic String getStrategyForNative(AbstractClassMetaData cmd, int absFieldNumber)
cmd - Class requiring the strategyabsFieldNumber - Field of the classprotected Object getStrategyValueForGenerator(ValueGenerator generator, ExecutionContext ec)
generator - The generatorec - execution contextprotected Properties getPropertiesForGenerator(AbstractClassMetaData cmd, int absoluteFieldNumber, ExecutionContext ec, SequenceMetaData seqmd, TableGeneratorMetaData tablegenmd)
cmd - MetaData for the classabsoluteFieldNumber - Number of the field (-1 = datastore identity)ec - execution contextseqmd - Any sequence metadatatablegenmd - Any table generator metadatapublic Collection<String> getSubClassesForClass(String className, boolean includeDescendents, ClassLoaderResolver clr)
StoreManagergetSubClassesForClass in interface StoreManagerclassName - Class for which we search for subclasses.includeDescendents - Whether to include subclasses of subclasses etcclr - The ClassLoaderResolverpublic Collection<String> getSupportedOptions()
getSupportedOptions in interface StoreManagerpublic boolean hasProperty(String name)
PropertyStorehasProperty in interface StoreManagerhasProperty in class PropertyStorename - Property namepublic Object getProperty(String name)
PropertyStoregetProperty in interface StoreManagergetProperty in class PropertyStorename - Name of the propertypublic int getIntProperty(String name)
PropertyStoregetIntProperty in interface StoreManagergetIntProperty in class PropertyStorename - Name of the propertypublic String getStringProperty(String name)
PropertyStoregetStringProperty in interface StoreManagergetStringProperty in class PropertyStorename - Name of the propertypublic boolean getBooleanProperty(String name)
PropertyStoregetBooleanProperty in interface StoreManagergetBooleanProperty in class PropertyStorename - Name of the propertypublic boolean getBooleanProperty(String name, boolean resultIfNotSet)
PropertyStoregetBooleanProperty in interface StoreManagergetBooleanProperty in class PropertyStorename - Name of the propertyresultIfNotSet - The value to return if no value for the specified property is found.public Boolean getBooleanObjectProperty(String name)
PropertyStoregetBooleanObjectProperty in interface StoreManagergetBooleanObjectProperty in class PropertyStorename - Name of the propertypublic void transactionStarted(ExecutionContext ec)
StoreManagertransactionStarted in interface StoreManagerec - ExecutionContextpublic void transactionCommitted(ExecutionContext ec)
StoreManagertransactionCommitted in interface StoreManagerec - ExecutionContextpublic void transactionRolledBack(ExecutionContext ec)
StoreManagertransactionRolledBack in interface StoreManagerec - ExecutionContextpublic boolean usesBackedSCOWrappers()
StoreManagerusesBackedSCOWrappers in interface StoreManagerpublic boolean useBackedSCOWrapperForMember(AbstractMemberMetaData mmd, ExecutionContext ec)
StoreManageruseBackedSCOWrapperForMember in interface StoreManagermmd - Metadata for the memberec - ExecutionContextpublic String getDefaultObjectProviderClassName()
getDefaultObjectProviderClassName in interface StoreManagerCopyright © 2018. All rights reserved.