|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.beasys.commerce.axiom.document.DataSourceHelper
A class to help getting a connection to a document jdbc connections.
The primary method is getConnection()
taking
either an EntityImpl or a SessionImpl. This has the following logic:
Field Summary | |
static java.util.Properties |
jdbcProperties
The properties to give to the driver manager when getting a conection via a JDBC driver. |
Constructor Summary | |
DataSourceHelper()
|
Method Summary | |
static java.sql.Connection |
getConnection(EntityImpl impl)
Get a connection for the bean based upon it's environment settings. |
static java.sql.Connection |
getConnection(SessionImpl impl)
Get a connection for the bean based upon it's environment settings. |
static java.lang.String |
getConnectionDriverClass(EntityImpl impl)
Get the JDBC driver to the docPool for the specified entity. |
static java.lang.String |
getConnectionDriverClass(SessionImpl impl)
Get the JDBC driver to the docPool for the specified session bean. |
static java.lang.String |
getConnectionURL(EntityImpl impl)
Get the JDBC connection url to the docPool for the specified entity. |
static java.lang.String |
getConnectionURL(SessionImpl impl)
Get the JDBC connection url to the docPool for the specified session bean. |
static java.sql.Driver |
getDriver(java.lang.String driverCl)
Get a JDBC driver for the specified driver class name. |
static java.sql.Driver |
getDriver(java.lang.String url,
java.lang.String driverCl)
Gets the driver for the specified url and driver class. |
static java.lang.String |
getDriverClass(java.lang.String url)
Try to determine the driver class for the specified url. |
static boolean |
useDataSource(EntityImpl impl)
Determine if the specified Entity should use a DataSource or a direct JDBC URL. |
static boolean |
useDataSource(SessionImpl impl)
Determine if the specified Session bean should use a DataSource or a direct JDBC URL. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final java.util.Properties jdbcProperties
Constructor Detail |
public DataSourceHelper()
Method Detail |
public static java.sql.Driver getDriver(java.lang.String url, java.lang.String driverCl) throws java.sql.SQLException
This does not use DriverManager at all.
url
- the jdbc url.driverCl
- the preferred driver class name (will use
getDriverClass
if null).public static java.lang.String getDriverClass(java.lang.String url)
This does a best guess based upon some common JDBC drivers and their URL formats. It is generally better to specify the JDBC driver class name instead.
url
- the JDBC url.public static java.sql.Driver getDriver(java.lang.String driverCl) throws java.sql.SQLException
This is simply wrapper around Class.forName() that throws SQLExceptions on error.
driverCl
- the driver class name.public static boolean useDataSource(EntityImpl impl)
This checks the "UseDataSource" environment property of the entity. If this is missing or "true", then the "/jdbc/docPool" DataSource should be used. Otherwise, the "DocPoolURL" should be used.
public static java.lang.String getConnectionURL(EntityImpl impl)
This will check the "DocPoolURL" environment property of the entity.
public static java.lang.String getConnectionDriverClass(EntityImpl impl)
This will check the "DocPoolDriver" environment property of the entity.
public static java.sql.Connection getConnection(EntityImpl impl) throws java.sql.SQLException
See the class notes for details.
This will cache the driver instance for the bean's DocPoolURL as needed.
useDataSource(com.beasys.commerce.foundation.EntityImpl)
,
getConnectionURL(com.beasys.commerce.foundation.EntityImpl)
,
getConnectionDriverClass(com.beasys.commerce.foundation.EntityImpl)
,
getDriver(java.lang.String, java.lang.String)
public static boolean useDataSource(SessionImpl impl)
This checks the "UseDataSource" environment property of the entity. If this is missing or "true", then the "/jdbc/docPool" DataSource should be used. Otherwise, the "DocPoolURL" should be used.
public static java.lang.String getConnectionURL(SessionImpl impl)
This will check the "DocPoolURL" environment property of the entity.
public static java.lang.String getConnectionDriverClass(SessionImpl impl)
This will check the "DocPoolDriver" environment property of the entity.
public static java.sql.Connection getConnection(SessionImpl impl) throws java.sql.SQLException
See the class notes for details.
This will cache the driver instance for the bean's DocPoolURL as needed.
useDataSource(com.beasys.commerce.foundation.SessionImpl)
,
getConnectionURL(com.beasys.commerce.foundation.SessionImpl)
,
getConnectionDriverClass(com.beasys.commerce.foundation.SessionImpl)
,
getDriver(java.lang.String, java.lang.String)
|
BEA Systems, Inc. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |