diff 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 diff
--- a/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java	Tue Jan 12 00:27:53 2010 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java	Fri Jan 15 10:09:41 2010 +0000
@@ -42,14 +42,17 @@
     
 	private SeConnection seConnection = null;
 	
+	private long serverRoundtripInterval;
+	
 
 
 	/**
 	 * Constructor
 	 */
-	public ArcSDEConnection(String server,String port,String database,String username,String credentials) throws ConnectionException {
+	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);
@@ -388,7 +391,16 @@
     }
 
     public boolean isValid(int arg0) throws SQLException {
-        return false;
+        
+        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 {

http://dive4elements.wald.intevation.org