|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.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 java.lang.String |
driverClassName
The class name of the driver |
protected java.lang.String |
driverPath
The path to the driver if null the default directory is used |
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. |
private java.lang.String |
vLogin
Virtual Login to be that use this connection manager |
Fields inherited from interface org.objectweb.cjdbc.common.xml.XmlComponent |
DOCTYPE_CONTROLLER, DOCTYPE_DB, XML_VERSION |
Constructor Summary | |
AbstractConnectionManager(java.lang.String backendUrl,
java.lang.String backendName,
java.lang.String rLogin,
java.lang.String rPassword,
java.lang.String driverPath,
java.lang.String driverClassName)
Creates a new AbstractConnectionManager instance: assigns
login/password and instanciates transaction id/connection mapping. |
Method Summary | |
protected abstract java.lang.Object |
clone()
|
AbstractConnectionManager |
copy(java.lang.String url,
java.lang.String name)
Copy this connection manager and replace the name of the backend and its url Every other parameter is the same |
abstract void |
deleteConnection(java.sql.Connection connection)
Delete a connection that is no more valid. |
void |
deleteConnection(long transactionId)
Delete a bad connection that was used for a transaction. |
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(long transactionId)
Gets a new connection for a transaction. |
java.sql.Connection |
getConnectionFromDriver()
Get a connection from DriverManager. |
abstract int |
getCurrentNumberOfConnections()
Get the current number of connections open for this connection manager. |
java.lang.String |
getDriverClassName()
Returns the driverClassName value. |
java.lang.String |
getDriverPath()
Returns the driverPath value. |
java.lang.String |
getLogin()
Returns the login used by this connection manager. |
java.lang.String |
getPassword()
Returns the password used by this connection manager. |
java.lang.String |
getVLogin()
|
java.lang.String |
getXml()
Get xml formatted representation of this cjdbc component |
abstract java.lang.String |
getXmlImpl()
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(long transactionId)
Releases a connection used for a transaction. |
java.sql.Connection |
retrieveConnection(long transactionId)
Retrieves a connection used for a transaction. |
void |
setDriverClassName(java.lang.String driverClassName)
Sets the driverClassName value. |
void |
setDriverPath(java.lang.String driverPath)
Sets the driverPath value. |
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. |
void |
setVLogin(java.lang.String login)
|
Methods inherited from class java.lang.Object |
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 java.lang.String driverClassName
protected java.lang.String driverPath
protected boolean initialized
true
if the connection pool has been initialized.
private transient java.util.Hashtable connectionForTransaction
private java.lang.String vLogin
Constructor Detail |
public AbstractConnectionManager(java.lang.String backendUrl, java.lang.String backendName, java.lang.String rLogin, java.lang.String rPassword, java.lang.String driverPath, java.lang.String driverClassName)
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
managerdriverPath
- path for driverdriverClassName
- class name for driverMethod Detail |
public AbstractConnectionManager copy(java.lang.String url, java.lang.String name) throws java.lang.Exception
url
- the url to the backend associated to this ConnectionManagername
- the name of the backend
AbstractConnectionManager
java.lang.Exception
- if clone failspublic 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 java.sql.Connection getConnectionFromDriver()
DriverManager.getConnection(String, String, String, String, String)
public abstract java.sql.Connection getConnection() throws UnreachableBackendException
Connection
or null
if no connection
is available or if the connection has not been initialized.
UnreachableBackendException
- if the backend must be disabledpublic java.sql.Connection getConnection(long transactionId) throws UnreachableBackendException
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 .
UnreachableBackendException
- if the backend must be disabledgetConnection()
public java.sql.Connection retrieveConnection(long transactionId)
getConnection(long)
.
transactionId
- the transaction id.
Connection
or null
if no connection
has been found for this transaction id.getConnection(long)
public abstract void releaseConnection(java.sql.Connection connection)
connection
- the connection to release.public void releaseConnection(long transactionId)
releaseConnection(Connection)
.
transactionId
- the transaction id.releaseConnection(Connection)
public abstract void deleteConnection(java.sql.Connection connection)
connection
- the connection to delete.public void deleteConnection(long transactionId)
deleteConnection(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 getXmlImpl()
public java.lang.String getXml()
XmlComponent
getXml
in interface XmlComponent
XmlComponent.getXml()
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
- if an error occurs.public java.lang.String getVLogin()
public void setVLogin(java.lang.String login)
login
- The vLogin to set.public abstract int getCurrentNumberOfConnections()
public java.lang.String getDriverClassName()
public void setDriverClassName(java.lang.String driverClassName)
driverClassName
- The driverClassName to set.public java.lang.String getDriverPath()
public void setDriverPath(java.lang.String driverPath)
driverPath
- The driverPath to set.protected abstract java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.CloneNotSupportedException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |