Package net.solarnetwork.dao.jdbc
Class SQLExceptionHandlerDataSourceProxy
java.lang.Object
net.solarnetwork.dao.jdbc.SQLExceptionHandlerDataSourceProxy
- All Implemented Interfaces:
Wrapper,EventListener,CommonDataSource,ConnectionEventListener,DataSource
public class SQLExceptionHandlerDataSourceProxy
extends Object
implements DataSource, ConnectionEventListener
A
DataSource proxy that catches connection errors in order to handle
the exceptions from SQLExceptionHandler instances registered with the
system.- Version:
- 2.0
- Author:
- matt
-
Constructor Summary
ConstructorsConstructorDescriptionSQLExceptionHandlerDataSourceProxy(DataSource delegate, OptionalServiceCollection<SQLExceptionHandler> handlers) Construct with values. -
Method Summary
Modifier and TypeMethodDescriptionvoidconnectionClosed(ConnectionEvent event) voidgetConnection(String username, String password) Get the delegate DataSource.intbooleanisWrapperFor(Class<?> iface) voidsetLoginTimeout(int seconds) voidsetLogWriter(PrintWriter out) <T> TMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.sql.CommonDataSource
createShardingKeyBuilderMethods inherited from interface javax.sql.DataSource
createConnectionBuilder
-
Constructor Details
-
SQLExceptionHandlerDataSourceProxy
public SQLExceptionHandlerDataSourceProxy(DataSource delegate, OptionalServiceCollection<SQLExceptionHandler> handlers) Construct with values.- Parameters:
delegate- TheDataSourceto delegate to.handlers- The handlers to use. May be null.
-
-
Method Details
-
getDelegate
Get the delegate DataSource.- Returns:
- The delegate.
-
getConnection
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
getConnection
- Specified by:
getConnectionin interfaceDataSource- Throws:
SQLException
-
connectionClosed
- Specified by:
connectionClosedin interfaceConnectionEventListener
-
connectionErrorOccurred
- Specified by:
connectionErrorOccurredin interfaceConnectionEventListener
-
getLogWriter
- Specified by:
getLogWriterin interfaceCommonDataSource- Specified by:
getLogWriterin interfaceDataSource- Throws:
SQLException
-
unwrap
- Specified by:
unwrapin interfaceWrapper- Throws:
SQLException
-
setLogWriter
- Specified by:
setLogWriterin interfaceCommonDataSource- Specified by:
setLogWriterin interfaceDataSource- Throws:
SQLException
-
isWrapperFor
- Specified by:
isWrapperForin interfaceWrapper- Throws:
SQLException
-
setLoginTimeout
- Specified by:
setLoginTimeoutin interfaceCommonDataSource- Specified by:
setLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getLoginTimeout
- Specified by:
getLoginTimeoutin interfaceCommonDataSource- Specified by:
getLoginTimeoutin interfaceDataSource- Throws:
SQLException
-
getParentLogger
- Specified by:
getParentLoggerin interfaceCommonDataSource- Throws:
SQLFeatureNotSupportedException
-