Public Member Functions | |
AbstractConnectionManager (String backendUrl, String backendName, String rLogin, String rPassword, String driverPath, String driverClassName) | |
AbstractConnectionManager | copy (String url, String name) throws Exception |
abstract void | initializeConnections () throws SQLException |
abstract void | finalizeConnections () throws SQLException |
Connection | getConnectionFromDriver () |
abstract Connection | getConnection () throws UnreachableBackendException |
Connection | getConnection (long transactionId) throws UnreachableBackendException |
Connection | retrieveConnection (long transactionId) |
abstract void | releaseConnection (Connection connection) |
void | releaseConnection (long transactionId) |
abstract void | deleteConnection (Connection connection) |
void | deleteConnection (long transactionId) |
boolean | isInitialized () |
String | getLogin () |
void | setLogin (String rLogin) |
String | getPassword () |
void | setPassword (String rPassword) |
abstract String | getXmlImpl () |
String | getXml () |
String | getVLogin () |
void | setVLogin (String login) |
abstract int | getCurrentNumberOfConnections () |
String | getDriverClassName () |
void | setDriverClassName (String driverClassName) |
String | getDriverPath () |
void | setDriverPath (String driverPath) |
Protected Member Functions | |
void | finalize () throws Throwable |
abstract Object | clone () throws CloneNotSupportedException |
Protected Attributes | |
String | backendUrl |
String | backendName |
String | rLogin |
String | rPassword |
String | driverClassName |
String | driverPath |
boolean | initialized |
Static Package Attributes | |
Trace | logger |
ConnectionManager
object is responsible to talk directly with a database backend.
Definition at line 47 of file AbstractConnectionManager.java.
|
Creates a new
Definition at line 112 of file AbstractConnectionManager.java. 00114 { 00115 if (backendUrl == null) 00116 throw new IllegalArgumentException( 00117 "Illegal null database backend URL in AbstractConnectionManager constructor"); 00118 00119 if (backendName == null) 00120 throw new IllegalArgumentException( 00121 "Illegal null database backend name in AbstractConnectionManager constructor"); 00122 00123 if (rLogin == null) 00124 throw new IllegalArgumentException( 00125 "Illegal null database backend login in AbstractConnectionManager constructor"); 00126 00127 if (rPassword == null) 00128 throw new IllegalArgumentException( 00129 "Illegal null database backend password in AbstractConnectionManager constructor"); 00130 00131 if (driverPath != null) 00132 { 00133 if (driverClassName == null) 00134 { 00135 throw new IllegalArgumentException( 00136 "Illegal null database backend driverClassName in AbstractConnectionManager constructor"); 00137 } 00138 } 00139 this.backendUrl = backendUrl; 00140 this.backendName = backendName; 00141 this.rLogin = rLogin; 00142 this.rPassword = rPassword; 00143 this.driverPath = driverPath; 00144 this.driverClassName = driverClassName; 00145 connectionForTransaction = new Hashtable(); 00146 00147 }
|
|
Copy this connection manager and replace the name of the backend and its url Every other parameter is the same
Definition at line 158 of file AbstractConnectionManager.java. References org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.backendName, org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.backendUrl, and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.clone(). Referenced by org.objectweb.cjdbc.controller.backend.DatabaseBackend.copy(). 00160 { 00161 AbstractConnectionManager connectionManager = (AbstractConnectionManager) this 00162 .clone(); 00163 connectionManager.backendName = name; 00164 connectionManager.backendUrl = url; 00165 return connectionManager; 00166 }
|
|
Delete a bad connection that was used for a transaction. The corresponding connection is deleted by calling deleteConnection(Connection).
Definition at line 307 of file AbstractConnectionManager.java. References org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.deleteConnection(), and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.logger. 00308 { 00309 Connection c = (Connection) connectionForTransaction.remove(new Long( 00310 transactionId)); 00311 00312 if (c == null) 00313 logger.error(Translate.get("connection.transaction.unknown", 00314 transactionId)); 00315 else 00316 deleteConnection(c); 00317 }
|
|
Delete a connection that is no more valid.
Implemented in org.objectweb.cjdbc.controller.connection.FailFastPoolConnectionManager, org.objectweb.cjdbc.controller.connection.RandomWaitPoolConnectionManager, org.objectweb.cjdbc.controller.connection.SimpleConnectionManager, and org.objectweb.cjdbc.controller.connection.VariablePoolConnectionManager. Referenced by org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.deleteConnection(), and org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.execReadRequest(). |
|
Ensures that the connections are closed when the object is garbage collected.
Definition at line 405 of file AbstractConnectionManager.java. References org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.finalizeConnections(), and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.isInitialized(). 00406 { 00407 if (isInitialized()) 00408 finalizeConnections(); 00409 super.finalize(); 00410 }
|
|
Releases all the connections to the database.
Implemented in org.objectweb.cjdbc.controller.connection.AbstractPoolConnectionManager, org.objectweb.cjdbc.controller.connection.SimpleConnectionManager, and org.objectweb.cjdbc.controller.connection.VariablePoolConnectionManager. Referenced by org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.disableBackend(), and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.finalize(). |
|
Gets a new connection for a transaction. This function calls getConnection()to get the connection and store the mapping between the connection and the transaction id.
Definition at line 231 of file AbstractConnectionManager.java. References org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getConnection(), and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.logger. 00233 { 00234 Long lTid = new Long(transactionId); 00235 Connection c = getConnection(); 00236 if (c != null) 00237 { 00238 if (connectionForTransaction.put(lTid, c) != null) 00239 { 00240 logger 00241 .error("A new connection for transaction " 00242 + lTid 00243 + " has been opened but there was a remaining connection for this transaction that has not been closed."); 00244 } 00245 } 00246 return c; 00247 }
|
|
|
Get a connection from DriverManager.
Definition at line 193 of file AbstractConnectionManager.java. References org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.backendUrl, org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.driverClassName, org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.driverPath, org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getConnection(), org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.logger, org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.rLogin, and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.rPassword. Referenced by org.objectweb.cjdbc.controller.connection.VariablePoolConnectionManager.deleteConnection(), org.objectweb.cjdbc.controller.connection.RandomWaitPoolConnectionManager.deleteConnection(), org.objectweb.cjdbc.controller.connection.VariablePoolConnectionManager.getConnection(), org.objectweb.cjdbc.controller.connection.SimpleConnectionManager.getConnection(), org.objectweb.cjdbc.controller.connection.RandomWaitPoolConnectionManager.getConnection(), org.objectweb.cjdbc.controller.connection.FailFastPoolConnectionManager.getConnection(), and org.objectweb.cjdbc.controller.backend.DatabaseBackend.isJDBCConnected(). 00195 { 00196 try 00197 { 00198 return DriverManager.getConnection(backendUrl, rLogin, rPassword, 00199 driverPath, driverClassName); 00200 } 00201 catch (SQLException ignore) 00202 { 00203 if (logger.isDebugEnabled()) 00204 { 00205 logger.debug("failed to get connection for driver ", ignore); 00206 } 00207 return null; 00208 } 00209 }
|
|
Get the current number of connections open for this connection manager.
Implemented in org.objectweb.cjdbc.controller.connection.AbstractPoolConnectionManager, and org.objectweb.cjdbc.controller.connection.SimpleConnectionManager. Referenced by org.objectweb.cjdbc.controller.backend.DatabaseBackend.getTotalActiveConnections(). |
|
Returns the driverClassName value.
Definition at line 440 of file AbstractConnectionManager.java. Referenced by org.objectweb.cjdbc.controller.backend.DatabaseBackend.copy(). 00441 {
00442 return driverClassName;
00443 }
|
|
Returns the driverPath value.
Definition at line 460 of file AbstractConnectionManager.java. Referenced by org.objectweb.cjdbc.controller.backend.DatabaseBackend.copy(). 00461 {
00462 return driverPath;
00463 }
|
|
Returns the login used by this connection manager.
Definition at line 338 of file AbstractConnectionManager.java. Referenced by org.objectweb.cjdbc.controller.backend.DatabaseBackend.checkDatabaseSchema(). 00339 {
00340 return rLogin;
00341 }
|
|
Returns the password used by this connection manager.
Definition at line 358 of file AbstractConnectionManager.java. 00359 {
00360 return rPassword;
00361 }
|
|
Definition at line 415 of file AbstractConnectionManager.java. 00416 {
00417 return vLogin;
00418 }
|
|
Definition at line 387 of file AbstractConnectionManager.java. References org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getXmlImpl(), org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.rLogin, and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.rPassword. Referenced by org.objectweb.cjdbc.controller.backend.DatabaseBackend.getXml(). 00388 { 00389 StringBuffer info = new StringBuffer(); 00390 info.append("<" + DatabasesXmlTags.ELT_ConnectionManager + " " 00391 + DatabasesXmlTags.ATT_vLogin + "=\"" + vLogin + "\" " + "" 00392 + DatabasesXmlTags.ATT_rLogin + "=\"" + rLogin + "\" " + "" 00393 + DatabasesXmlTags.ATT_rPassword + "=\"" + rPassword + "\" " + ">"); 00394 info.append(this.getXmlImpl()); 00395 info.append("</" + DatabasesXmlTags.ELT_ConnectionManager + ">"); 00396 return info.toString(); 00397 }
|
|
Gets xml formatted information on this connection manager
Implemented in org.objectweb.cjdbc.controller.connection.FailFastPoolConnectionManager, org.objectweb.cjdbc.controller.connection.RandomWaitPoolConnectionManager, org.objectweb.cjdbc.controller.connection.SimpleConnectionManager, and org.objectweb.cjdbc.controller.connection.VariablePoolConnectionManager. Referenced by org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getXml(). |
|
Initializes the connection(s) to the database. The caller must ensure that the driver has already been loaded else an exception will be thrown.
Implemented in org.objectweb.cjdbc.controller.connection.AbstractPoolConnectionManager, org.objectweb.cjdbc.controller.connection.SimpleConnectionManager, and org.objectweb.cjdbc.controller.connection.VariablePoolConnectionManager. Referenced by org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.enableBackend(). |
|
Tests if the connections have been initialized.
Definition at line 324 of file AbstractConnectionManager.java. Referenced by org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.finalize(). 00325 {
00326 return initialized;
00327 }
|
|
Releases a connection used for a transaction. The corresponding connection is released by calling releaseConnection(Connection).
Definition at line 281 of file AbstractConnectionManager.java. References org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.logger, and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.releaseConnection(). 00282 { 00283 Connection c = (Connection) connectionForTransaction.remove(new Long( 00284 transactionId)); 00285 00286 if (c == null) 00287 logger.error(Translate.get("connection.transaction.unknown", 00288 transactionId)); 00289 else 00290 releaseConnection(c); 00291 }
|
|
Releases a connection.
Implemented in org.objectweb.cjdbc.controller.connection.FailFastPoolConnectionManager, org.objectweb.cjdbc.controller.connection.RandomWaitPoolConnectionManager, org.objectweb.cjdbc.controller.connection.SimpleConnectionManager, and org.objectweb.cjdbc.controller.connection.VariablePoolConnectionManager. Referenced by org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.commit(), org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.execReadRequest(), org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.execReadStoredProcedure(), org.objectweb.cjdbc.controller.loadbalancer.tasks.WriteStoredProcedureTask.executeTask(), org.objectweb.cjdbc.controller.loadbalancer.tasks.WriteRequestWithKeysTask.executeTask(), org.objectweb.cjdbc.controller.loadbalancer.tasks.WriteRequestTask.executeTask(), org.objectweb.cjdbc.controller.loadbalancer.tasks.SelectRequestTask.executeTask(), org.objectweb.cjdbc.controller.loadbalancer.tasks.RollbackTask.executeTask(), org.objectweb.cjdbc.controller.loadbalancer.tasks.ReadStoredProcedureTask.executeTask(), org.objectweb.cjdbc.controller.loadbalancer.tasks.CommitTask.executeTask(), org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.execWriteRequest(), org.objectweb.cjdbc.controller.loadbalancer.raidb0.RAIDb0.execWriteRequest(), org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.execWriteStoredProcedure(), org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.releaseConnection(), and org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.rollback(). |
|
Retrieves a connection used for a transaction. This connection must have been allocated by calling getConnection(long).
Definition at line 258 of file AbstractConnectionManager.java. Referenced by org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.commit(), org.objectweb.cjdbc.controller.loadbalancer.paralleldb.ParallelDB.commit(), org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.execReadRequest(), org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.execReadStoredProcedure(), org.objectweb.cjdbc.controller.loadbalancer.tasks.RollbackTask.executeTask(), org.objectweb.cjdbc.controller.loadbalancer.tasks.CommitTask.executeTask(), org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.execWriteStoredProcedure(), org.objectweb.cjdbc.controller.loadbalancer.singledb.SingleDB.rollback(), and org.objectweb.cjdbc.controller.loadbalancer.paralleldb.ParallelDB.rollback(). 00259 { 00260 Long id = new Long(transactionId); 00261 synchronized (connectionForTransaction) 00262 { 00263 return (Connection) connectionForTransaction.get(id); 00264 } 00265 }
|
|
Sets the driverClassName value.
Definition at line 450 of file AbstractConnectionManager.java. References org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.driverClassName. 00451 {
00452 this.driverClassName = driverClassName;
00453 }
|
|
Sets the driverPath value.
Definition at line 470 of file AbstractConnectionManager.java. References org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.driverPath. 00471 {
00472 this.driverPath = driverPath;
00473 }
|
|
Sets the login to be used by this connection manager.
Definition at line 348 of file AbstractConnectionManager.java. References org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.rLogin. 00349 {
00350 this.rLogin = rLogin;
00351 }
|
|
Sets the password to be used by this connection manager.
Definition at line 368 of file AbstractConnectionManager.java. References org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.rPassword. 00369 {
00370 this.rPassword = rPassword;
00371 }
|
|
Definition at line 423 of file AbstractConnectionManager.java. 00424 { 00425 vLogin = login; 00426 }
|
|
Name of the Definition at line 68 of file AbstractConnectionManager.java. Referenced by org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.copy(). |
|
URL of the Definition at line 63 of file AbstractConnectionManager.java. Referenced by org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.copy(), and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getConnectionFromDriver(). |
|
The class name of the driver Definition at line 77 of file AbstractConnectionManager.java. Referenced by org.objectweb.cjdbc.controller.backend.DatabaseBackend.getBackendData(), org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getConnectionFromDriver(), and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.setDriverClassName(). |
|
The path to the driver if null the default directory is used Definition at line 82 of file AbstractConnectionManager.java. Referenced by org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getConnectionFromDriver(), and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.setDriverPath(). |
|
Definition at line 85 of file AbstractConnectionManager.java. |
|
Initial value: Trace
.getLogger("org.objectweb.cjdbc.controller.connection")
Definition at line 59 of file AbstractConnectionManager.java. Referenced by org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.deleteConnection(), org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getConnection(), org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getConnectionFromDriver(), and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.releaseConnection(). |
|
Backend connection login to be used by this connection manager. Definition at line 71 of file AbstractConnectionManager.java. Referenced by org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getConnectionFromDriver(), org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getXml(), and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.setLogin(). |
|
Backend connection password to be used by this connection manager. Definition at line 74 of file AbstractConnectionManager.java. Referenced by org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getConnectionFromDriver(), org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.getXml(), and org.objectweb.cjdbc.controller.connection.AbstractConnectionManager.setPassword(). |