Package org.apache.torque.avalon
Schnittstelle Torque
- Alle Superschnittstellen:
org.apache.avalon.framework.component.Component
- Alle bekannten Implementierungsklassen:
TorqueComponent
public interface Torque
extends org.apache.avalon.framework.component.Component
Avalon role interface for Torque.
- Version:
- $Id: Torque.java 1917245 2024-04-21 14:06:23Z tv $
- Autor:
- Henning P. Schmiedehausen, Thomas Vandahl
-
Feldübersicht
Felder -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
Closes a connection.getAdapter
(String name) Returns database adapter for a specific connection pool.org.apache.commons.configuration2.Configuration
Get the configuration for this component.This method returns a Connection from the default pool.getConnection
(String name) getConnection
(String name, String username, String password) This method returns a Connecton using the given parameters.getDatabase
(String databaseName) Returns the database for the keydatabaseName
.Returns the default database map information.getDatabaseMap
(String name) Returns the database map information.Returns a Map containing all Databases registered to Torque.Returns the name of the default database.<T extends AbstractBaseManager<? extends Persistent>>
TgetManager
(String name) This method returns a Manager for the given name.<T extends AbstractBaseManager<? extends Persistent>>
TgetManager
(String name, String defaultClassName) This methods returns either the Manager from the configuration file, or the default one provided by the generated code.getOrCreateDatabase
(String databaseName) Returns the database for the keydatabaseName
.This method returns the current schema for a database connectionboolean
isInit()
Determine whether Torque has already been initialized.void
Sets the current schema for a database connection
-
Felddetails
-
ROLE
The avalon role.
-
-
Methodendetails
-
isInit
boolean isInit()Determine whether Torque has already been initialized.- Gibt zurück:
- true if Torque is already initialized
-
getConfiguration
org.apache.commons.configuration2.Configuration getConfiguration()Get the configuration for this component.- Gibt zurück:
- the Configuration
-
getManager
This method returns a Manager for the given name.- Typparameter:
T
- manager class type- Parameter:
name
- name of the manager- Gibt zurück:
- a Manager
-
getManager
<T extends AbstractBaseManager<? extends Persistent>> T getManager(String name, String defaultClassName) This methods returns either the Manager from the configuration file, or the default one provided by the generated code.- Typparameter:
T
- manager class type- Parameter:
name
- name of the managerdefaultClassName
- the class to use if name has not been configured- Gibt zurück:
- a Manager
-
getDatabaseMap
Returns the default database map information.- Gibt zurück:
- A DatabaseMap.
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
getDatabaseMap
Returns the database map information. Name relates to the name of the connection pool to associate with the map.- Parameter:
name
- The name of the database corresponding to theDatabaseMap
to retrieve.- Gibt zurück:
- The named
DatabaseMap
. - Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
getConnection
This method returns a Connection from the default pool.- Gibt zurück:
- The requested connection.
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
getConnection
- Parameter:
name
- The database name.- Gibt zurück:
- a database connection
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
getConnection
This method returns a Connecton using the given parameters. You should only use this method if you need user based access to the database!- Parameter:
name
- The database name.username
- The name of the database user.password
- The password of the database user.- Gibt zurück:
- A Connection.
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
getAdapter
Returns database adapter for a specific connection pool.- Parameter:
name
- A pool name.- Gibt zurück:
- The corresponding database adapter.
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
getDefaultDB
String getDefaultDB()Returns the name of the default database.- Gibt zurück:
- name of the default DB
-
closeConnection
Closes a connection.- Parameter:
con
- A Connection to close.
-
setSchema
Sets the current schema for a database connection- Parameter:
name
- The database name.schema
- The current schema name- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
getSchema
This method returns the current schema for a database connection- Parameter:
name
- The database name.- Gibt zurück:
- The current schema name. Null means, no schema has been set.
- Löst aus:
TorqueException
- Any exceptions caught during processing will be rethrown wrapped into a TorqueException.
-
getDatabase
Returns the database for the keydatabaseName
.- Parameter:
databaseName
- the key to get the database for.- Gibt zurück:
- the database for the specified key, or null if the database does not exist.
- Löst aus:
TorqueException
- if Torque is not yet initialized.
-
getDatabases
Returns a Map containing all Databases registered to Torque. The key of the Map is the name of the database, and the value is the database instance.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.
- Gibt zurück:
- a Map containing all Databases known to Torque, never null.
- Löst aus:
TorqueException
- if Torque is not yet initialized.
-
getOrCreateDatabase
Returns the database for the keydatabaseName
. If no database is associated to the specified key, a new database is created, mapped to the specified key, and returned.- Parameter:
databaseName
- the key to get the database for.- Gibt zurück:
- the database associated with specified key, or the newly created database, never null.
-