|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.Torque
A static facade wrapper around the Torque implementation (which is in
TorqueInstance
).
Field Summary | |
static java.lang.String |
CACHE_KEY
property to determine whether caching is used. |
static java.lang.String |
DATABASE_DEFAULT
Deprecated. is not used any more. Use DATABASE_KEY and DEFAULT_KEY instead |
static java.lang.String |
DATABASE_KEY
the prefix for configuring the database adapters and the default database |
static java.lang.String |
DEFAULT_KEY
The key used to configure the name of the default database |
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 . |
static java.lang.String |
TORQUE_KEY
The prefix for all configuration keys used by Torque |
Constructor Summary | |
Torque()
C'tor for usage with the Stratum Lifecycle. |
Method Summary | |
static void |
closeConnection(java.sql.Connection con)
Closes a connection. |
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 DatabaseMap |
getDatabaseMap()
Returns the default database map information. |
static DatabaseMap |
getDatabaseMap(java.lang.String name)
Returns the database map information. |
static 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 AbstractBaseManager |
getManager(java.lang.String name)
This method returns a Manager for the given name. |
static 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 java.lang.String |
getSchema(java.lang.String name)
This method returns the current schema for a database connection |
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. |
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 |
setSchema(java.lang.String name,
java.lang.String schema)
Sets the current schema for a database connection |
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 |
public static final java.lang.String TORQUE_KEY
public static final java.lang.String DATABASE_KEY
public static final java.lang.String DEFAULT_KEY
public static final java.lang.String DATABASE_DEFAULT
public static final java.lang.String MANAGER_PREFIX
Manager
properties in the configuration.
public static final java.lang.String MANAGER_SUFFIX
Service
property determining its implementing
class name .
public static final java.lang.String CACHE_KEY
Constructor Detail |
public Torque()
Method Detail |
public static TorqueInstance getInstance()
TorqueInstance
used by this class.
public static void init(java.lang.String configFile) throws TorqueException
configFile
- The absolute path to the configuration file.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static void init(org.apache.commons.configuration.Configuration conf) throws TorqueException
conf
- The Torque configuration.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static boolean isInit()
public static void setConfiguration(org.apache.commons.configuration.Configuration conf)
conf
- the Configurationpublic static org.apache.commons.configuration.Configuration getConfiguration()
public static AbstractBaseManager getManager(java.lang.String name)
name
- name of the manager
public static AbstractBaseManager getManager(java.lang.String name, java.lang.String defaultClassName)
name
- name of the managerdefaultClassName
- the class to use if name has not been configured
public static void shutdown() throws TorqueException
TorqueException
- if a DataSourceFactory could not be closed
cleanly. Only the first exception is rethrown, any following
exceptions are logged but ignored.public static DatabaseMap getDatabaseMap() throws TorqueException
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static DatabaseMap getDatabaseMap(java.lang.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.public static void registerMapBuilder(java.lang.String className)
className
- the MapBuilderpublic static java.sql.Connection getConnection() throws TorqueException
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static java.sql.Connection getConnection(java.lang.String name) throws TorqueException
name
- The database name.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static java.sql.Connection getConnection(java.lang.String name, java.lang.String username, java.lang.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.public static DB getDB(java.lang.String name) throws TorqueException
name
- A pool name.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static java.lang.String getDefaultDB()
public static void closeConnection(java.sql.Connection con)
con
- A Connection to close.public static void setSchema(java.lang.String name, java.lang.String schema) throws TorqueException
name
- The database name.schema
- The current schema name
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static java.lang.String getSchema(java.lang.String name) throws TorqueException
name
- The database name.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |