1 27 package org.objectweb.speedo.pm.lib; 28 29 import java.sql.CallableStatement ; 30 import java.sql.Connection ; 31 import java.sql.DatabaseMetaData ; 32 import java.sql.PreparedStatement ; 33 import java.sql.SQLException ; 34 import java.sql.SQLWarning ; 35 import java.sql.Savepoint ; 36 import java.sql.Statement ; 37 import java.util.Map ; 38 39 import javax.jdo.JDOUserException; 40 41 47 public class DSConnectionFilter implements Connection { 48 49 Connection inner; 50 51 54 boolean reallyClose; 55 56 60 public DSConnectionFilter(Object inner, boolean reallyClose) { 61 super(); 62 this.inner = (Connection ) inner; 63 this.reallyClose = reallyClose; 64 } 65 public void clearWarnings() throws SQLException { 66 throw new JDOUserException("Action forbidden on JDO connection"); 67 } 68 public void close() throws SQLException { 69 if (reallyClose) { 70 inner.close(); 71 } 72 inner = null; 73 } 74 public void commit() throws SQLException { 75 throw new JDOUserException("Action forbidden on JDO connection"); 76 } 77 public Statement createStatement() throws SQLException { 78 return inner.createStatement(); 79 } 80 public Statement createStatement(int resultSetType, 81 int resultSetConcurrency, int resultSetHoldability) 82 throws SQLException { 83 return inner.createStatement( 84 resultSetType,resultSetConcurrency, resultSetHoldability); 85 } 86 public Statement createStatement(int resultSetType, int resultSetConcurrency) 87 throws SQLException { 88 return inner.createStatement(resultSetType, resultSetConcurrency); 89 } 90 public boolean getAutoCommit() throws SQLException { 91 return inner.getAutoCommit(); 92 } 93 public String getCatalog() throws SQLException { 94 return inner.getCatalog(); 95 } 96 public int getHoldability() throws SQLException { 97 return inner.getHoldability(); 98 } 99 public DatabaseMetaData getMetaData() throws SQLException { 100 throw new JDOUserException("Action forbidden on JDO connection"); 101 } 102 public int getTransactionIsolation() throws SQLException { 103 return inner.getTransactionIsolation(); 104 } 105 public Map getTypeMap() throws SQLException { 106 return inner.getTypeMap(); 107 } 108 public SQLWarning getWarnings() throws SQLException { 109 return inner.getWarnings(); 110 } 111 public boolean isClosed() throws SQLException { 112 return inner.isClosed(); 113 } 114 public boolean isReadOnly() throws SQLException { 115 return inner.isReadOnly(); 116 } 117 public String nativeSQL(String sql) throws SQLException { 118 return inner.nativeSQL(sql); 119 } 120 public CallableStatement prepareCall(String sql, int resultSetType, 121 int resultSetConcurrency, int resultSetHoldability) 122 throws SQLException { 123 return inner.prepareCall(sql, 124 resultSetType, resultSetConcurrency, resultSetHoldability); 125 } 126 public CallableStatement prepareCall(String sql, int resultSetType, 127 int resultSetConcurrency) throws SQLException { 128 return inner.prepareCall(sql, resultSetType, resultSetConcurrency); 129 } 130 public CallableStatement prepareCall(String sql) throws SQLException { 131 return inner.prepareCall(sql); 132 } 133 public PreparedStatement prepareStatement(String sql, int resultSetType, 134 int resultSetConcurrency, int resultSetHoldability) 135 throws SQLException { 136 return inner.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); 137 } 138 public PreparedStatement prepareStatement(String sql, int resultSetType, 139 int resultSetConcurrency) throws SQLException { 140 return inner.prepareStatement(sql, resultSetType, resultSetConcurrency); 141 } 142 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) 143 throws SQLException { 144 return inner.prepareStatement(sql, autoGeneratedKeys); 145 } 146 public PreparedStatement prepareStatement(String sql, int[] columnIndexes) 147 throws SQLException { 148 return inner.prepareStatement(sql, columnIndexes); 149 } 150 public PreparedStatement prepareStatement(String sql, String [] columnNames) 151 throws SQLException { 152 return inner.prepareStatement(sql, columnNames); 153 } 154 public PreparedStatement prepareStatement(String sql) throws SQLException { 155 return inner.prepareStatement(sql); 156 } 157 public void releaseSavepoint(Savepoint savepoint) throws SQLException { 158 throw new JDOUserException("Action forbidden on JDO connection"); 159 } 160 public void rollback() throws SQLException { 161 throw new JDOUserException("Action forbidden on JDO connection"); 162 } 163 public void rollback(Savepoint savepoint) throws SQLException { 164 throw new JDOUserException("Action forbidden on JDO connection"); 165 } 166 public void setAutoCommit(boolean autoCommit) throws SQLException { 167 throw new JDOUserException("Action forbidden on JDO connection"); 168 } 169 public void setCatalog(String catalog) throws SQLException { 170 throw new JDOUserException("Action forbidden on JDO connection"); 171 } 172 public void setHoldability(int holdability) throws SQLException { 173 throw new JDOUserException("Action forbidden on JDO connection"); 174 } 175 public void setReadOnly(boolean readOnly) throws SQLException { 176 throw new JDOUserException("Action forbidden on JDO connection"); 177 } 178 public Savepoint setSavepoint() throws SQLException { 179 throw new JDOUserException("Action forbidden on JDO connection"); 180 } 181 public Savepoint setSavepoint(String name) throws SQLException { 182 throw new JDOUserException("Action forbidden on JDO connection"); 183 } 184 public void setTransactionIsolation(int level) throws SQLException { 185 throw new JDOUserException("Action forbidden on JDO connection"); 186 } 187 public void setTypeMap(Map map) throws SQLException { 188 throw new JDOUserException("Action forbidden on JDO connection"); 189 } 190 } 191 | Popular Tags |