public class FederatedStoreManager extends Object implements StoreManager
Assumes that there are persistence properties of the form
datanucleus.datastore.SecondStore=secondstore.properties datanucleus.datastore.ThirdStore=thirdstore.propertieswhere these properties files have the properties for the secondary stores with names "SecondStore", "ThirdStore".
Modifier and Type | Field and Description |
---|---|
protected PersistenceNucleusContext |
nucleusContext |
protected StorePersistenceHandler |
persistenceHandler
Persistence handler.
|
protected StoreManager |
primaryStoreMgr
Primary StoreManager.
|
static String |
PROPERTY_DATA_FEDERATION_DATASTORE_NAME |
protected QueryManager |
queryMgr
Query Manager.
|
protected Map<String,StoreManager> |
secondaryStoreMgrMap
Map of secondary StoreManager keyed by their symbolic name.
|
OPTION_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_TRANSACTION_ACID, OPTION_TXN_ISOLATION_READ_COMMITTED, OPTION_TXN_ISOLATION_READ_UNCOMMITTED, OPTION_TXN_ISOLATION_REPEATABLE_READ, OPTION_TXN_ISOLATION_SERIALIZABLE, RELATION_IDENTITY_STORAGE_PERSISTABLE_IDENTITY
Constructor and Description |
---|
FederatedStoreManager(ClassLoaderResolver clr,
PersistenceNucleusContext nucleusContext) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
ApiAdapter |
getApiAdapter()
Accessor for the API adapter.
|
Boolean |
getBooleanObjectProperty(String name) |
boolean |
getBooleanProperty(String name) |
boolean |
getBooleanProperty(String name,
boolean resultIfNotSet) |
String |
getClassNameForObjectID(Object id,
ClassLoaderResolver clr,
ExecutionContext ec)
Returns the class corresponding to the given object identity.
|
ManagedConnection |
getConnection(ExecutionContext ec) |
ManagedConnection |
getConnection(ExecutionContext ec,
Map options) |
ManagedConnection |
getConnection(int isolation_level) |
String |
getConnectionDriverName()
Convenience accessor for the driver name to use for the connections (where supported).
|
Object |
getConnectionFactory()
Convenience accessor for the primary connection factory (when a factory was provided by the user).
|
Object |
getConnectionFactory2()
Convenience accessor for the secondary connection factory (when a factory was provided by the user).
|
String |
getConnectionFactory2Name()
Convenience accessor for the factory (JNDI) name for the secondary connection factory (when provided by the user).
|
String |
getConnectionFactoryName()
Convenience accessor for the factory (JNDI) name for the primary connection factory (when provided by the user).
|
ConnectionManager |
getConnectionManager()
Accessor for the connection manager for this store manager.
|
String |
getConnectionPassword()
Convenience accessor for the password to use for the connections (where required).
|
String |
getConnectionURL()
Convenience accessor for the URL for the connections.
|
String |
getConnectionUserName()
Convenience accessor for the user name to use for the connections (where required).
|
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() |
int |
getIntProperty(String name) |
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() |
Object |
getProperty(String name) |
String |
getQueryCacheKey()
Accessor for the key used for representing this store manager in the query cache.
|
QueryManager |
getQueryManager() |
StoreSchemaHandler |
getSchemaHandler() |
StoreData |
getStoreDataForClass(String className) |
StoreManager |
getStoreManagerForClass(AbstractClassMetaData cmd)
Accessor for the StoreManager to use for persisting the specified class.
|
StoreManager |
getStoreManagerForClass(String className,
ClassLoaderResolver clr)
Accessor for the StoreManager to use for the specified class.
|
String |
getStoreManagerKey()
Accessor for the key for this store manager.
|
String |
getStringProperty(String name) |
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 |
getSupportedOptions()
Strings representing features that are supported by this datastore.
|
Collection<String> |
getSupportedQueryLanguages()
Accessor for the supported query languages.
|
ValueGenerationManager |
getValueGenerationManager()
Accessor for the ValueGenerationManager for generating field values.
|
String |
getValueGenerationStrategyForNative(AbstractClassMetaData cmd,
int absFieldNumber)
Method defining which value-strategy to use when the user specifies "native"/"auto".
|
Object |
getValueGenerationStrategyValue(ExecutionContext ec,
AbstractClassMetaData cmd,
int absoluteFieldNumber)
Method to retrieve the value for a value generation strategy for a particular field.
|
boolean |
hasProperty(String name) |
boolean |
isJdbcStore()
Returns whether the datastore is a "JDBC datastore".
|
boolean |
isValueGenerationStrategyDatastoreAttributed(AbstractClassMetaData cmd,
int absFieldNumber)
Convenience method to return whether the value generation strategy used by the specified class/member is generated in the datastore during a persist.
|
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 DatastoreId/SingleFieldId is managed by the store.
|
boolean |
managesClass(String className)
Accessor for whether the specified class is managed currently
|
Query |
newQuery(String language,
ExecutionContext ec)
Method to return a new query, for the specified language and ExecutionContext.
|
Query |
newQuery(String language,
ExecutionContext ec,
Query q)
Method to return a new query, for the specified language and ExecutionContext, using the specified existing query to copy from.
|
Query |
newQuery(String language,
ExecutionContext ec,
String queryString)
Method to return a new query, for the specified language and ExecutionContext, using the specified query string.
|
void |
printInformation(String category,
PrintStream ps)
Method to output particular information owned by this datastore.
|
boolean |
supportsQueryLanguage(String language)
Accessor for whether this query language is supported.
|
boolean |
supportsValueGenerationStrategy(String language)
Accessor for whether this value generation 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.
|
public static final String PROPERTY_DATA_FEDERATION_DATASTORE_NAME
protected StoreManager primaryStoreMgr
protected Map<String,StoreManager> secondaryStoreMgrMap
protected PersistenceNucleusContext nucleusContext
protected StorePersistenceHandler persistenceHandler
protected QueryManager queryMgr
public FederatedStoreManager(ClassLoaderResolver clr, PersistenceNucleusContext nucleusContext)
public PersistenceNucleusContext getNucleusContext()
StoreManager
getNucleusContext
in interface StoreManager
public MetaDataManager getMetaDataManager()
getMetaDataManager
in interface StoreManager
public FlushProcess getFlushProcess()
getFlushProcess
in interface StoreManager
public void close()
close
in interface StoreManager
public StoreManager getStoreManagerForClass(AbstractClassMetaData cmd)
cmd
- Metadata for the classpublic StoreManager getStoreManagerForClass(String className, ClassLoaderResolver clr)
className
- Name of the classclr
- ClassLoader resolverpublic void manageClasses(ClassLoaderResolver clr, String... classNames)
StoreManager
manageClasses
in interface StoreManager
clr
- The ClassLoaderResolverclassNames
- The class(es) to be managedpublic NamingFactory getNamingFactory()
getNamingFactory
in interface StoreManager
public ApiAdapter getApiAdapter()
StoreManager
getApiAdapter
in interface StoreManager
public String getClassNameForObjectID(Object id, ClassLoaderResolver clr, ExecutionContext ec)
StoreManager
getClassNameForObjectID
in interface StoreManager
id
- The identity of some object.clr
- ClassLoader resolverec
- execution contextpublic Date getDatastoreDate()
StoreManager
getDatastoreDate
in interface StoreManager
public 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 isJdbcStore()
StoreManager
isJdbcStore
in interface StoreManager
public NucleusConnection getNucleusConnection(ExecutionContext ec)
StoreManager
getNucleusConnection
in interface StoreManager
ec
- execution contextpublic NucleusSequence getNucleusSequence(ExecutionContext ec, SequenceMetaData seqmd)
StoreManager
getNucleusSequence
in interface StoreManager
ec
- execution contextseqmd
- SequenceMetaDatapublic StoreSchemaHandler getSchemaHandler()
getSchemaHandler
in interface StoreManager
public StoreData getStoreDataForClass(String className)
getStoreDataForClass
in interface StoreManager
public StorePersistenceHandler getPersistenceHandler()
getPersistenceHandler
in interface StoreManager
public QueryManager getQueryManager()
getQueryManager
in interface StoreManager
public Collection<String> getSupportedQueryLanguages()
StoreManager
getSupportedQueryLanguages
in interface StoreManager
public Query newQuery(String language, ExecutionContext ec)
StoreManager
newQuery
in interface StoreManager
language
- The query languageec
- ExecutionContextpublic Query newQuery(String language, ExecutionContext ec, String queryString)
StoreManager
newQuery
in interface StoreManager
language
- The query languageec
- ExecutionContextqueryString
- The query stringpublic Query newQuery(String language, ExecutionContext ec, Query q)
StoreManager
newQuery
in interface StoreManager
language
- The query languageec
- ExecutionContextq
- Existing querypublic ValueGenerationManager getValueGenerationManager()
StoreManager
getValueGenerationManager
in interface StoreManager
public String getStoreManagerKey()
StoreManager
getStoreManagerKey
in interface StoreManager
public String getQueryCacheKey()
StoreManager
getQueryCacheKey
in interface StoreManager
public Object getValueGenerationStrategyValue(ExecutionContext ec, AbstractClassMetaData cmd, int absoluteFieldNumber)
StoreManager
getValueGenerationStrategyValue
in interface StoreManager
ec
- execution contextcmd
- AbstractClassMetaData for the classabsoluteFieldNumber
- The field numberpublic boolean isValueGenerationStrategyDatastoreAttributed(AbstractClassMetaData cmd, int absFieldNumber)
StoreManager
isValueGenerationStrategyDatastoreAttributed
in interface StoreManager
cmd
- Metadata for the classabsFieldNumber
- number of the field (or -1 if for datastore-id)public String getValueGenerationStrategyForNative(AbstractClassMetaData cmd, int absFieldNumber)
StoreManager
getValueGenerationStrategyForNative
in interface StoreManager
cmd
- Class requiring the strategyabsFieldNumber
- Field of the classpublic 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 String manageClassForIdentity(Object id, ClassLoaderResolver clr)
StoreManager
manageClassForIdentity
in interface StoreManager
id
- identityclr
- ClassLoader resolverpublic boolean managesClass(String className)
StoreManager
managesClass
in interface StoreManager
className
- The name of the classpublic void printInformation(String category, PrintStream ps) throws Exception
StoreManager
printInformation
in interface StoreManager
category
- Category of informationps
- PrintStreamException
- Thrown if an error occurs in the output processpublic void unmanageAllClasses(ClassLoaderResolver clr)
StoreManager
unmanageAllClasses
in interface StoreManager
clr
- The ClassLoaderResolverpublic void unmanageClass(ClassLoaderResolver clr, String className, boolean removeFromDatastore)
StoreManager
unmanageClass
in interface StoreManager
clr
- ClassLoader resolverclassName
- Name of the classremoveFromDatastore
- Whether to also remove it from the datastore (otherwise just from the StoreManager)public boolean supportsQueryLanguage(String language)
StoreManager
supportsQueryLanguage
in interface StoreManager
language
- The languagepublic String getNativeQueryLanguage()
StoreManager
getNativeQueryLanguage
in interface StoreManager
public boolean supportsValueGenerationStrategy(String language)
StoreManager
supportsValueGenerationStrategy
in interface StoreManager
language
- The value generation strategypublic Collection getSupportedOptions()
StoreManager
getSupportedOptions
in interface StoreManager
public ConnectionManager getConnectionManager()
StoreManager
getConnectionManager
in interface StoreManager
public ManagedConnection getConnection(ExecutionContext ec)
public ManagedConnection getConnection(ExecutionContext ec, Map options)
public ManagedConnection getConnection(int isolation_level)
public String getConnectionDriverName()
StoreManager
getConnectionDriverName
in interface StoreManager
public String getConnectionURL()
StoreManager
getConnectionURL
in interface StoreManager
public String getConnectionUserName()
StoreManager
getConnectionUserName
in interface StoreManager
public String getConnectionPassword()
StoreManager
getConnectionPassword
in interface StoreManager
public Object getConnectionFactory()
StoreManager
getConnectionFactory
in interface StoreManager
public Object getConnectionFactory2()
StoreManager
getConnectionFactory2
in interface StoreManager
public String getConnectionFactory2Name()
StoreManager
getConnectionFactory2Name
in interface StoreManager
public String getConnectionFactoryName()
StoreManager
getConnectionFactoryName
in interface StoreManager
public Object getProperty(String name)
getProperty
in interface StoreManager
public boolean hasProperty(String name)
hasProperty
in interface StoreManager
public int getIntProperty(String name)
getIntProperty
in interface StoreManager
public boolean getBooleanProperty(String name)
getBooleanProperty
in interface StoreManager
public boolean getBooleanProperty(String name, boolean resultIfNotSet)
getBooleanProperty
in interface StoreManager
public Boolean getBooleanObjectProperty(String name)
getBooleanObjectProperty
in interface StoreManager
public String getStringProperty(String name)
getStringProperty
in interface StoreManager
public 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 useBackedSCOWrapperForMember(AbstractMemberMetaData mmd, ExecutionContext ec)
StoreManager
useBackedSCOWrapperForMember
in interface StoreManager
mmd
- Metadata for the memberec
- ExecutionContextpublic boolean usesBackedSCOWrappers()
StoreManager
usesBackedSCOWrappers
in interface StoreManager
public String getDefaultObjectProviderClassName()
getDefaultObjectProviderClassName
in interface StoreManager
Copyright © 2019. All rights reserved.