public class DataSourceWrapper
extends java.lang.Object
implements javax.sql.DataSource
JDBCDataSource which is required by
DatabaseConfiguration. Note that
only getConnection() is implemented. All other methods throw an
UnsupportedOperationException. DatabaseConfiguration uses more than getConnection().| Modifier and Type | Field and Description |
|---|---|
protected JDBCDataSource |
dataSource
The data source providing the connection.
|
protected static java.lang.String |
unsupported
The message for the
UnsupportedOperationExceptions thrown by
all methods except getConnection(). |
| Constructor and Description |
|---|
DataSourceWrapper(JDBCDataSource dataSource)
Creates a
DataSource providing a connection from the
designated JDBCDataSource. |
| Modifier and Type | Method and Description |
|---|---|
java.sql.Connection |
getConnection() |
java.sql.Connection |
getConnection(java.lang.String username,
java.lang.String password) |
int |
getLoginTimeout() |
java.io.PrintWriter |
getLogWriter() |
java.util.logging.Logger |
getParentLogger() |
boolean |
isWrapperFor(java.lang.Class<?> iface) |
void |
setLoginTimeout(int seconds) |
void |
setLogWriter(java.io.PrintWriter out) |
<T> T |
unwrap(java.lang.Class<T> iface) |
protected static final java.lang.String unsupported
UnsupportedOperationExceptions thrown by
all methods except getConnection().protected final JDBCDataSource dataSource
public DataSourceWrapper(JDBCDataSource dataSource)
DataSource providing a connection from the
designated JDBCDataSource.dataSource - The data source providing the connection.public java.sql.Connection getConnection()
throws java.sql.SQLException
getConnection in interface javax.sql.DataSourcejava.sql.SQLExceptionpublic java.sql.Connection getConnection(java.lang.String username,
java.lang.String password)
getConnection in interface javax.sql.DataSourcepublic int getLoginTimeout()
getLoginTimeout in interface javax.sql.CommonDataSourcepublic java.io.PrintWriter getLogWriter()
getLogWriter in interface javax.sql.CommonDataSourcepublic void setLoginTimeout(int seconds)
setLoginTimeout in interface javax.sql.CommonDataSourcepublic void setLogWriter(java.io.PrintWriter out)
setLogWriter in interface javax.sql.CommonDataSourcepublic boolean isWrapperFor(java.lang.Class<?> iface)
throws java.sql.SQLException
isWrapperFor in interface java.sql.Wrapperjava.sql.SQLExceptionpublic <T> T unwrap(java.lang.Class<T> iface)
throws java.sql.SQLException
unwrap in interface java.sql.Wrapperjava.sql.SQLExceptionpublic java.util.logging.Logger getParentLogger()
throws java.sql.SQLFeatureNotSupportedException
getParentLogger in interface javax.sql.CommonDataSourcejava.sql.SQLFeatureNotSupportedException