Mercurial > dive4elements > gnv-client
view geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java @ 551:1f6e2b256247
Improved the Objectvalidation of the ArcSDE-Databaseconnections
geo-backend/trunk@544 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 15 Jan 2010 10:09:41 +0000 |
parents | 210716612c30 |
children | 5b536542ef56 |
line wrap: on
line source
/** * */ package de.intevation.gnv.geobackend.sde.datasources; import java.sql.Array; import java.sql.Blob; import java.sql.CallableStatement; import java.sql.Clob; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.NClob; import java.sql.PreparedStatement; import java.sql.SQLClientInfoException; import java.sql.SQLException; import java.sql.SQLWarning; import java.sql.SQLXML; import java.sql.Savepoint; import java.sql.Statement; import java.sql.Struct; import java.util.Map; import java.util.Properties; import org.apache.log4j.Logger; import com.esri.sde.sdk.client.SeConnection; import com.esri.sde.sdk.client.SeException; import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEPoolableObjectFactory; /** * @author Tim Englich <tim.englich@intevation.de> * */ public class ArcSDEConnection implements Connection { /** * the logger, used to log exceptions and additonaly information */ private static Logger log = Logger.getLogger(ArcSDEPoolableObjectFactory.class); private SeConnection seConnection = null; private long serverRoundtripInterval; /** * Constructor */ public ArcSDEConnection(String server,String port,String database,String username,String credentials, long serverRoundtripInterval) throws ConnectionException { try { seConnection = new SeConnection(server,port,database,username,credentials); this.serverRoundtripInterval = serverRoundtripInterval; } catch (SeException e) { log.error(e,e); throw new ConnectionException(e); } } /** * @see java.sql.Connection#clearWarnings() */ public void clearWarnings() throws SQLException { } /** * @see java.sql.Connection#close() */ public void close() throws SQLException { try { this.seConnection.close(); } catch (SeException e) { log.error(e,e); throw new SQLException(e.getMessage()); } } /** * @see java.sql.Connection#commit() */ public void commit() throws SQLException { try{ this.seConnection.commitTransaction(); } catch (SeException e) { log.error(e,e); throw new SQLException(e.getMessage()); } } /** * @see java.sql.Connection#createStatement() */ public Statement createStatement() throws SQLException { return new ArcSDEStatement(this); } /** * @see java.sql.Connection#createStatement(int, int) */ public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException { return new ArcSDEStatement(this); } /** * @see java.sql.Connection#createStatement(int, int, int) */ public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return new ArcSDEStatement(this); } /** * @see java.sql.Connection#getAutoCommit() */ public boolean getAutoCommit() throws SQLException { return false; } /** * @see java.sql.Connection#getCatalog() */ public String getCatalog() throws SQLException { return null; } /** * @see java.sql.Connection#getHoldability() */ public int getHoldability() throws SQLException { return 0; } /** * @see java.sql.Connection#getMetaData() */ public DatabaseMetaData getMetaData() throws SQLException { return null; } /** * @see java.sql.Connection#getTransactionIsolation() */ public int getTransactionIsolation() throws SQLException { return 0; } /** * @see java.sql.Connection#getTypeMap() */ public Map<String, Class<?>> getTypeMap() throws SQLException { return null; } /** * @see java.sql.Connection#getWarnings() */ public SQLWarning getWarnings() throws SQLException { return null; } /** * @see java.sql.Connection#isClosed() */ public boolean isClosed() throws SQLException { try{ return this.seConnection.isClosed(); } catch (Exception e) { log.error(e,e); throw new SQLException(e.getMessage()); } } /** * @see java.sql.Connection#isReadOnly() */ public boolean isReadOnly() throws SQLException { return false; } /** * @see java.sql.Connection#nativeSQL(java.lang.String) */ public String nativeSQL(String sql) throws SQLException { return null; } /** * @see java.sql.Connection#prepareCall(java.lang.String) */ public CallableStatement prepareCall(String sql) throws SQLException { return null; } /** * @see java.sql.Connection#prepareCall(java.lang.String, int, int) */ public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { return null; } /** * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int) */ public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return null; } /** * @see java.sql.Connection#prepareStatement(java.lang.String) */ public PreparedStatement prepareStatement(String sql) throws SQLException { return null; } /** * @see java.sql.Connection#prepareStatement(java.lang.String, int) */ public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException { return null; } /** * @see java.sql.Connection#prepareStatement(java.lang.String, int[]) */ public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException { return null; } /** * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[]) */ public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException { return null; } /** * @see java.sql.Connection#prepareStatement(java.lang.String, int, int) */ public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException { return null; } /** * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int) */ public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException { return null; } /** * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint) */ public void releaseSavepoint(Savepoint savepoint) throws SQLException { } /** * @see java.sql.Connection#rollback() */ public void rollback() throws SQLException { try { this.seConnection.rollbackTransaction(); } catch (SeException e) { log.error(e,e); throw new SQLException(e.getMessage()); } } /** * @see java.sql.Connection#rollback(java.sql.Savepoint) */ public void rollback(Savepoint savepoint) throws SQLException { this.rollback(); } /** * @see java.sql.Connection#setAutoCommit(boolean) */ public void setAutoCommit(boolean autoCommit) throws SQLException { } /** * @see java.sql.Connection#setCatalog(java.lang.String) */ public void setCatalog(String catalog) throws SQLException { } /** * @see java.sql.Connection#setHoldability(int) */ public void setHoldability(int holdability) throws SQLException { } /** * @see java.sql.Connection#setReadOnly(boolean) */ public void setReadOnly(boolean readOnly) throws SQLException { } /** * @see java.sql.Connection#setSavepoint() */ public Savepoint setSavepoint() throws SQLException { return null; } /** * @see java.sql.Connection#setSavepoint(java.lang.String) */ public Savepoint setSavepoint(String name) throws SQLException { return null; } /** * @see java.sql.Connection#setTransactionIsolation(int) */ public void setTransactionIsolation(int level) throws SQLException { } /** * @see java.sql.Connection#setTypeMap(java.util.Map) */ public void setTypeMap(Map<String, Class<?>> map) throws SQLException { } /** * @return the seConnection */ public SeConnection getSeConnection() { return seConnection; } public Array createArrayOf(String arg0, Object[] arg1) throws SQLException { return null; } public Blob createBlob() throws SQLException { return null; } public Clob createClob() throws SQLException { return null; } public NClob createNClob() throws SQLException { return null; } public SQLXML createSQLXML() throws SQLException { return null; } public Struct createStruct(String arg0, Object[] arg1) throws SQLException { return null; } public Properties getClientInfo() throws SQLException { return null; } public String getClientInfo(String arg0) throws SQLException { return null; } public boolean isValid(int arg0) throws SQLException { boolean valid = true; try { this.seConnection.testServer(serverRoundtripInterval); } catch (SeException e) { log.debug("The validation of the Connection has occured an Error. The connection is invalid."); valid = false; } return valid; } public void setClientInfo(Properties arg0) throws SQLClientInfoException { } public void setClientInfo(String arg0, String arg1) throws SQLClientInfoException { } public boolean isWrapperFor(Class<?> iface) throws SQLException { return false; } public <T> T unwrap(Class<T> iface) throws SQLException { return null; } }