public interface Torque
extends org.apache.avalon.framework.component.Component
| Modifier and Type | Method and Description | 
|---|---|
| void | closeConnection(Connection con)Closes a connection. | 
| Adapter | getAdapter(String name)Returns database adapter for a specific connection pool. | 
| org.apache.commons.configuration2.Configuration | getConfiguration()Get the configuration for this component. | 
| Connection | getConnection()This method returns a Connection from the default pool. | 
| Connection | getConnection(String name) | 
| Connection | getConnection(String name,
             String username,
             String password)This method returns a Connecton using the given parameters. | 
| Database | getDatabase(String databaseName)Returns the database for the key  databaseName. | 
| DatabaseMap | getDatabaseMap()Returns the default database map information. | 
| DatabaseMap | getDatabaseMap(String name)Returns the database map information. | 
| Map<String,Database> | getDatabases()Returns a Map containing all Databases registered to Torque. | 
| String | getDefaultDB()Returns the name of the default database. | 
| <T extends AbstractBaseManager<? extends Persistent>> | getManager(String name)This method returns a Manager for the given name. | 
| <T extends AbstractBaseManager<? extends Persistent>> | getManager(String name,
          String defaultClassName)This methods returns either the Manager from the configuration file,
 or the default one provided by the generated code. | 
| Database | getOrCreateDatabase(String databaseName)Returns the database for the key  databaseName. | 
| String | getSchema(String name)This method returns the current schema for a database connection | 
| boolean | isInit()Determine whether Torque has already been initialized. | 
| void | setSchema(String name,
         String schema)Sets the current schema for a database connection | 
static final String ROLE
boolean isInit()
org.apache.commons.configuration2.Configuration getConfiguration()
<T extends AbstractBaseManager<? extends Persistent>> T getManager(String name)
T - manager class typename - name of the manager<T extends AbstractBaseManager<? extends Persistent>> T getManager(String name, String defaultClassName)
T - manager class typename - name of the managerdefaultClassName - the class to use if name has not been configuredDatabaseMap getDatabaseMap() throws TorqueException
TorqueException - Any exceptions caught during processing will be
         rethrown wrapped into a TorqueException.DatabaseMap getDatabaseMap(String name) throws TorqueException
name - The name of the database corresponding to the
        DatabaseMap to retrieve.DatabaseMap.TorqueException - Any exceptions caught during processing will be
         rethrown wrapped into a TorqueException.Connection getConnection() throws TorqueException
TorqueException - Any exceptions caught during processing will be
         rethrown wrapped into a TorqueException.Connection getConnection(String name) throws TorqueException
name - The database name.TorqueException - Any exceptions caught during processing will be
         rethrown wrapped into a TorqueException.Connection getConnection(String name, String username, String password) throws TorqueException
name - The database name.username - The name of the database user.password - The password of the database user.TorqueException - Any exceptions caught during processing will be
         rethrown wrapped into a TorqueException.Adapter getAdapter(String name) throws TorqueException
name - A pool name.TorqueException - Any exceptions caught during processing will be
         rethrown wrapped into a TorqueException.String getDefaultDB()
void closeConnection(Connection con)
con - A Connection to close.void setSchema(String name, String schema) throws TorqueException
name - The database name.schema - The current schema nameTorqueException - Any exceptions caught during processing will be
         rethrown wrapped into a TorqueException.String getSchema(String name) throws TorqueException
name - The database name.TorqueException - Any exceptions caught during processing will be
         rethrown wrapped into a TorqueException.Database getDatabase(String databaseName) throws TorqueException
databaseName.databaseName - the key to get the database for.TorqueException - if Torque is not yet initialized.Map<String,Database> getDatabases() throws TorqueException
Note that in the very special case where a new database which is not configured in Torque's configuration gets known to Torque at a later time, the returned map may change, and there is no way to protect you against this.
TorqueException - if Torque is not yet initialized.Database getOrCreateDatabase(String databaseName)
databaseName.
 If no database is associated to the specified key,
 a new database is created, mapped to the specified key, and returned.databaseName - the key to get the database for.Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.