Java Doc for TorqueInstance.java in  » Database-ORM » Torque » org » apache » torque » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database ORM » Torque » org.apache.torque 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.torque.TorqueInstance

All known Subclasses:   org.apache.torque.avalon.TorqueComponent,
TorqueInstance
public class TorqueInstance (Code)
The core of Torque's implementation. Both the classic org.apache.torque.Torque static wrapper and the org.apache.torque.avalon.TorqueComponent Avalon implementation leverage this class.
author:
   Daniel Rall
author:
   Magn�s ��r Torfason
author:
   Jason van Zyl
author:
   Rafal Krzewski
author:
   Martin Poeschl
author:
   Henning P. Schmiedehausen
author:
   Kurt Schrader
author:
   Thomas Vandahl
version:
   $Id: TorqueInstance.java 571790 2007-09-01 12:40:44Z tv $



Constructor Summary
public  TorqueInstance()
     Creates a new instance with default configuration.

Method Summary
public  voidcloseConnection(Connection con)
     Closes a connection.
public  ConfigurationgetConfiguration()
     Get the configuration for this component.
public  ConnectiongetConnection()
     This method returns a Connection from the default pool.
public  ConnectiongetConnection(String name)
     Returns a database connection to the database with the key name.
Parameters:
  name - The database name.
public  ConnectiongetConnection(String name, String username, String password)
     This method returns a Connection using the given parameters. You should only use this method if you need user based access to the database!
Parameters:
  name - The database name.
Parameters:
  username - The name of the database user.
Parameters:
  password - The password of the database user.
public  DBgetDB(String name)
     Returns the database adapter for a specific database.
Parameters:
  name - the name of the database to get the adapter for.
public  DataSourceFactorygetDataSourceFactory(String name)
     Returns the DataSourceFactory for the database with the name name.
Parameters:
  name - The name of the database to get the DSF for.
public  DatabasegetDatabase(String databaseName)
     Returns the database for the key databaseName.
Parameters:
  databaseName - the key to get the database for.
public  DatabaseMapgetDatabaseMap()
     Returns the default database map information.
public  DatabaseMapgetDatabaseMap(String name)
     Returns the database map information.
public  MapgetDatabases()
     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.
public  StringgetDefaultDB()
     Returns the name of the default database.
public  AbstractBaseManagergetManager(String name)
     This method returns a Manager for the given name.
public  AbstractBaseManagergetManager(String name, String defaultClassName)
     This methods returns either the Manager from the configuration file, or the default one provided by the generated code.
public  MapBuildergetMapBuilder(String className)
    
public  MapgetMapBuilders()
    
public  DatabasegetOrCreateDatabase(String databaseName)
     Returns the database for the key databaseName. If no database is associated to the specified key, a new database is created, mapped to the specified key, and returned.
Parameters:
  databaseName - the key to get the database for.
public  StringgetSchema(String name)
     This method returns the current schema for a database connection
Parameters:
  name - The database name.
public  voidinit(String configFile)
     Initialization of Torque with a properties file.
public synchronized  voidinit(Configuration conf)
     Initialization of Torque with a Configuration object.
protected  voidinitManagerMappings(Configuration conf)
     Creates a mapping between classes and their manager classes. The mapping is built according to settings present in properties file.
public  booleanisInit()
     Determine whether Torque has already been initialized.
public  voidregisterMapBuilder(String className)
    
public  voidregisterMapBuilder(MapBuilder builder)
    
public  voidsetConfiguration(Configuration conf)
     Sets the configuration for Torque and all dependencies.
public  voidsetSchema(String name, String schema)
    
public synchronized  voidshutdown()
     Shuts down the service. This method halts the IDBroker's daemon thread in all of the DatabaseMap's.


Constructor Detail
TorqueInstance
public TorqueInstance()(Code)
Creates a new instance with default configuration.
See Also:   TorqueInstance.resetConfiguration()




Method Detail
closeConnection
public void closeConnection(Connection con)(Code)
Closes a connection.
Parameters:
  con - A Connection to close.



getConfiguration
public Configuration getConfiguration()(Code)
Get the configuration for this component. the Configuration



getConnection
public Connection getConnection() throws TorqueException(Code)
This method returns a Connection from the default pool. The requested connection, never null.
throws:
  TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException.



getConnection
public Connection getConnection(String name) throws TorqueException(Code)
Returns a database connection to the database with the key name.
Parameters:
  name - The database name. a database connection, never null.
throws:
  TorqueException - If no DataSourceFactory is configured for thenamed database, the connection information is wrong, or theconnection cannot be returned for any other reason.



getConnection
public Connection getConnection(String name, String username, String password) throws TorqueException(Code)
This method returns a Connection using the given parameters. You should only use this method if you need user based access to the database!
Parameters:
  name - The database name.
Parameters:
  username - The name of the database user.
Parameters:
  password - The password of the database user. A Connection.
throws:
  TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException.



