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 static Localiser |
LOCALISER
Localisation of messages.
|
protected StorePersistenceHandler |
persistenceHandler
Persistence handler.
|
static String |
PROPERTY_DATA_FEDERATION_DATASTORE_NAME |
| Constructor and Description |
|---|
FederatedStoreManager(ClassLoaderResolver clr,
NucleusContext nucleusContext) |
| 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.
|
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)
Accessor for a connection for the specified ExecutionContext.
|
ManagedConnection |
getConnection(ExecutionContext ec,
Map options)
Accessor for a connection for the specified ExecutionContext.
|
String |
getConnectionDriverName()
Convenience accessor for the driver name to use for the connection.
|
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 user name 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) |
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.
|
Object |
getProperty(String name) |
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).
|
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.
|
Object |
getStrategyValue(ExecutionContext ec,
AbstractClassMetaData cmd,
int absoluteFieldNumber)
Method to retrieve the value for a strategy for a particular field.
|
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()
Accessor for the supported options in string form
|
ValueGenerationManager |
getValueGenerationManager()
Accessor for the ValueGenerationManager for obtaining sequences.
|
boolean |
hasProperty(String name) |
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 in the datastore during a persist.
|
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
|
void |
printInformation(String category,
PrintStream ps)
Method to output particular information owned by this datastore.
|
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 language)
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.
|
protected static final Localiser LOCALISER
public static final String PROPERTY_DATA_FEDERATION_DATASTORE_NAME
protected StorePersistenceHandler persistenceHandler
public FederatedStoreManager(ClassLoaderResolver clr, NucleusContext nucleusContext)
public NucleusContext getNucleusContext()
StoreManagergetNucleusContext in interface StoreManagerpublic FlushProcess getFlushProcess()
StoreManagergetFlushProcess in interface StoreManagerpublic void close()
StoreManagerclose in interface StoreManagerpublic StoreManager getStoreManagerForClass(AbstractClassMetaData cmd)
cmd - Metadata for the classpublic StoreManager getStoreManagerForClass(String className, ClassLoaderResolver clr)
className - Name of the classclr - ClassLoader resolverpublic void addClass(String className, ClassLoaderResolver clr)
StoreManageraddClass in interface StoreManagerclassName - Name of the classclr - The ClassLoaderResolverpublic void addClasses(String[] classNames, ClassLoaderResolver clr)
StoreManagerThis 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 StoreManagerclassNames - The class(es) to be added.clr - The ClassLoaderResolverpublic NamingFactory getNamingFactory()
StoreManagergetNamingFactory in interface StoreManagerpublic ApiAdapter getApiAdapter()
StoreManagergetApiAdapter in interface StoreManagerpublic String getClassNameForObjectID(Object id, ClassLoaderResolver clr, ExecutionContext ec)
StoreManagergetClassNameForObjectID in interface StoreManagerid - The identity of some object.clr - ClassLoader resolverec - execution contextpublic Date getDatastoreDate()
StoreManagergetDatastoreDate in interface StoreManagerpublic Extent getExtent(ExecutionContext ec, Class c, boolean subclasses)
StoreManagergetExtent in interface StoreManagerec - execution contextc - The class requiring the Extentsubclasses - Whether to include subclasses of 'c'public boolean isJdbcStore()
StoreManagerisJdbcStore in interface StoreManagerpublic NucleusConnection getNucleusConnection(ExecutionContext ec)
StoreManagergetNucleusConnection in interface StoreManagerec - execution contextpublic NucleusSequence getNucleusSequence(ExecutionContext ec, SequenceMetaData seqmd)
StoreManagergetNucleusSequence in interface StoreManagerec - execution contextseqmd - SequenceMetaDatapublic StoreSchemaHandler getSchemaHandler()
StoreManagergetSchemaHandler in interface StoreManagerpublic StorePersistenceHandler getPersistenceHandler()
StoreManagergetPersistenceHandler in interface StoreManagerpublic QueryManager getQueryManager()
StoreManagergetQueryManager in interface StoreManagerpublic ValueGenerationManager getValueGenerationManager()
StoreManagergetValueGenerationManager in interface StoreManagerpublic String getStoreManagerKey()
StoreManagergetStoreManagerKey in interface StoreManagerpublic String getQueryCacheKey()
StoreManagergetQueryCacheKey in interface StoreManagerpublic Object getStrategyValue(ExecutionContext ec, AbstractClassMetaData cmd, int absoluteFieldNumber)
StoreManagergetStrategyValue in interface StoreManagerec - execution contextcmd - AbstractClassMetaData for the classabsoluteFieldNumber - The field numberpublic 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 boolean isStrategyDatastoreAttributed(AbstractClassMetaData cmd, int absFieldNumber)
StoreManagerisStrategyDatastoreAttributed in interface StoreManagercmd - Metadata for the classabsFieldNumber - number of the field (or -1 if for datastore-id)public String manageClassForIdentity(Object id, ClassLoaderResolver clr)
StoreManagermanageClassForIdentity in interface StoreManagerid - OIDclr - ClassLoader resolverpublic boolean managesClass(String className)
StoreManagermanagesClass in interface StoreManagerclassName - The name of the classpublic void printInformation(String category, PrintStream ps) throws Exception
StoreManagerprintInformation in interface StoreManagercategory - Category of informationps - PrintStreamException - Thrown if an error occurs in the output processpublic void removeAllClasses(ClassLoaderResolver clr)
StoreManagerremoveAllClasses in interface StoreManagerclr - The ClassLoaderResolverpublic boolean supportsQueryLanguage(String language)
StoreManagersupportsQueryLanguage in interface StoreManagerlanguage - The languagepublic boolean supportsValueStrategy(String language)
StoreManagersupportsValueStrategy in interface StoreManagerlanguage - The strategypublic Collection getSupportedOptions()
StoreManagergetSupportedOptions in interface StoreManagerpublic ConnectionManager getConnectionManager()
StoreManagergetConnectionManager in interface StoreManagerpublic ManagedConnection getConnection(ExecutionContext ec)
StoreManagerIf 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.
getConnection in interface StoreManagerec - execution contextpublic ManagedConnection getConnection(ExecutionContext ec, Map options)
StoreManagerIf 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.
getConnection in interface StoreManagerec - execution contextoptions - connetion optionspublic String getConnectionDriverName()
StoreManagergetConnectionDriverName in interface StoreManagerpublic String getConnectionURL()
StoreManagergetConnectionURL in interface StoreManagerpublic String getConnectionUserName()
StoreManagergetConnectionUserName in interface StoreManagerpublic String getConnectionPassword()
StoreManagergetConnectionPassword in interface StoreManagerpublic Object getConnectionFactory()
StoreManagergetConnectionFactory in interface StoreManagerpublic Object getConnectionFactory2()
StoreManagergetConnectionFactory2 in interface StoreManagerpublic String getConnectionFactory2Name()
StoreManagergetConnectionFactory2Name in interface StoreManagerpublic String getConnectionFactoryName()
StoreManagergetConnectionFactoryName in interface StoreManagerpublic Object getProperty(String name)
getProperty in interface StoreManagerpublic boolean hasProperty(String name)
hasProperty in interface StoreManagerpublic int getIntProperty(String name)
getIntProperty in interface StoreManagerpublic boolean getBooleanProperty(String name)
getBooleanProperty in interface StoreManagerpublic boolean getBooleanProperty(String name, boolean resultIfNotSet)
getBooleanProperty in interface StoreManagerpublic Boolean getBooleanObjectProperty(String name)
getBooleanObjectProperty in interface StoreManagerpublic String getStringProperty(String name)
getStringProperty in interface StoreManagerpublic 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 isAutoCreateTables()
isAutoCreateTables in interface StoreManagerpublic boolean isAutoCreateConstraints()
isAutoCreateConstraints in interface StoreManagerpublic boolean isAutoCreateColumns()
isAutoCreateColumns in interface StoreManagerpublic boolean useBackedSCOWrapperForMember(AbstractMemberMetaData mmd, ExecutionContext ec)
StoreManageruseBackedSCOWrapperForMember in interface StoreManagermmd - Metadata for the memberec - ExecutionContextpublic String getDefaultObjectProviderClassName()
getDefaultObjectProviderClassName in interface StoreManagerCopyright © 2013. All Rights Reserved.