Package org.castor.jdo.engine
Class DatabaseContext
- java.lang.Object
-
- org.castor.jdo.engine.DatabaseContext
-
public final class DatabaseContext extends java.lang.Object- Since:
- 0.9.9
- Version:
- $Revision: 8702 $ $Date: 2006-04-10 16:39:24 -0600 (Mon, 10 Apr 2006) $
- Author:
- Werner Guttmann, Ralf Joachim
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringGENERIC_ENGINEThe name of the generic SQL engine, if no SQL engine specified.
-
Constructor Summary
Constructors Modifier Constructor Description protectedDatabaseContext(java.lang.String name, java.lang.String engine, Mapping mapping, javax.transaction.TransactionManager txManager, ConnectionFactory factory)Constructs a new AbstractConnectionFactory with given name, engine and mapping.protectedDatabaseContext(JdoConf jdoConf, int index, Mapping mapping, ConnectionFactory factory)Constructs a new AbstractConnectionFactory with given database and mapping.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ConnectionFactorygetConnectionFactory()DatabasegetDatabase()Get the database configuration.LockEnginegetEngine()Get the LockEngine only available after initialization.MappinggetMapping()Get the mapping to load.java.lang.StringgetName()Get the name of the database configuration.javax.transaction.TransactionManagergetTransactionManager()Get the transaction manager.voidinitialize()Initialize factory if it had not been initialized before.voidinitializeFactory()voidsetClassDescriptorResolver(JDOClassDescriptorResolver classDescriptorResolver)Sets a customClassDescriptorResolverinstance.
-
-
-
Field Detail
-
GENERIC_ENGINE
public static final java.lang.String GENERIC_ENGINE
The name of the generic SQL engine, if no SQL engine specified.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
DatabaseContext
protected DatabaseContext(java.lang.String name, java.lang.String engine, Mapping mapping, javax.transaction.TransactionManager txManager, ConnectionFactory factory) throws MappingExceptionConstructs a new AbstractConnectionFactory with given name, engine and mapping. Factory will be ready to use without calling initialize first.- Parameters:
name- The Name of the database configuration.engine- The Name of the persistence factory to use.txManager- The transaction manager to use.mapping- The previously loaded mapping.- Throws:
MappingException- If LockEngine could not be initialized.
-
DatabaseContext
protected DatabaseContext(JdoConf jdoConf, int index, Mapping mapping, ConnectionFactory factory)Constructs a new AbstractConnectionFactory with given database and mapping. Initialize needs to be called before using the factory to create connections.- Parameters:
jdoConf- The JDO configuration.index- Index of the database configuration in the JDO configuration.mapping- The mapping to load.
-
-
Method Detail
-
initialize
public void initialize() throws MappingExceptionInitialize factory if it had not been initialized before.- Throws:
MappingException- If concrete factory or LockEngine fail to initialize or mapping could not be loaded.
-
initializeFactory
public void initializeFactory() throws MappingException- Throws:
MappingException
-
getConnectionFactory
public ConnectionFactory getConnectionFactory()
-
getName
public java.lang.String getName()
Get the name of the database configuration.- Returns:
- The name of the database configuration.
-
getDatabase
public Database getDatabase()
Get the database configuration.- Returns:
- The database configuration.
-
getMapping
public Mapping getMapping()
Get the mapping to load.- Returns:
- The mapping to load.
-
getTransactionManager
public javax.transaction.TransactionManager getTransactionManager()
Get the transaction manager.- Returns:
- The transaction manager.
-
getEngine
public LockEngine getEngine()
Get the LockEngine only available after initialization.- Returns:
- The LockEngine.
-
setClassDescriptorResolver
public void setClassDescriptorResolver(JDOClassDescriptorResolver classDescriptorResolver)
Sets a customClassDescriptorResolverinstance.- Parameters:
classDescriptorResolver- A customClassDescriptorResolverinstance to be used.
-
-