|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.objectweb.cjdbc.controller.connection.AbstractConnectionManager
A ConnectionManager
object is responsible to talk directly with
a database backend.
Field Summary | |
protected java.lang.String |
backendName
Name of the DatabaseBackend owning this connection manager. |
protected java.lang.String |
backendUrl
URL of the DatabaseBackend owning this connection manager. |
private java.util.Hashtable |
connectionForTransaction
Hastable of connections associated to a transaction. |
protected boolean |
initialized
true if the connection pool has been initialized. |
(package private) static Trace |
logger
Logger instance. |
protected java.lang.String |
rLogin
Backend connection login to be used by this connection manager. |
protected java.lang.String |
rPassword
Backend connection password to be used by this connection manager. |
Constructor Summary | |
AbstractConnectionManager(java.lang.String backendUrl,
java.lang.String backendName,
java.lang.String rLogin,
java.lang.String rPassword)
Creates a new AbstractConnectionManager instance: assigns
login/password and instanciates transaction id/connection mapping. |
Method Summary | |
protected void |
finalize()
Ensures that the connections are closed when the object is garbage collected. |
abstract void |
finalizeConnections()
Releases all the connections to the database. |
abstract java.sql.Connection |
getConnection()
Gets a connection from the pool (round-robin). |
java.sql.Connection |
getConnection(int transactionId)
Gets a new connection for a transaction. |
abstract java.lang.String |
getInformation()
Gets information about this connection manager |
java.lang.String |
getLogin()
Returns the login used by this connection manager. |
java.lang.String |
getPassword()
Returns the password used by this connection manager. |
abstract java.lang.String |
getXmlInformation()
Gets xml formatted information on this connection manager |
abstract void |
initializeConnections()
Initializes the connection(s) to the database. |
boolean |
isInitialized()
Tests if the connections have been initialized. |
abstract void |
releaseConnection(java.sql.Connection connection)
Releases a connection. |
void |
releaseConnection(int transactionId)
Releases a connection used for a transaction. |
java.sql.Connection |
retrieveConnection(int transactionId)
Retrieves a connection used for a transaction. |
void |
setLogin(java.lang.String rLogin)
Sets the login to be used by this connection manager. |
void |
setPassword(java.lang.String rPassword)
Sets the password to be used by this connection manager. |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static Trace logger
protected java.lang.String backendUrl
DatabaseBackend
owning this connection manager.
protected java.lang.String backendName
DatabaseBackend
owning this connection manager.
protected java.lang.String rLogin
protected java.lang.String rPassword
protected boolean initialized
true
if the connection pool has been initialized.
private transient java.util.Hashtable connectionForTransaction
Constructor Detail |
public AbstractConnectionManager(java.lang.String backendUrl, java.lang.String backendName, java.lang.String rLogin, java.lang.String rPassword)
AbstractConnectionManager
instance: assigns
login/password and instanciates transaction id/connection mapping.
backendUrl
- URL of the DatabaseBackend
owning this
connection managerbackendName
- name of the DatabaseBackend
owning this
connection managerrLogin
- backend connection login to be used by this connection
managerrPassword
- backend connection password to be used by this connection
managerMethod Detail |
public abstract void initializeConnections() throws java.sql.SQLException
java.sql.SQLException
- if an error occurs.public abstract void finalizeConnections() throws java.sql.SQLException
java.sql.SQLException
- if an error occurs.public abstract java.sql.Connection getConnection()
Connection
or null
if no connection is
available or if the connection has not been initialized.public java.sql.Connection getConnection(int transactionId)
getConnection()
to get the connection and store the mapping
between the connection and the transaction id.
transactionId
- the transaction id.
Connection
or null
if no connection is
available .getConnection()
public java.sql.Connection retrieveConnection(int transactionId)
getConnection(int)
.
transactionId
- the transaction id.
Connection
or null
if no connection
has been found for this transaction id.getConnection(int)
public abstract void releaseConnection(java.sql.Connection connection)
connection
- the connection to release.public void releaseConnection(int transactionId)
releaseConnection(Connection)
.
transactionId
- the transaction id.releaseConnection(Connection)
public boolean isInitialized()
true
if the connections have been initialized.public java.lang.String getLogin()
String
value.public void setLogin(java.lang.String rLogin)
rLogin
- the login to set.public java.lang.String getPassword()
String
value.public void setPassword(java.lang.String rPassword)
rPassword
- the password to set.public abstract java.lang.String getXmlInformation()
public abstract java.lang.String getInformation()
String
value containing information.protected void finalize() throws java.lang.Throwable
java.lang.Throwable
- if an error occurs.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |