|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.jackrabbit.core.util.db.ConnectionFactory
public final class ConnectionFactory
A factory for new database connections. Supported are regular JDBC drivers, as well as JNDI resources. FIXME: the registry currently is ClassLoader wide. I.e., if you start two repositories then you share the registered datasources...
| Constructor Summary | |
|---|---|
ConnectionFactory()
|
|
| Method Summary | |
|---|---|
void |
close()
|
String |
getDataBaseType(String logicalName)
|
DataSource |
getDataSource(String logicalName)
Retrieves a configured data source by logical name. |
DataSource |
getDataSource(String driver,
String url,
String user,
String password)
Retrieve a DataSource for the specified properties. |
void |
registerDataSources(DataSourceConfig dsc)
Registers a number of data sources. |
static Connection |
unwrap(Connection con)
Needed for pre-10R2 Oracle blob support....:( This method actually assumes that we are using commons DBCP 1.2.2. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ConnectionFactory()
| Method Detail |
|---|
public void registerDataSources(DataSourceConfig dsc)
throws RepositoryException
dsc - the DataSourceConfig which contains the configuration
RepositoryException
public DataSource getDataSource(String logicalName)
throws RepositoryException
logicalName - the name of the DataSource
DataSource
RepositoryException - if there is no DataSource with the given name
public String getDataBaseType(String logicalName)
throws RepositoryException
logicalName - the name of the DataSource
RepositoryException - if there is no DataSource with the given name
public DataSource getDataSource(String driver,
String url,
String user,
String password)
throws RepositoryException,
SQLException
DataSource for the specified properties.
This can be a JNDI Data Source as well. To do that,
the driver class name must reference a javax.naming.Context class
(for example javax.naming.InitialContext), and the URL must be the JNDI URL
(for example java:comp/env/jdbc/Test).
driver - the JDBC driver or the Context classurl - the database URLuser - the user namepassword - the password
DataSource
RepositoryException - if the driver could not be loaded
SQLException - if the connection could not be establishedpublic void close()
public static Connection unwrap(Connection con)
throws SQLException
con - the commons-DBCP DelegatingConnection to unwrap
SQLException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||