Package org.apache.openjpa.lib.jdbc
Class DelegatingDataSource
- java.lang.Object
-
- org.apache.openjpa.lib.jdbc.DelegatingDataSource
-
- All Implemented Interfaces:
Wrapper
,CommonDataSource
,DataSource
,Closeable
- Direct Known Subclasses:
DecoratingDataSource
public class DelegatingDataSource extends Object implements DataSource, Closeable
Wrapper around an existing data source. Subclasses can override the methods whose behavior they mean to change. Theequals
andhashCode
methods pass through to the base underlying data store.- Author:
- Abe White
-
-
Constructor Summary
Constructors Constructor Description DelegatingDataSource(DataSource ds)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
appendInfo(StringBuffer buf)
void
close()
boolean
equals(Object other)
Connection
getConnection()
Connection
getConnection(String user, String pass)
DataSource
getDelegate()
Return the wrapped data source.DataSource
getInnermostDelegate()
Return the inner-most wrapped delegate.int
getLoginTimeout()
PrintWriter
getLogWriter()
Logger
getParentLogger()
int
hashCode()
boolean
isWrapperFor(Class iface)
void
setLoginTimeout(int timeout)
void
setLogWriter(PrintWriter out)
String
toString()
Object
unwrap(Class iface)
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilder
-
Methods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
-
-
-
Constructor Detail
-
DelegatingDataSource
public DelegatingDataSource(DataSource ds)
Constructor. Supply wrapped data source.
-
-
Method Detail
-
getDelegate
public DataSource getDelegate()
Return the wrapped data source.
-
getInnermostDelegate
public DataSource getInnermostDelegate()
Return the inner-most wrapped delegate.
-
appendInfo
protected void appendInfo(StringBuffer buf)
-
getLogWriter
public PrintWriter getLogWriter() throws SQLException
- Specified by:
getLogWriter
in interfaceCommonDataSource
- Specified by:
getLogWriter
in interfaceDataSource
- Throws:
SQLException
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- Specified by:
setLogWriter
in interfaceCommonDataSource
- Specified by:
setLogWriter
in interfaceDataSource
- Throws:
SQLException
-
getLoginTimeout
public int getLoginTimeout() throws SQLException
- Specified by:
getLoginTimeout
in interfaceCommonDataSource
- Specified by:
getLoginTimeout
in interfaceDataSource
- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int timeout) throws SQLException
- Specified by:
setLoginTimeout
in interfaceCommonDataSource
- Specified by:
setLoginTimeout
in interfaceDataSource
- Throws:
SQLException
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
getConnection
public Connection getConnection(String user, String pass) throws SQLException
- Specified by:
getConnection
in interfaceDataSource
- Throws:
SQLException
-
close
public void close() throws Exception
-
isWrapperFor
public boolean isWrapperFor(Class iface)
- Specified by:
isWrapperFor
in interfaceWrapper
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLogger
in interfaceCommonDataSource
- Throws:
SQLFeatureNotSupportedException
-
-