Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.apache.torque
Class Torque  view Torque download Torque.java

java.lang.Object
  extended byorg.apache.torque.Torque

public class Torque
extends java.lang.Object

A static facade wrapper around the Torque implementation (which is in TorqueInstance).
For historical reasons this class also contains a thin object which can be used to configure Torque with the Stratum Lifecycle. This is deprecated and will be removed in the future in favour of using Torque as an Avalon Component.

Version:
$Id: Torque.java,v 1.91.2.2 2004/05/20 04:35:16 seade Exp $

Field Summary
static java.lang.String CACHE_KEY
          property to determine whether caching is used.
static java.lang.String DATABASE_DEFAULT
          Name of property that specifies the default map builder and map.
static java.lang.String MANAGER_PREFIX
          A prefix for Manager properties in the configuration.
static java.lang.String MANAGER_SUFFIX
          A Service property determining its implementing class name .
private  org.apache.commons.configuration.Configuration memberConfig
          This is a member variable of Torque objects created by the Stratum lifecycle
private static TorqueInstance torqueSingleton
          The single instance of TorqueInstance used by the static API presented by this class.
 
Constructor Summary
Torque()
          C'tor for usage with the Stratum Lifecycle.
 
Method Summary
static void closeConnection(java.sql.Connection con)
          Closes a connection.
 void configure(org.apache.commons.configuration.Configuration conf)
          configure torque
 void dispose()
          Shuts down the service, Lifecycle style
static org.apache.commons.configuration.Configuration getConfiguration()
          Get the configuration for this component.
static java.sql.Connection getConnection()
          This method returns a Connection from the default pool.
static java.sql.Connection getConnection(java.lang.String name)
          This method returns a Connecton using the given database name.
static java.sql.Connection getConnection(java.lang.String name, java.lang.String username, java.lang.String password)
          This method returns a Connecton using the given parameters.
static org.apache.torque.map.DatabaseMap getDatabaseMap()
          Returns the default database map information.
static org.apache.torque.map.DatabaseMap getDatabaseMap(java.lang.String name)
          Returns the database map information.
static org.apache.torque.adapter.DB getDB(java.lang.String name)
          Returns database adapter for a specific connection pool.
static java.lang.String getDefaultDB()
          Returns the name of the default database.
static TorqueInstance getInstance()
          Retrieves the single TorqueInstance used by this class.
static org.apache.torque.manager.AbstractBaseManager getManager(java.lang.String name)
          This method returns a Manager for the given name.
static org.apache.torque.manager.AbstractBaseManager getManager(java.lang.String name, java.lang.String defaultClassName)
          This methods returns either the Manager from the configuration file, or the default one provided by the generated code.
static void init(org.apache.commons.configuration.Configuration conf)
          Initialization of Torque with a properties file.
static void init(java.lang.String configFile)
          Initialization of Torque with a properties file.
 void initialize()
          initialize Torque
static boolean isInit()
          Determine whether Torque has already been initialized.
static void registerMapBuilder(java.lang.String className)
          Register a MapBuilder
static void setConfiguration(org.apache.commons.configuration.Configuration conf)
          Sets the configuration for Torque and all dependencies.
static void shutdown()
          Shuts down the service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_DEFAULT

public static final java.lang.String DATABASE_DEFAULT
Name of property that specifies the default map builder and map.

See Also:
Constant Field Values

MANAGER_PREFIX

public static final java.lang.String MANAGER_PREFIX
A prefix for Manager properties in the configuration.

See Also:
Constant Field Values

MANAGER_SUFFIX

public static final java.lang.String MANAGER_SUFFIX
A Service property determining its implementing class name .

See Also:
Constant Field Values

CACHE_KEY

public static final java.lang.String CACHE_KEY
property to determine whether caching is used.

See Also:
Constant Field Values

torqueSingleton

private static TorqueInstance torqueSingleton
The single instance of TorqueInstance used by the static API presented by this class.


memberConfig

private org.apache.commons.configuration.Configuration memberConfig
This is a member variable of Torque objects created by the Stratum lifecycle

Constructor Detail

Torque

public Torque()
C'tor for usage with the Stratum Lifecycle.

Method Detail

getInstance

public static TorqueInstance getInstance()
Retrieves the single TorqueInstance used by this class.


init

public static void init(java.lang.String configFile)
                 throws TorqueException
Initialization of Torque with a properties file.


init

public static void init(org.apache.commons.configuration.Configuration conf)
                 throws TorqueException
Initialization of Torque with a properties file.


isInit

public static boolean isInit()
Determine whether Torque has already been initialized.


setConfiguration

public static void setConfiguration(org.apache.commons.configuration.Configuration conf)
Sets the configuration for Torque and all dependencies.


getConfiguration

public static org.apache.commons.configuration.Configuration getConfiguration()
Get the configuration for this component.


getManager

public static org.apache.torque.manager.AbstractBaseManager getManager(java.lang.String name)
This method returns a Manager for the given name.


getManager

public static org.apache.torque.manager.AbstractBaseManager getManager(java.lang.String name,
                                                                       java.lang.String defaultClassName)
This methods returns either the Manager from the configuration file, or the default one provided by the generated code.


shutdown

public static void shutdown()
Shuts down the service. This method halts the IDBroker's daemon thread in all of the DatabaseMap's.


getDatabaseMap

public static org.apache.torque.map.DatabaseMap getDatabaseMap()
                                                        throws TorqueException
Returns the default database map information.


getDatabaseMap

public static org.apache.torque.map.DatabaseMap getDatabaseMap(java.lang.String name)
                                                        throws TorqueException
Returns the database map information. Name relates to the name of the connection pool to associate with the map.


registerMapBuilder

public static void registerMapBuilder(java.lang.String className)
Register a MapBuilder


getConnection

public static java.sql.Connection getConnection()
                                         throws TorqueException
This method returns a Connection from the default pool.


getConnection

public static java.sql.Connection getConnection(java.lang.String name)
                                         throws TorqueException
This method returns a Connecton using the given database name.


getConnection

public static java.sql.Connection getConnection(java.lang.String name,
                                                java.lang.String username,
                                                java.lang.String password)
                                         throws TorqueException
This method returns a Connecton using the given parameters. You should only use this method if you need user based access to the database!


getDB

public static org.apache.torque.adapter.DB getDB(java.lang.String name)
                                          throws TorqueException
Returns database adapter for a specific connection pool.


getDefaultDB

public static java.lang.String getDefaultDB()
Returns the name of the default database.


closeConnection

public static void closeConnection(java.sql.Connection con)
Closes a connection.


configure

public void configure(org.apache.commons.configuration.Configuration conf)
               throws TorqueException
configure torque


initialize

public void initialize()
                throws TorqueException
initialize Torque


dispose

public void dispose()
Shuts down the service, Lifecycle style