Class 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 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 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.
        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 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.
      • 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 custom ClassDescriptorResolver instance.
        Parameters:
        classDescriptorResolver - A custom ClassDescriptorResolver instance to be used.