|
|||||||||
| Home >> All >> org >> apache >> [ torque overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.torque
Class TorqueInstance

java.lang.Objectorg.apache.torque.TorqueInstance
- public class TorqueInstance
- extends java.lang.Object
The core of Torque's implementation. Both the classic Torque static wrapper and the org.apache.torque.avalon.TorqueComponent Avalon implementation leverage
this class.
- Version:
- $Id: TorqueInstance.java,v 1.5.2.5 2004/08/23 02:54:16 seade Exp $
| Field Summary | |
private java.util.Map |
adapterMap
The cache of DB adapter keys |
private org.apache.commons.configuration.Configuration |
conf
Torque-specific configuration. |
private java.util.Map |
dbMaps
The global cache of database maps |
private static java.lang.String |
DEFAULT_NAME
A constant for default. |
private java.lang.String |
defaultDBName
The db name that is specified as the default in the property file |
private java.util.Map |
dsFactoryMap
The cache of DataSourceFactory's |
private boolean |
isInit
flag to set to true once this class has been initialized |
private static org.apache.commons.logging.Log |
log
Logging |
private java.util.Map |
managers
A repository of Manager instances. |
private java.util.List |
mapBuilders
Store mapbuilder classnames for peers that have been referenced prior to Torque being initialized. |
| Constructor Summary | |
TorqueInstance()
Creates a new instance with default configuration. |
|
| Method Summary | |
void |
closeConnection(java.sql.Connection con)
Closes a connection. |
org.apache.commons.configuration.Configuration |
getConfiguration()
Get the configuration for this component. |
java.sql.Connection |
getConnection()
This method returns a Connection from the default pool. |
java.sql.Connection |
getConnection(java.lang.String name)
|
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. |
org.apache.torque.map.DatabaseMap |
getDatabaseMap()
Returns the default database map information. |
org.apache.torque.map.DatabaseMap |
getDatabaseMap(java.lang.String name)
Returns the database map information. |
private java.lang.String |
getDatabaseProperty(java.lang.String db,
java.lang.String prop)
Returns the specified property of the given database, or the empty string if no value is set for the property. |
org.apache.torque.adapter.DB |
getDB(java.lang.String name)
Returns database adapter for a specific connection pool. |
java.lang.String |
getDefaultDB()
Returns the name of the default database. |
org.apache.torque.manager.AbstractBaseManager |
getManager(java.lang.String name)
This method returns a Manager for the given name. |
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. |
void |
init(org.apache.commons.configuration.Configuration conf)
Initialization of Torque with a properties file. |
void |
init(java.lang.String configFile)
Initialization of Torque with a properties file. |
private void |
initAdapters(org.apache.commons.configuration.Configuration conf)
|
private org.apache.torque.map.DatabaseMap |
initDatabaseMap(java.lang.String name)
Creates and initializes the mape for the named database. |
private void |
initDataSourceFactories(org.apache.commons.configuration.Configuration conf)
|
private void |
initialize()
Initializes this instance of Torque. |
private void |
initManager(java.lang.String name,
java.lang.String className)
Initialize a manager |
protected void |
initManagerMappings(org.apache.commons.configuration.Configuration conf)
Creates a mapping between classes and their manager classes. |
boolean |
isInit()
Determine whether Torque has already been initialized. |
void |
registerMapBuilder(java.lang.String className)
Register a MapBuilder |
private void |
resetConfiguration()
Resets some internal configuration variables to their defaults. |
void |
setConfiguration(org.apache.commons.configuration.Configuration conf)
Sets the configuration for Torque and all dependencies. |
private void |
setupIdTable(org.apache.torque.map.DatabaseMap map)
Setup IDBroker's table information within given database map. |
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 |
log
private static org.apache.commons.logging.Log log
- Logging
DEFAULT_NAME
private static final java.lang.String DEFAULT_NAME
- A constant for
default.- See Also:
- Constant Field Values
defaultDBName
private java.lang.String defaultDBName
- The db name that is specified as the default in the property file
dbMaps
private java.util.Map dbMaps
- The global cache of database maps
dsFactoryMap
private java.util.Map dsFactoryMap
- The cache of DataSourceFactory's
adapterMap
private java.util.Map adapterMap
- The cache of DB adapter keys
managers
private java.util.Map managers
- A repository of Manager instances.
conf
private org.apache.commons.configuration.Configuration conf
- Torque-specific configuration.
isInit
private boolean isInit
- flag to set to true once this class has been initialized
mapBuilders
private java.util.List mapBuilders
- Store mapbuilder classnames for peers that have been referenced prior
to Torque being initialized. This can happen if torque om/peer objects
are serialized then unserialized prior to Torque being reinitialized.
This condition exists in a normal catalina restart.
| Constructor Detail |
TorqueInstance
public TorqueInstance()
- Creates a new instance with default configuration.
| Method Detail |
initialize
private void initialize()
throws TorqueException
- Initializes this instance of Torque.
initAdapters
private final void initAdapters(org.apache.commons.configuration.Configuration conf) throws TorqueException
initDataSourceFactories
private void initDataSourceFactories(org.apache.commons.configuration.Configuration conf) throws TorqueException
init
public void init(java.lang.String configFile) throws TorqueException
- Initialization of Torque with a properties file.
init
public void init(org.apache.commons.configuration.Configuration conf) throws TorqueException
- Initialization of Torque with a properties file.
initManagerMappings
protected void initManagerMappings(org.apache.commons.configuration.Configuration conf) throws TorqueException
- Creates a mapping between classes and their manager classes.
The mapping is built according to settings present in
properties file. The entries should have the
following form:
torque.managed_class.com.mycompany.Myclass.manager= \ com.mycompany.MyManagerImpl services.managed_class.com.mycompany.Myotherclass.manager= \ com.mycompany.MyOtherManagerImpl
Generic ServiceBroker provides no Services.
initManager
private void initManager(java.lang.String name, java.lang.String className) throws TorqueException
- Initialize a manager
isInit
public boolean isInit()
- Determine whether Torque has already been initialized.
setConfiguration
public void setConfiguration(org.apache.commons.configuration.Configuration conf)
- Sets the configuration for Torque and all dependencies.
getConfiguration
public org.apache.commons.configuration.Configuration getConfiguration()
- Get the configuration for this component.
getManager
public org.apache.torque.manager.AbstractBaseManager getManager(java.lang.String name)
- This method returns a Manager for the given name.
getManager
public 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 void shutdown()
- Shuts down the service.
This method halts the IDBroker's daemon thread in all of
the DatabaseMap's.
resetConfiguration
private void resetConfiguration()
- Resets some internal configuration variables to
their defaults.
getDatabaseMap
public org.apache.torque.map.DatabaseMap getDatabaseMap() throws TorqueException
- Returns the default database map information.
getDatabaseMap
public 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.
initDatabaseMap
private final org.apache.torque.map.DatabaseMap initDatabaseMap(java.lang.String name) throws TorqueException
- Creates and initializes the mape for the named database.
Assumes that
dbMapsmember is sync'd.
registerMapBuilder
public void registerMapBuilder(java.lang.String className)
- Register a MapBuilder
getDatabaseProperty
private java.lang.String getDatabaseProperty(java.lang.String db, java.lang.String prop)
- Returns the specified property of the given database, or the empty
string if no value is set for the property.
setupIdTable
private final void setupIdTable(org.apache.torque.map.DatabaseMap map)
- Setup IDBroker's table information within given database map.
This method should be called on all new database map to ensure that
IDBroker functionality is available in all databases used by the
application.
getConnection
public java.sql.Connection getConnection() throws TorqueException
- This method returns a Connection from the default pool.
getConnection
public java.sql.Connection getConnection(java.lang.String name) throws TorqueException
getConnection
public 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 org.apache.torque.adapter.DB getDB(java.lang.String name) throws TorqueException
- Returns database adapter for a specific connection pool.
getDefaultDB
public java.lang.String getDefaultDB()
- Returns the name of the default database.
closeConnection
public void closeConnection(java.sql.Connection con)
- Closes a connection.
|
|||||||||
| Home >> All >> org >> apache >> [ torque overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.torque.TorqueInstance