Class DatabaseContext

java.lang.Object
org.castor.jdo.engine.DatabaseContext

public final class DatabaseContext extends 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 Details

    • GENERIC_ENGINE

      public static final String GENERIC_ENGINE
      The name of the generic SQL engine, if no SQL engine specified.
      See Also:
  • Constructor Details

    • DatabaseContext

      protected DatabaseContext(String name, String engine, Mapping mapping, TransactionManager txManager, ConnectionFactory factory) throws MappingException
      Constructs 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.
      mapping - The previously loaded mapping.
      txManager - The transaction manager to use.
      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 Details

    • initialize

      public void initialize() throws MappingException
      Initialize 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 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 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 custom
      invalid reference
      ClassDescriptorResolver
      instance.
      Parameters:
      classDescriptorResolver - A custom
      invalid reference
      ClassDescriptorResolver
      instance to be used.