package org.dayatang.dsmonitor; import org.dayatang.utils.Assert; import java.sql.*; import java.util.Map; import java.util.Properties; import java.util.concurrent.Executor; public class DelegatingConnection implements Connection { private Connection targetConnection; public DelegatingConnection(Connection targetConnection) { Assert.notNull(targetConnection, "'targetConnection' must not be null"); this.targetConnection = targetConnection; } public Connection getTargetConnection() { return targetConnection; } public void clearWarnings() throws SQLException { targetConnection.clearWarnings(); } public void close() throws SQLException { targetConnection.close(); } public void commit() throws SQLException { targetConnection.commit(); } public Statement createStatement() throws SQLException { return targetConnection.createStatement(); } public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { return targetConnection.createStatement(resultSetType, resultSetConcurrency); } public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return targetConnection.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability); } public boolean getAutoCommit() throws SQLException { return targetConnection.getAutoCommit(); } public String getCatalog() throws SQLException { return targetConnection.getCatalog(); } public int getHoldability() throws SQLException { return targetConnection.getHoldability(); } public DatabaseMetaData getMetaData() throws SQLException { return targetConnection.getMetaData(); } public int getTransactionIsolation() throws SQLException { return targetConnection.getTransactionIsolation(); } public Map<String, Class<?>> getTypeMap() throws SQLException { return targetConnection.getTypeMap(); } public SQLWarning getWarnings() throws SQLException { return targetConnection.getWarnings(); } public boolean isClosed() throws SQLException { return targetConnection.isClosed(); } public boolean isReadOnly() throws SQLException { return targetConnection.isReadOnly(); } public String nativeSQL(String sql) throws SQLException { return targetConnection.nativeSQL(sql); } public CallableStatement prepareCall(String sql) throws SQLException { return targetConnection.prepareCall(sql); } public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { return targetConnection.prepareCall(sql, resultSetType, resultSetConcurrency); } public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return targetConnection.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); } public PreparedStatement prepareStatement(String sql) throws SQLException { return targetConnection.prepareStatement(sql); } public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { return targetConnection.prepareStatement(sql, autoGeneratedKeys); } public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { return targetConnection.prepareStatement(sql, columnIndexes); } public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { return targetConnection.prepareStatement(sql, columnNames); } public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { return targetConnection.prepareStatement(sql, resultSetType, resultSetConcurrency); } public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return targetConnection.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); } public void releaseSavepoint(Savepoint savepoint) throws SQLException { targetConnection.releaseSavepoint(savepoint); } public void rollback() throws SQLException { targetConnection.rollback(); } public void rollback(Savepoint savepoint) throws SQLException { targetConnection.rollback(savepoint); } public void setAutoCommit(boolean autoCommit) throws SQLException { targetConnection.setAutoCommit(autoCommit); } public void setCatalog(String catalog) throws SQLException { targetConnection.setCatalog(catalog); } public void setHoldability(int holdability) throws SQLException { targetConnection.setHoldability(holdability); } public void setReadOnly(boolean readOnly) throws SQLException { targetConnection.setReadOnly(readOnly); } public Savepoint setSavepoint() throws SQLException { return targetConnection.setSavepoint(); } public Savepoint setSavepoint(String name) throws SQLException { return targetConnection.setSavepoint(name); } public void setTransactionIsolation(int level) throws SQLException { targetConnection.setTransactionIsolation(level); } public void setTypeMap(Map<String, Class<?>> map) throws SQLException { targetConnection.setTypeMap(map); } /** * * * */ public Array createArrayOf(String s, Object[] aobj) throws SQLException { return targetConnection.createArrayOf(s, aobj); } public Blob createBlob() throws SQLException { return targetConnection.createBlob(); } public Clob createClob() throws SQLException { return targetConnection.createClob(); } public NClob createNClob() throws SQLException { return targetConnection.createNClob(); } public SQLXML createSQLXML() throws SQLException { return targetConnection.createSQLXML(); } public Struct createStruct(String s, Object[] aobj) throws SQLException { return targetConnection.createStruct(s, aobj); } public Properties getClientInfo() throws SQLException { return targetConnection.getClientInfo(); } public String getClientInfo(String s) throws SQLException { return targetConnection.getClientInfo(s); } public boolean isValid(int i) throws SQLException { return targetConnection.isValid(i); } public void setClientInfo(Properties properties) throws SQLClientInfoException { targetConnection.setClientInfo(properties); } public void setClientInfo(String s, String s1) throws SQLClientInfoException { targetConnection.setClientInfo(s, s1); } public boolean isWrapperFor(Class<?> arg0) throws SQLException { return targetConnection.isWrapperFor(arg0); } public <T> T unwrap(Class<T> arg0) throws SQLException { return targetConnection.unwrap(arg0); } //For JDK 7 compatability public void setSchema(String schema) throws SQLException { } //For JDK 7 compatability public String getSchema() throws SQLException { return null; } //For JDK 7 compatability public void abort(Executor executor) throws SQLException { } //For JDK 7 compatability public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException { } //For JDK 7 compatability public int getNetworkTimeout() throws SQLException { return 0; } }