diff geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java @ 884:12f88239fb33

Updated Javadocs to the Listed Classes. Also done some Codecleanup and removed unused Methods from the Code. geo-backend/trunk@842 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 26 Mar 2010 15:23:03 +0000
parents 5b536542ef56
children 1c3efbd2fc5a
line wrap: on
line diff
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java	Fri Mar 26 11:07:01 2010 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java	Fri Mar 26 15:23:03 2010 +0000
@@ -1,7 +1,7 @@
 /**
 		*
 		*/
-		package de.intevation.gnv.geobackend.sde.datasources;
+package de.intevation.gnv.geobackend.sde.datasources;
 
 import java.sql.Array;
 import java.sql.Blob;
@@ -30,29 +30,53 @@
 import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEPoolableObjectFactory;
 
 /**
+ * Wrapperclass between an @see java.sql.Connection and an 
+ * @see com.esri.sde.sdk.client.SeConnection
  * @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;
+    /**
+     * The Connection to the ArcSDE-backend.
+     */
+    private SeConnection seConnection = null;
+    /**
+     * Time that have to be gone until the Server will be requested if 
+     * the Connection is valid.
+     */
+    private long serverRoundtripInterval ;
 
+    /**
+     * The Time which a Connection can be inactive until the Connection 
+     * will be set to invalid.
+     */
     private long inactiveInterval;
 
+    /**
+     * The TimeStamp of the last usage of this Connection.
+     */
     private long lastTouch;
-	
+    
 
-	/**
-	 * Constructor
-	 */
-	public ArcSDEConnection(
+    /**
+     * Constructor
+     * @param server the URL to the Server
+     * @param port the Port of the Server
+     * @param database the Name of the Database
+     * @param username the Name of the User
+     * @param credentials the Credentials to the User-
+     * @param serverRoundtripInterval Time that have to be gone until the Server
+     *                                will be requested if the Connection is valid.
+     * @param inactiveInterval the Time which a Connection can be inactive until
+     *                         the Connection will be set to invalid.
+     * @throws ConnectionException
+     */
+    public ArcSDEConnection(
         String server,
         String port,
         String database,
@@ -67,15 +91,19 @@
         this.inactiveInterval        = inactiveInterval;
         lastTouch                    = System.currentTimeMillis();
 
-		try {
-	        seConnection = new SeConnection( server, port, database, username, credentials);
+        try {
+            seConnection = new SeConnection( server, port, database, username, credentials);
         }
         catch (SeException e) {
-	        log.error(e,e);
-	        throw new ConnectionException(e);
+            log.error(e,e);
+            throw new ConnectionException(e);
         }
-	}
+    }
 
+    /**
+     * TODO: DOCUMENT ME.
+     * @return
+     */
     public boolean isActive() {
         long current = System.currentTimeMillis();
         long last;
@@ -85,6 +113,9 @@
         return Math.abs(current - last) < inactiveInterval;
     }
 
+    /**
+     * Sets the last-Usage-Time to the Current-time
+     */
     public void touch() {
         long time = System.currentTimeMillis();
         synchronized (this) {
@@ -92,303 +123,291 @@
         }
     }
 
-	/**
-	 * @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#clearWarnings()
+     */
+    public void clearWarnings() throws SQLException {
+    }
 
-	/**
-	 * @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#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#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();
+    /**
+     * @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());
+            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#createStatement()
+     */
+    public Statement createStatement() throws SQLException {
+        return new ArcSDEStatement(this);
+    }
 
-	/**
-	 * @see java.sql.Connection#setSavepoint(java.lang.String)
-	 */
-	public Savepoint setSavepoint(String name) throws SQLException {
-
-		return null;
-	}
+    /**
+     * @see java.sql.Connection#createStatement(int, int)
+     */
+    public Statement createStatement(int resultSetType, int resultSetConcurrency)
+            throws SQLException {
+        return new ArcSDEStatement(this);
+    }
 
-	/**
-	 * @see java.sql.Connection#setTransactionIsolation(int)
-	 */
-	public void setTransactionIsolation(int level) throws SQLException {
-	}
+    /**
+     * @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#setTypeMap(java.util.Map)
-	 */
-	public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
-	}
-	
-	/**
+    /**
+     * @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;
+        return seConnection;
     }
 
     public Array createArrayOf(String arg0, Object[] arg1) throws SQLException {
@@ -424,7 +443,6 @@
     }
 
     public boolean isValid(int arg0) throws SQLException {
-        
         boolean valid = true;
         try {
             this.seConnection.testServer(serverRoundtripInterval);

http://dive4elements.wald.intevation.org