org.castor.jdo.engine
Class DatabaseRegistry

java.lang.Object
  extended by org.castor.jdo.engine.DatabaseRegistry

public final class DatabaseRegistry
extends java.lang.Object

Since:
0.9.9
Version:
$Revision: 1.4 $ $Date: 2005/08/17 13:37:07 $
Author:
Assaf Arkin, Bruce Snyder, Ralf Joachim

Method Summary
static void clear()
          Reset all database configurations.
static AbstractConnectionFactory getConnectionFactory(java.lang.String name)
          Get the ConnectionFactory for the given database name.
static boolean hasDatabaseRegistries()
          Check if any database configuration has been loaded.
static boolean isDatabaseRegistred(java.lang.String name)
          Check if database configuration with given name has been loaded.
static void loadDatabase(org.xml.sax.InputSource source, org.xml.sax.EntityResolver resolver, java.lang.ClassLoader loader)
          Instantiates a ConnectionFactory from the JDO configuration file
static void loadDatabase(JdoConf jdoConf, org.xml.sax.EntityResolver resolver, java.lang.ClassLoader loader)
          Instantiates a ConnectionFactory from an in-memory JDO configuration.
static void loadDatabase(java.lang.String name, java.lang.String engine, javax.sql.DataSource datasource, Mapping mapping, javax.transaction.TransactionManager txManager)
          Instantiates a DataSourceConnectionFactory with given name, engine, datasource and mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadDatabase

public static void loadDatabase(java.lang.String name,
                                java.lang.String engine,
                                javax.sql.DataSource datasource,
                                Mapping mapping,
                                javax.transaction.TransactionManager txManager)
                         throws MappingException
Instantiates a DataSourceConnectionFactory with given name, engine, datasource and mapping.

Parameters:
name - The Name of the database configuration.
engine - The Name of the persistence factory to use.
datasource - The preconfigured datasource to use for creating connections.
mapping - The previously loaded mapping.
txManager - The transaction manager to use.
Throws:
MappingException - If LockEngine could not be initialized.

loadDatabase

public static void loadDatabase(JdoConf jdoConf,
                                org.xml.sax.EntityResolver resolver,
                                java.lang.ClassLoader loader)
                         throws MappingException
Instantiates a ConnectionFactory from an in-memory JDO configuration.

Parameters:
jdoConf - An in-memory jdo configuration.
resolver - An entity resolver.
loader - A class loader
Throws:
MappingException - If the database cannot be instantiated/loadeed.

loadDatabase

public static void loadDatabase(org.xml.sax.InputSource source,
                                org.xml.sax.EntityResolver resolver,
                                java.lang.ClassLoader loader)
                         throws MappingException
Instantiates a ConnectionFactory from the JDO configuration file

Parameters:
source - InputSource pointing to the JDO configuration.
resolver - An entity resolver.
loader - A class loader
Throws:
MappingException - If the database cannot be instantiated/loadeed.

hasDatabaseRegistries

public static boolean hasDatabaseRegistries()
Check if any database configuration has been loaded.

Returns:
true if a databases configuration has been loaded.

isDatabaseRegistred

public static boolean isDatabaseRegistred(java.lang.String name)
Check if database configuration with given name has been loaded.

Parameters:
name - Name of the database to check if loaded.
Returns:
true if databases configuration has been loaded.

getConnectionFactory

public static AbstractConnectionFactory getConnectionFactory(java.lang.String name)
                                                      throws MappingException
Get the ConnectionFactory for the given database name.

Parameters:
name - Name of the database configuration.
Returns:
The ConnectionFactory for the given database name.
Throws:
MappingException - If database can not be instantiated.

clear

public static void clear()
Reset all database configurations.



Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com