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. TheequalsandhashCodemethods 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 voidappendInfo(StringBuffer buf)voidclose()booleanequals(Object other)ConnectiongetConnection()ConnectiongetConnection(String user, String pass)DataSourcegetDelegate()Return the wrapped data source.DataSourcegetInnermostDelegate()Return the inner-most wrapped delegate.intgetLoginTimeout()PrintWritergetLogWriter()LoggergetParentLogger()inthashCode()booleanisWrapperFor(Class iface)voidsetLoginTimeout(int timeout)voidsetLogWriter(PrintWriter out)StringtoString()Objectunwrap(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:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
setLogWriter
public void setLogWriter(PrintWriter out) throws SQLException
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
getLoginTimeout
public int getLoginTimeout() throws SQLException- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
setLoginTimeout
public void setLoginTimeout(int timeout) throws SQLException- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getConnection
public Connection getConnection() throws SQLException
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getConnection
public Connection getConnection(String user, String pass) throws SQLException
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
close
public void close() throws Exception
-
isWrapperFor
public boolean isWrapperFor(Class iface)
- Specified by:
isWrapperForin interfaceWrapper
-
getParentLogger
public Logger getParentLogger() throws SQLFeatureNotSupportedException
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-
-