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 boolean |
autoCreateColumns
Whether to auto create any columns that are missing.
|
protected boolean |
autoCreateConstraints
Whether to auto create any constraints
|
protected boolean |
autoCreateTables
Whether to auto create any tables.
|
protected boolean |
autoCreateWarnOnError
Whether to warn only when any errors occur on auto-create.
|
protected ConnectionManager |
connectionMgr
ConnectionManager
|
protected boolean |
fixedDatastore
Whether this datastore is fixed (no mods to table structure allowed).
|
protected FlushProcess |
flushProcess
The flush process appropriate for this datastore.
|
protected static Localiser |
LOCALISER
Localiser for messages.
|
protected NamingFactory |
namingFactory
Naming factory.
|
protected NucleusContext |
nucleusContext
Nucleus Context.
|
protected StorePersistenceHandler |
persistenceHandler
Persistence handler.
|
protected String |
primaryConnectionFactoryName
Name of primary connection factory.
|
protected boolean |
readOnlyDatastore
Whether this datastore is read only.
|
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", "db4o"
|
protected boolean |
validateColumns
Whether to validate any columns
|
protected boolean |
validateConstraints
Whether to validate any constraints
|
protected boolean |
validateTables
Whether to validate any tables
|
properties
Modifier | Constructor and Description |
---|---|
protected |
AbstractStoreManager(String key,
ClassLoaderResolver clr,
NucleusContext nucleusContext,
Map<String,Object> props)
Constructor for a new StoreManager.
|
Modifier and Type | Method and Description |
---|---|
void |
addClass(String className,
ClassLoaderResolver clr)
Method to add a class to the managed list for this datastore manager.
|
void |
addClasses(String[] classNames,
ClassLoaderResolver clr)
Add classes to the persistence model for the datastore.
|
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.
|
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() |
Extent |
getExtent(ExecutionContext ec,
Class c,
boolean subclasses)
Interface to getting an Extent for a class.
|
FlushProcess |
getFlushProcess()
Accessor for the flush process to use with this datastore.
|
int |
getIntProperty(String name)
Accessor for the specified property as an int.
|
MetaDataManager |
getMetaDataManager() |
NamingFactory |
getNamingFactory()
Accessor for the schema naming factory.
|
NucleusConnection |
getNucleusConnection(ExecutionContext ec)
Method to return a connection to the user for the ExecutionContext.
|
NucleusContext |
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()
Accessor for the store persistence handler.
|
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()
Accessor for the query manager for this datastore.
|
StoreSchemaHandler |
getSchemaHandler()
Accessor for the store schema handler (if this datastore supports the concept of a schema).
|
String |
getStoreManagerKey()
Accessor for the key for this store manager.
|
protected 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 |
isAutoCreateColumns() |
boolean |
isAutoCreateConstraints() |
boolean |
isAutoCreateTables() |
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).
|
boolean |
isValidateColumns() |
boolean |
isValidateConstraints() |
boolean |
isValidateTables() |
protected void |
logConfiguration()
Convenience method to log the configuration of this store manager.
|
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.
|
void |
removeAllClasses(ClassLoaderResolver clr)
Remove all classes from the persistence model for the datastore.
|
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.
|
boolean |
useBackedSCOWrapperForMember(AbstractMemberMetaData mmd,
ExecutionContext ec)
Method to return whether the specified member should use a backed SCO wrapper.
|
boolean |
usesBackedSCOWrappers() |
hasPropertyNotNull, setPropertyInternal
protected static final Localiser LOCALISER
protected final String storeManagerKey
protected final boolean readOnlyDatastore
protected final boolean fixedDatastore
protected final boolean autoCreateTables
protected final boolean autoCreateColumns
protected final boolean autoCreateConstraints
protected final boolean autoCreateWarnOnError
protected final boolean validateTables
protected final boolean validateColumns
protected final boolean validateConstraints
protected final NucleusContext nucleusContext
protected StoreDataManager storeDataMgr
protected StorePersistenceHandler persistenceHandler
protected FlushProcess flushProcess
protected StoreSchemaHandler schemaHandler
protected NamingFactory namingFactory
protected ConnectionManager connectionMgr
protected String primaryConnectionFactoryName
protected String secondaryConnectionFactoryName
protected AbstractStoreManager(String key, ClassLoaderResolver clr, NucleusContext 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()
StoreManager
close
in interface StoreManager
public ConnectionManager getConnectionManager()
StoreManager
getConnectionManager
in interface StoreManager
public ManagedConnection getConnection(ExecutionContext ec)
getConnection
in interface StoreManager
ec
- ExecutionContextNucleusException
- Thrown if an error occurs getting the connectionpublic ManagedConnection getConnection(ExecutionContext ec, Map options)
getConnection
in interface StoreManager
ec
- ExecutionContextoptions
- Any options for the connectionNucleusException
- Thrown if an error occurs getting the connectionpublic ManagedConnection getConnection(int isolation_level)
isolation_level
- The transaction isolation scheme to use e.g Connection.TRANSACTION_NONE
Pass in -1 if just want the defaultNucleusException
- if an error occurs getting the connectionpublic String getConnectionDriverName()
getConnectionDriverName
in interface StoreManager
public String getConnectionURL()
getConnectionURL
in interface StoreManager
public String getConnectionUserName()
getConnectionUserName
in interface StoreManager
public String getConnectionPassword()
getConnectionPassword
in interface StoreManager
public Object getConnectionFactory()
getConnectionFactory
in interface StoreManager
public String getConnectionFactoryName()
getConnectionFactoryName
in interface StoreManager
public Object getConnectionFactory2()
getConnectionFactory2
in interface StoreManager
public String getConnectionFactory2Name()
getConnectionFactory2Name
in interface StoreManager
public boolean isAutoCreateTables()
isAutoCreateTables
in interface StoreManager
public boolean isAutoCreateColumns()
isAutoCreateColumns
in interface StoreManager
public boolean isAutoCreateConstraints()
isAutoCreateConstraints
in interface StoreManager
public boolean isValidateTables()
public boolean isValidateColumns()
public boolean isValidateConstraints()
public boolean isJdbcStore()
StoreManager
isJdbcStore
in interface StoreManager
public StorePersistenceHandler getPersistenceHandler()
StoreManager
getPersistenceHandler
in interface StoreManager
public FlushProcess getFlushProcess()
StoreManager
getFlushProcess
in interface StoreManager
public QueryManager getQueryManager()
StoreManager
getQueryManager
in interface StoreManager
public StoreSchemaHandler getSchemaHandler()
StoreManager
getSchemaHandler
in interface StoreManager
public NamingFactory getNamingFactory()
StoreManager
getNamingFactory
in interface StoreManager
public NucleusSequence getNucleusSequence(ExecutionContext ec, SequenceMetaData seqmd)
getNucleusSequence
in interface StoreManager
ec
- execution contextseqmd
- SequenceMetaDatapublic NucleusConnection getNucleusConnection(ExecutionContext ec)
StoreManager
getNucleusConnection
in interface StoreManager
ec
- execution contextpublic ValueGenerationManager getValueGenerationManager()
StoreManager
getValueGenerationManager
in interface StoreManager
public ApiAdapter getApiAdapter()
StoreManager
getApiAdapter
in interface StoreManager
public String getStoreManagerKey()
StoreManager
getStoreManagerKey
in interface StoreManager
public String getQueryCacheKey()
StoreManager
getQueryCacheKey
in interface StoreManager
public NucleusContext getNucleusContext()
StoreManager
getNucleusContext
in interface StoreManager
public MetaDataManager getMetaDataManager()
public Date getDatastoreDate()
StoreManager
getDatastoreDate
in interface StoreManager
protected 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 StoreManager
category
- Category of informationps
- PrintStreamException
- Thrown if an error occurs in the output processpublic boolean managesClass(String className)
StoreManager
managesClass
in interface StoreManager
className
- The name of the classpublic void addClass(String className, ClassLoaderResolver clr)
StoreManager
addClass
in interface StoreManager
className
- Name of the classclr
- The ClassLoaderResolverpublic void addClasses(String[] classNames, ClassLoaderResolver clr)
StoreManager
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.
addClasses
in interface StoreManager
classNames
- The class(es) to be added.clr
- The ClassLoaderResolverprotected StoreData newStoreData(ClassMetaData cmd, ClassLoaderResolver clr)
cmd
- MetaData for the classclr
- ClassLoader resolverpublic void removeAllClasses(ClassLoaderResolver clr)
StoreManager
removeAllClasses
in interface StoreManager
clr
- The ClassLoaderResolverpublic String manageClassForIdentity(Object id, ClassLoaderResolver clr)
StoreManager
manageClassForIdentity
in interface StoreManager
id
- OIDclr
- ClassLoader resolverpublic Extent getExtent(ExecutionContext ec, Class c, boolean subclasses)
StoreManager
getExtent
in interface StoreManager
ec
- execution contextc
- The class requiring the Extentsubclasses
- Whether to include subclasses of 'c'public boolean supportsQueryLanguage(String language)
StoreManager
supportsQueryLanguage
in interface StoreManager
language
- The languagepublic boolean supportsValueStrategy(String strategy)
supportsValueStrategy
in interface StoreManager
strategy
- The strategypublic String getClassNameForObjectID(Object id, ClassLoaderResolver clr, ExecutionContext ec)
StoreManager
getClassNameForObjectID
in interface StoreManager
id
- The identity of some object.clr
- ClassLoader resolverec
- execution contextpublic boolean isStrategyDatastoreAttributed(AbstractClassMetaData cmd, int absFieldNumber)
isStrategyDatastoreAttributed
in interface StoreManager
cmd
- Metadata for the classabsFieldNumber
- Absolute field number for the field (or -1 if datastore id)public Object getStrategyValue(ExecutionContext ec, AbstractClassMetaData cmd, int absoluteFieldNumber)
StoreManager
getStrategyValue
in interface StoreManager
ec
- execution contextcmd
- AbstractClassMetaData for the classabsoluteFieldNumber
- The field numberprotected 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)
StoreManager
getSubClassesForClass
in interface StoreManager
className
- Class for which we search for subclasses.includeDescendents
- Whether to include subclasses of subclasses etcclr
- The ClassLoaderResolverpublic Collection<String> getSupportedOptions()
getSupportedOptions
in interface StoreManager
public boolean hasProperty(String name)
PropertyStore
hasProperty
in interface StoreManager
hasProperty
in class PropertyStore
name
- Property namepublic Object getProperty(String name)
PropertyStore
getProperty
in interface StoreManager
getProperty
in class PropertyStore
name
- Name of the propertypublic int getIntProperty(String name)
PropertyStore
getIntProperty
in interface StoreManager
getIntProperty
in class PropertyStore
name
- Name of the propertypublic String getStringProperty(String name)
PropertyStore
getStringProperty
in interface StoreManager
getStringProperty
in class PropertyStore
name
- Name of the propertypublic boolean getBooleanProperty(String name)
PropertyStore
getBooleanProperty
in interface StoreManager
getBooleanProperty
in class PropertyStore
name
- Name of the propertypublic boolean getBooleanProperty(String name, boolean resultIfNotSet)
PropertyStore
getBooleanProperty
in interface StoreManager
getBooleanProperty
in class PropertyStore
name
- Name of the propertyresultIfNotSet
- The value to return if no value for the specified property is found.public Boolean getBooleanObjectProperty(String name)
PropertyStore
getBooleanObjectProperty
in interface StoreManager
getBooleanObjectProperty
in class PropertyStore
name
- Name of the propertypublic void transactionStarted(ExecutionContext ec)
StoreManager
transactionStarted
in interface StoreManager
ec
- ExecutionContextpublic void transactionCommitted(ExecutionContext ec)
StoreManager
transactionCommitted
in interface StoreManager
ec
- ExecutionContextpublic void transactionRolledBack(ExecutionContext ec)
StoreManager
transactionRolledBack
in interface StoreManager
ec
- ExecutionContextpublic boolean usesBackedSCOWrappers()
public boolean useBackedSCOWrapperForMember(AbstractMemberMetaData mmd, ExecutionContext ec)
StoreManager
useBackedSCOWrapperForMember
in interface StoreManager
mmd
- Metadata for the memberec
- ExecutionContextpublic String getDefaultObjectProviderClassName()
getDefaultObjectProviderClassName
in interface StoreManager
Copyright © 2019. All rights reserved.