getDB
public DB getDB(String name) throws TorqueException(Code)
Returns the database adapter for a specific database.
Parameters:
  name - the name of the database to get the adapter for. The corresponding database adapter, or null if no databaseadapter is defined for the given database.
throws:
  TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException.



getDataSourceFactory
public DataSourceFactory getDataSourceFactory(String name) throws TorqueException(Code)
Returns the DataSourceFactory for the database with the name name.
Parameters:
  name - The name of the database to get the DSF for. A DataSourceFactory object, never null.
throws:
  TorqueException - if Torque is not initiliaized, orno DatasourceFactory is configured for the given name.



getDatabase
public Database getDatabase(String databaseName) throws TorqueException(Code)
Returns the database for the key databaseName.
Parameters:
  databaseName - the key to get the database for. the database for the specified key, or null if the databasedoes not exist.
throws:
  TorqueException - if Torque is not yet initialized.



getDatabaseMap
public DatabaseMap getDatabaseMap() throws TorqueException(Code)
Returns the default database map information. A DatabaseMap.
throws:
  TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException.



getDatabaseMap
public DatabaseMap getDatabaseMap(String name) throws TorqueException(Code)
Returns the database map information. Name relates to the name of the connection pool to associate with the map.
Parameters:
  name - The name of the database corresponding to theDatabaseMap to retrieve. The named DatabaseMap.
throws:
  TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException.



getDatabases
public Map getDatabases() throws TorqueException(Code)
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. a Map containing all Databases known to Torque, never null.
throws:
  TorqueException - if Torque is not yet initialized.



getDefaultDB
public String getDefaultDB()(Code)
Returns the name of the default database. name of the default DB, or null if Torque is not initialized yet



getManager
public AbstractBaseManager getManager(String name)(Code)
This method returns a Manager for the given name.
Parameters:
  name - name of the manager a Manager



getManager
public AbstractBaseManager getManager(String name, String defaultClassName)(Code)
This methods returns either the Manager from the configuration file, or the default one provided by the generated code.
Parameters:
  name - name of the manager
Parameters:
  defaultClassName - the class to use if name has not been configured a Manager



getMapBuilder
public MapBuilder getMapBuilder(String className) throws TorqueException(Code)
Get a MapBuilder
Parameters:
  className - of the MapBuilder A MapBuilder, not null
throws:
  TorqueException - if the Map Builder cannot be instantiated



getMapBuilders
public Map getMapBuilders()(Code)
Get the registered MapBuilders the MapBuilder cache



getOrCreateDatabase
public Database getOrCreateDatabase(String databaseName)(Code)
Returns the database for the key databaseName. If no database is associated to the specified key, a new database is created, mapped to the specified key, and returned.
Parameters:
  databaseName - the key to get the database for. the database associated with specified key, or the newly createddatabase, never null.



getSchema
public String getSchema(String name) throws TorqueException(Code)
This method returns the current schema for a database connection
Parameters:
  name - The database name. The current schema name. Null means, no schema has been set.
throws:
  TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException.



init
public void init(String configFile) throws TorqueException(Code)
Initialization of Torque with a properties file.
Parameters:
  configFile - The absolute path to the configuration file.
throws:
  TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException.



init
public synchronized void init(Configuration conf) throws TorqueException(Code)
Initialization of Torque with a Configuration object.
Parameters:
  conf - The Torque configuration.
throws:
  TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException.



initManagerMappings
protected void initManagerMappings(Configuration conf) throws TorqueException(Code)
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.
Parameters:
  conf - the Configuration representing the properties file
throws:
  TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException.



isInit
public boolean isInit()(Code)
Determine whether Torque has already been initialized. true if Torque is already initialized



registerMapBuilder
public void registerMapBuilder(String className)(Code)
Register a MapBuilder
Parameters:
  className - the MapBuilder



registerMapBuilder
public void registerMapBuilder(MapBuilder builder)(Code)
Register a MapBuilder
Parameters:
  builder - the instance of the MapBuilder



setConfiguration
public void setConfiguration(Configuration conf)(Code)
Sets the configuration for Torque and all dependencies. The prefix TORQUE_KEY needs to be removed from the configuration keys for the provided configuration.
Parameters:
  conf - the Configuration.



setSchema
public void setSchema(String name, String schema) throws TorqueException(Code)
Sets the current schema for a database connection
Parameters:
  name - The database name.
Parameters:
  schema - The current schema name.
throws:
  TorqueException - Any exceptions caught during processing will berethrown wrapped into a TorqueException.



shutdown
public synchronized void shutdown() throws TorqueException(Code)
Shuts down the service. This method halts the IDBroker's daemon thread in all of the DatabaseMap's. It also closes all SharedPoolDataSourceFactories and PerUserPoolDataSourceFactories initialized by Torque.
exception:
  TorqueException - if a DataSourceFactory could not be closedcleanly. Only the first exception is rethrown, any followingexceptions are logged but ignored.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.