|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.torque.Torque
The implementation of Torque.
Field Summary | |
private static java.util.Map |
adapterMap
The cache of DB adapter keys |
static java.lang.String |
CACHE_KEY
property to determine whether caching is used. |
private static org.apache.log4j.Category |
category
The logging category. |
private static org.apache.commons.configuration.Configuration |
configuration
Torque-specific configuration. |
static java.lang.String |
DATABASE_DEFAULT
Name of property that specifies the default map builder and map. |
private static java.util.Map |
dbMaps
The global cache of database maps |
private static java.lang.String |
DEFAULT_NAME
A constant for default . |
private static java.lang.String |
defaultDBName
The db name that is specified as the default in the property file |
private static java.util.Map |
dsFactoryMap
The cache of DataSourceFactory's |
private static boolean |
isInit
flag to set to true once this class has been initialized |
static java.lang.String |
MANAGER_PREFIX
A prefix for Manager properties in
TurbineResource.properties. |
static java.lang.String |
MANAGER_SUFFIX
A Service property determining its implementing
class name . |
protected static java.util.Map |
managers
A repository of Manager instances. |
private static java.util.List |
mapBuilders
Store mapbuilder classnames for peers that have been referenced prior to Torque being initialized. |
Constructor Summary | |
Torque()
|
Method Summary | |
static void |
closeConnection(java.sql.Connection con)
Closes a connection. |
void |
configure(org.apache.commons.configuration.Configuration config)
configure torque |
protected static void |
configureLogging()
Configure the logging for this subsystem. |
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)
|
static java.sql.Connection |
getConnection(java.lang.String name,
java.lang.String username,
java.lang.String password)
Deprecated. Database parameters should not be specified each time a Connection is fetched from the service. |
static DatabaseMap |
getDatabaseMap()
Returns the default database map information. |
static DatabaseMap |
getDatabaseMap(java.lang.String name)
Returns the database map information. |
private static 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. |
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 java.lang.String |
getDefaultMap()
Deprecated. Use getDefaultDB() instead. |
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 void |
init(org.apache.commons.configuration.Configuration c)
Initialization of Torque with a properties file. |
static void |
init(java.lang.String configFile)
Initialization of Torque with a properties file. |
private static void |
initAdapters(org.apache.commons.configuration.Configuration configuration)
|
private static DatabaseMap |
initDatabaseMap(java.lang.String name)
Creates and initializes the mape for the named database. |
private static void |
initDataSourceFactories(org.apache.commons.configuration.Configuration configuration)
|
void |
initialize()
initialize Torque |
private static void |
initManager(java.lang.String name,
java.lang.String className)
Initialize a manager |
protected static void |
initManagerMappings(org.apache.commons.configuration.Configuration configuration)
Creates a mapping between classes and their manager classes. |
static boolean |
isInit()
Determine whether Torque has already been initialized. |
protected static boolean |
isLoggingConfigured()
Determine whether log4j has already been configured. |
static void |
registerMapBuilder(java.lang.String className)
Register a MapBuilder |
static void |
setConfiguration(org.apache.commons.configuration.Configuration c)
Sets the configuration for Torque and all dependencies. |
private static void |
setupIdTable(DatabaseMap map)
Setup IDBroker's table information within given database map. |
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 DATABASE_DEFAULT
private static final java.lang.String DEFAULT_NAME
default
.
public static final java.lang.String MANAGER_PREFIX
Manager
properties in
TurbineResource.properties.
public static final java.lang.String MANAGER_SUFFIX
Service
property determining its implementing
class name .
public static final java.lang.String CACHE_KEY
private static java.lang.String defaultDBName
private static java.util.Map dbMaps
private static java.util.Map dsFactoryMap
private static java.util.Map adapterMap
protected static java.util.Map managers
private static org.apache.log4j.Category category
private static org.apache.commons.configuration.Configuration configuration
private static boolean isInit
private static java.util.List mapBuilders
Constructor Detail |
public Torque()
Method Detail |
public void initialize() throws TorqueException
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.org.apache.stratum.lifecycle.Initializable
private static final void initAdapters(org.apache.commons.configuration.Configuration configuration) throws TorqueException
configuration
- the Configuration representing the properties file
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.private static void initDataSourceFactories(org.apache.commons.configuration.Configuration configuration) throws TorqueException
configuration
- the Configuration representing the properties file
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public void configure(org.apache.commons.configuration.Configuration config) throws TorqueException
config
- Configuration
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.org.apache.stratum.lifecycle.Configurable
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 c) throws TorqueException
c
- The Torque configuration.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.protected static void initManagerMappings(org.apache.commons.configuration.Configuration configuration) throws TorqueException
torque.managed_class.com.mycompany.Myclass.manager= \ com.mycompany.MyManagerImpl services.managed_class.com.mycompany.Myotherclass.manager= \ com.mycompany.MyOtherManagerImpl
configuration
- the Configuration representing the properties file
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.private static void initManager(java.lang.String name, java.lang.String className) throws TorqueException
name
- name of the managerclassName
- name of the manager class
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 c)
c
- the Configurationpublic static org.apache.commons.configuration.Configuration getConfiguration()
protected static void configureLogging()
protected static boolean isLoggingConfigured()
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 void dispose()
public static void shutdown()
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.private static final DatabaseMap initDatabaseMap(java.lang.String name) throws TorqueException
dbMaps
member is sync'd.
name
- The name of the database to map.
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.public static void registerMapBuilder(java.lang.String className)
className
- the MapBuilderprivate static java.lang.String getDatabaseProperty(java.lang.String db, java.lang.String prop)
db
- The name of the database whose property to get.prop
- The name of the property to get.
private static final void setupIdTable(DatabaseMap map)
map
- the DataBaseMap to setup.public static java.sql.Connection getConnection() throws TorqueException, java.sql.SQLException, javax.naming.NamingException
TorqueException
- Any exceptions caught during processing will be
rethrown wrapped into a TorqueException.
java.sql.SQLException
- never thrown
javax.naming.NamingException
- never thrownpublic 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 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 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 java.lang.String getDefaultMap()
public static void closeConnection(java.sql.Connection con)
con
- A Connection to close.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |