|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.ojb.broker.accesslayer.ConnectionFactoryAbstractImpl
public abstract class ConnectionFactoryAbstractImpl
Abstract base class to simplify implementation of ConnectionFactory's.
| Constructor Summary | |
|---|---|
ConnectionFactoryAbstractImpl()
|
|
| Method Summary | |
|---|---|
abstract Connection |
checkOutJdbcConnection(JdbcConnectionDescriptor jcd)
Returns a valid JDBC Connection. |
protected String |
getDbURL(JdbcConnectionDescriptor jcd)
|
protected String |
getJcdDescription(JdbcConnectionDescriptor jcd)
|
protected Properties |
getJdbcProperties(JdbcConnectionDescriptor jcd)
|
protected Properties |
getJdbcProperties(JdbcConnectionDescriptor jcd,
String user,
String password)
Returns connection properties for passing to DriverManager, after merging JDBC driver-specific configuration settings with name/password from connection descriptor. |
protected void |
initializeJdbcConnection(Connection con,
JdbcConnectionDescriptor jcd)
Initialize the connection with the specified properties in OJB configuration files and platform depended properties. |
Connection |
lookupConnection(JdbcConnectionDescriptor jcd)
Lookup a connection from the connection factory implementation. |
protected Connection |
newConnectionFromDataSource(JdbcConnectionDescriptor jcd)
Creates a new connection from the data source that the connection descriptor represents. |
protected Connection |
newConnectionFromDriverManager(JdbcConnectionDescriptor jcd)
Returns a new created connection |
void |
releaseAllResources()
Override this method to do cleanup in your implementation. |
void |
releaseConnection(JdbcConnectionDescriptor jcd,
Connection con)
Release connection - CAUTION: Release every connection after use to avoid abandoned connections. |
abstract void |
releaseJdbcConnection(JdbcConnectionDescriptor jcd,
Connection con)
Releases a Connection after use. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConnectionFactoryAbstractImpl()
| Method Detail |
|---|
public abstract Connection checkOutJdbcConnection(JdbcConnectionDescriptor jcd)
throws LookupException
Note: This method is never called for a jdbc-connection-descriptor that uses datasources, OJB only manages connections from DriverManager.
Note: If the concrete implementation does not callback to
newConnectionFromDriverManager(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor)
when creating a new Connection, it must call
initializeJdbcConnection(java.sql.Connection, org.apache.ojb.broker.metadata.JdbcConnectionDescriptor)
so that the platform implementation can peform any RDBMS-specific init tasks for newly
created Connection objetcs.
jcd - the connection descriptor for which to return a validated Connection
LookupException - if a valid Connection could not be obtained
public abstract void releaseJdbcConnection(JdbcConnectionDescriptor jcd,
Connection con)
throws LookupException
Note: This method is never called for a jdbc-connection-descriptor that uses datasources, OJB only manages connections from DriverManager.
jcd - the connection descriptor for which the connection was createdcon - the connection to release.
Callers must guarantee that the passed connection was obtained by calling
checkOutJdbcConnection(org.apache.ojb.broker.metadata.JdbcConnectionDescriptor).
LookupException - if errors occured during release of object. Typically happens
if return of object to pool fails in a pooled implementation.
public void releaseConnection(JdbcConnectionDescriptor jcd,
Connection con)
ConnectionFactory
releaseConnection in interface ConnectionFactory
public Connection lookupConnection(JdbcConnectionDescriptor jcd)
throws LookupException
ConnectionFactory
lookupConnection in interface ConnectionFactoryLookupException
protected void initializeJdbcConnection(Connection con,
JdbcConnectionDescriptor jcd)
throws LookupException
LookupExceptionPlatformFactory,
Platformpublic void releaseAllResources()
releaseAllResources in interface ConnectionFactory
protected Connection newConnectionFromDataSource(JdbcConnectionDescriptor jcd)
throws LookupException
jcd - The connection descriptor
LookupException - if we can't get a connection from the datasource either due to a
naming exception, a failed sanity check, or a SQLException.
protected Connection newConnectionFromDriverManager(JdbcConnectionDescriptor jcd)
throws LookupException
jcd - the connection descriptor
LookupException
protected Properties getJdbcProperties(JdbcConnectionDescriptor jcd,
String user,
String password)
jcd - the connection descriptor with driver-specific settingsuser - the jcd username (or null if not using authenticated login)password - the jcd password (only used when user != null)
protected Properties getJdbcProperties(JdbcConnectionDescriptor jcd)
protected String getDbURL(JdbcConnectionDescriptor jcd)
protected String getJcdDescription(JdbcConnectionDescriptor jcd)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||