org.apache.turbine.util.db.adapter
Class DBFactory

java.lang.Object
  |
  +--org.apache.turbine.util.db.adapter.DBFactory

public class DBFactory
extends java.lang.Object

This class creates different DB objects based on the database driver that is provided.

Version:
$Id: DBFactory.java,v 1.2 2001/10/21 20:59:42 dlr Exp $
Author:
Frank Y. Kim, Jon S. Stevens, Brett McLaughlin, Ralf Stranzenbach, Daniel Rall

Field Summary
private static java.util.Hashtable adapters
          A table of Class objects for registered adapters, keyed by the fully qualified class name of their associated JDBC driver.
 
Constructor Summary
DBFactory()
           
 
Method Summary
(package private) static void ()
           
static DB create(java.lang.String driver)
          Creates an instance of the Turbine database adapter associated with the specified JDBC driver.
private static void registerAdapter(java.lang.String driver, java.lang.Class adapterClass)
          Registers the Class of a database adapter at the factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

adapters

private static java.util.Hashtable adapters
A table of Class objects for registered adapters, keyed by the fully qualified class name of their associated JDBC driver.
Constructor Detail

DBFactory

public DBFactory()
Method Detail

static void ()

registerAdapter

private static void registerAdapter(java.lang.String driver,
                                    java.lang.Class adapterClass)
Registers the Class of a database adapter at the factory. This concept allows for dynamically adding new database adapters using the configuration files instead of changing the codebase.
Parameters:
driver - The fully-qualified class name of the JDBC driver to associate with an adapter.
adapterClass - The Class of the database adapter associated with driver.

create

public static DB create(java.lang.String driver)
                 throws java.lang.InstantiationException
Creates an instance of the Turbine database adapter associated with the specified JDBC driver. /** Creates a new instance of the Turbine database adapter associated with the specified JDBC driver.
Parameters:
driver - The fully-qualified name of the JDBC driver to create a new adapter instance for.
Returns:
An instance of a Turbine database adapter.


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.