changeset 145:92faade399e4 0.1

merged geo-backend/0.1
author Thomas Arendsen Hein <thomas@intevation.de>
date Fri, 28 Sep 2012 12:13:42 +0200
parents f6f0e4ce4a35 (current diff) fcfa9d2de572 (diff)
children 3a28fef65500
files
diffstat 45 files changed, 5466 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/ChangeLog	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,161 @@
+2009-10-07	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	RELEASE 0.1
+
+	* Changes, NEWS: Summarized changes.
+
+2009-10-06	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* Changelog -> ChangeLog: Renamed to make eclipse happy. Unified changelog style.
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEQuery.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java:
+	  Removed needless imports.
+
+	* pom.xml: xmllint-ed
+
+2009-09-29	Tim Englich	<tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java (DATE_PATTERN) Edited:
+	  Make the Constants assessible for other Parts of the Project to reduce the TouchPoints for
+	  Dateformats.
+	  
+2009-09-24	Tim Englich	<tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java Edited, 
+	  src/main/java/de/intevation/gnv/geobackend/base/Result.java Edited, 
+	  src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java Edited,  
+	  src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java Edited:
+	  Make Classes Serializable for Storing in ArtifactDatabase 
+	  
+2009-09-21	Tim Englich	<tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java: 
+	  Added formatted Date handling in getString Method
+
+2009-09-21	Tim Englich	<tim.englich@intevation.de>
+
+	* src/test/ressources/QueryExecutorTestCase.properties Edited, 
+	  src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java Edited:
+	  Some tests for Spatialqueries added 
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java Edited: 
+	  Put the final Querystring into a Logmessage
+	  
+2009-09-09	Tim Englich	<tim.englich@intevation.de>
+
+	* target/**: Removed.
+
+2009-09-09	Tim Englich	<tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java (getDate):
+	  Instance Check for DateValues
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java (next):
+	  Logging removed because the performance slowdown fetching many ResultSets 
+
+2009-09-04	Tim Englich	<tim.englich@intevation.de>
+
+	* pom.xml: Edited GroupID changed
+	
+2009-09-04	Tim Englich	<tim.englich@intevation.de>
+
+	* pom.xml: Edited
+	  Buildplugins for Maven-Compiler and Maven-Eclipse Plugin integrated.
+
+2009-09-04	Tim Englich	<tim.englich@intevation.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java (setFilterValues): Edited
+	  Fixed Bug using replaceFirst an ?. You hav to put a ? in [].
+
+	* src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java (testQueryExecutor): Edited
+	Further TestCase using a where clause implemented. More asserts testimg the number of Results integrated
+
+	* src/test/ressources/QueryExecutorTestCase.properties: Edited
+	Statement Fetching only one Mesh integrated.
+	  
+2009-09-04	Tim Englich	<tim.englich@intevation.de>
+	
+	* src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java: Edited
+	  Changed Tabs against 4 Spaces. Commennts written
+	
+	* src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java: Edited,
+	* src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java: Edited
+	
+	Changed Tabs against 4 Spaces
+	
+	* src/test/ressources/QueryExecutorTestCase.properties: 
+	  Create a Testpropertiesfile with Samplestatements for the Testcase QueryExecutorTestCase.
+	
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java: Edited:
+	  The Method getResultSetMetaData modified to return an Instance of the ArcSDEResultSetMetaData-Class
+	
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java: 
+	  Implementation of the java.sql.ResultSetMetaData Interface for wrapping the Metainformations of an 
+	  ArcSDE-ResultSet
+	
+	* src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java:  Testfall
+	  Testcase for the Inteface QueryExecuor implemented. This Testcats should test the fundamental Functions of the
+	  Impelmentation of this interface. currently the DefaulQueryExecutor is used to fetch Resukts from the MEDIAN.MESH
+	  Table from BSH.
+	
+	* src/main/java/de/intevation/gnv/geobackend/base/query/container/exception/QueryContainerException.java, 
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java, 
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/DefaultQueryContainer.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java:
+	  Container for central providing of configured Datastorequeries.
+	  An instance can be instantiated using the factory.
+	
+	* src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java, 
+	  src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java, 
+	  src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java: 
+	  Implementation of an Infrastructure for querying Datastores.
+	  An Instance can be instantiated using the factory.
+	
+	* src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java, 
+	  src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java, 
+	  src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java, 
+	  src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java, 
+	  src/main/java/de/intevation/gnv/geobackend/base/Result.java: 
+	  Implementation of an Containerinfrastrucure for storing of ResultSets of Querys
+
+2009-09-02	Tim Englich	<tim.englich@intevaion.de>
+
+	* Changelog: Changelog adjusted
+	 
+2009-09-02	Tim Englich	<tim.englich@intevaion.de>
+
+	* src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/ConnectionException.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java:
+	  New classes based on java.sql.* interface structure.
+
+	* src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java,
+	  src/test/ressources/ArcSDEConnectionPoolTestCase.properties:
+	  Test class for new data access layer.
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPool.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEConnection.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEDatasource.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/ConnectionException.java:
+	  Removed obsolete access classes.
+
+	* src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEQuery.java,
+	  src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java:
+	  Modified: adjusted classes to fit the new infrastructure.
+
+2009-09-02	Tim Englich	<tim.englich@intevaion.de>
+
+	Java project generated, Import of SDE-Datasources 
+	Revision 101 from Repository of principal de/intevation/gnv/geobackend/sde/datasources/**/* 
+
+	* README, Changelog, Changes, NEWS, TODO: New. Initial setup
+	* pom.xml: Add dependencies
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/Changes	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,8 @@
+2009-10-07	RELEASE 0.1
+
+	New:
+
+	* Imported proto type database access layer.
+	* Made access layer look like java.sql.*
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/NEWS	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,5 @@
+2009-10-07	RELEASE 0.1
+
+	New:
+
+	* Initial version of the database access layer.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/pom.xml	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,64 @@
+<?xml version="1.0"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>de.intevation.bsh</groupId>
+  <artifactId>geo-backend</artifactId>
+  <packaging>jar</packaging>
+  <version>1.0-SNAPSHOT</version>
+  <name>geo-backend</name>
+  <url>http://maven.apache.org</url>
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-eclipse-plugin</artifactId>
+        <version>2.5.1</version>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.0.2</version>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+    </plugins>
+  </build>
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>3.8.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.esri.sde</groupId>
+      <artifactId>jsde_sdk</artifactId>
+      <version>9.2.5</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.esri.sde</groupId>
+      <artifactId>jpe_sdk</artifactId>
+      <version>9.2.5</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.ibm</groupId>
+      <artifactId>icu4j</artifactId>
+      <version>3.2</version>
+      <scope>compile</scope>
+    </dependency>
+    <dependency>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+      <version>[1.2,)</version>
+    </dependency>
+    <dependency>
+      <groupId>commons-pool</groupId>
+      <artifactId>commons-pool</artifactId>
+      <version>1.5.2</version>
+    </dependency>
+  </dependencies>
+</project>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResult.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,116 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base;
+
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.HashMap;
+
+import de.intevation.gnv.geobackend.util.DateUtils;
+
+/**
+ * Defaultimplementation of the Interface Result.
+ * This Class stores the Attributevalues of one Result.
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class DefaultResult implements Result {
+
+    /**
+     * THE UID of this Classe
+     */
+    private static final long serialVersionUID = -6886218808840982766L;
+
+
+    /**
+     * HashMap which stores the Columnvalues identified by the unique Columnname
+     */
+    private HashMap<String, Object> columnValues = new HashMap<String, Object>();
+    
+    
+    /**
+     * The ResultDescriptor which describes the ColumnValues
+     */
+    private ResultDescriptor resultDescriptor = null;
+    
+    /**
+     * Constructor
+     */
+    public DefaultResult(ResultDescriptor resultDescriptor) {
+        super();
+        this.resultDescriptor = resultDescriptor;
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getDate(java.lang.String)
+     */
+    public Date getDate(String columnName) {
+        Object o = this.columnValues.get(columnName);
+        Date d = null;
+        if(o instanceof Date){
+            d = (Date)o;
+        }else if (o instanceof GregorianCalendar){
+            d = ((GregorianCalendar)o).getTime();
+        }
+        return d;
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getDouble(java.lang.String)
+     */
+    public Double getDouble(String columnName) {
+        return (Double)this.columnValues.get(columnName);
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getFloat(java.lang.String)
+     */
+    public Float getFloat(String columnName) {
+        return (Float)this.columnValues.get(columnName);
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getInteger(java.lang.String)
+     */
+    public Integer getInteger(String columnName) {
+        return (Integer)this.columnValues.get(columnName);
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getResultDescriptor()
+     */
+    public ResultDescriptor getResultDescriptor() {
+        return this.resultDescriptor;
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getString(java.lang.String)
+     */
+    public String getString(String columnName) {
+        Object o = this.columnValues.get(columnName);
+        if(o instanceof Date){
+            return DateUtils.getPatternedDateAmer((Date)o);
+        }else if (o instanceof GregorianCalendar){
+            Date d = ((GregorianCalendar)o).getTime();
+            return DateUtils.getPatternedDateAmer(d);
+        }else{
+            return this.columnValues.get(columnName).toString();
+        }
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#addColumnValue(java.lang.String, java.lang.Object)
+     */
+    public void addColumnValue(String columnName, Object value) {
+        this.columnValues.put(columnName, value);
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.Result#getObject(java.lang.String)
+     */
+    public Object getObject(String columnName) {
+        return this.columnValues.get(columnName);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/DefaultResultDescriptor.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,70 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This Class is the DefaultImplementation of the
+ * Interface ResultDescriptor
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class DefaultResultDescriptor implements ResultDescriptor {
+
+    /**
+     *The Uid of this Class
+     */
+    private static final long serialVersionUID = 7016889733270716130L;
+
+    /**
+     * The Names of the Columns of one Result
+     */
+    private List<String> columnNames = new ArrayList<String>();
+    
+    /**
+     * The Name of the Classes of the Values of one Result.
+     */
+    private List<String> columnClassNames = new ArrayList<String>();
+    
+    
+    
+    /**
+     * Constructor
+     */
+    public DefaultResultDescriptor() {
+        super();
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.ResultDescriptor#getColumnClassName(int)
+     */
+    public String getColumnClassName(int column) {
+        return this.columnClassNames.get(column);
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.ResultDescriptor#getColumnCount()
+     */
+    public int getColumnCount() {
+        return this.columnClassNames.size();
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.ResultDescriptor#getColumnName(int)
+     */
+    public String getColumnName(int column) {
+        return this.columnNames.get(column);
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.ResultDescriptor#addColumn(java.lang.String, java.lang.String)
+     */
+    public void addColumn(String name, String className) {
+        this.columnClassNames.add(className);
+        this.columnNames.add(name);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/Result.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,73 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+/**
+ * Interface which provides the Methods for Accessing
+ * the Data of an ResultEntry
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public interface Result extends Serializable{
+  
+    /**
+     * Returns the ResultDescriptor which provides the
+     * ResultMetadatse
+     * @return the ResultDescriptor
+     */
+    public ResultDescriptor getResultDescriptor();
+    
+    /**
+     * Returns the Columnvalue as a String
+     * @param columnName the Name of the column
+     * @return the Columnvalue as a String
+     */
+    public String getString(String columnName);
+    
+    /**
+     * Returns the Columnvalue as a Date
+     * @param columnName the Name of the column
+     * @return the Columnvalue as a Date
+     */
+    public Date getDate(String columnName);
+    
+    /**
+     * Returns the Columnvalue as a Integer
+     * @param columnName the Name of the column
+     * @return the Columnvalue as a Integer
+     */
+    public Integer getInteger(String columnName);
+
+    /**
+     * Returns the Columnvalue as a Float
+     * @param columnName the Name of the column
+     * @return the Columnvalue as a Float
+     */
+    public Float getFloat(String columnName);
+    
+    /**
+     * Returns the Columnvalue as a Double
+     * @param columnName the Name of the column
+     * @return the Columnvalue as a Double
+     */
+    public Double getDouble(String columnName);
+    
+    /**
+     * Returns the Columnvalue as a Object
+     * @param columnName the Name of the column
+     * @return the Columnvalue as a Object
+     */
+    public Object getObject(String columnName);
+    
+    /**
+     * Adds an new Coumnvalue to the Result.
+     * @param columnName the Name of the Column
+     * @param value the Value of the Column
+     */
+    public void addColumnValue(String columnName, Object value);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/ResultDescriptor.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,41 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base;
+
+import java.io.Serializable;
+
+/**
+ * Interface which provides the Methods for Accessing
+ * the MetaData of an ResultEntry
+ * @author Tim Englich <tim.englich@intevation.de>
+ */
+public interface ResultDescriptor extends Serializable{
+
+    /**
+     * Returns the Classname of the Column
+     * @param column the id of the Column which is requested
+     * @return the Classname of the Column
+     */
+    public String getColumnClassName(int column);
+    
+    /**
+     * Returns the Number of Columns
+     * @return the Number of Columns
+     */
+    public int getColumnCount();
+    
+    /**
+     * Returns the Name of the Column which belongs to the given Columnindex
+     * @param column the Index of the Column
+     * @return the Name of the Column
+     */
+    public String getColumnName(int column);
+    
+    /**
+     * Adds a new ColumnDescription into the Descriptor
+     * @param name the Name of the Column (unique)
+     * @param className the Name of the Class (e.g. Double, Integer
+     */
+    public void addColumn(String name, String className);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPool.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,35 @@
+package de.intevation.gnv.geobackend.base.connectionpool;
+
+import java.sql.Connection;
+import java.util.Properties;
+
+import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
+
+/**
+ * Interfacedefinition for an Generic ConnectionPool
+ * @author Tim Englich <tim.englich@intevation.de>
+ */
+public interface ConnectionPool {
+    
+    /**
+     * Delivers the Connection to the Database
+     * @param connectionID the ID of the Connection 
+     * @return the Connection to the Database
+     * @throws ConnectionException
+     */
+    public Connection getConnection(String connectionID) throws ConnectionException;
+
+    /**
+     * Returns the Connection to the Pool
+     * @param connection the Connection which should be returned to the Pool
+     * @throws ConnectionException
+     */
+    public void closeConnection(Connection connection) throws ConnectionException;
+
+    /**
+     * Initializes the ConnectionPool
+     * @param properties The Properties which should be used for initializing theConnectionPool
+     */
+    public void initialize(Properties properties);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/ConnectionPoolFactory.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,85 @@
+/**
+ * 
+ */
+package de.intevation.gnv.geobackend.base.connectionpool;
+
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEConnectionPool;
+
+/**
+ * Factoryimplementation for the Interface ConnectionPool.
+ * This factory delivers Instances of the Interface ConnectionPool.
+ * @author Tim Englich <tim.englich@intevation.de>
+ */
+public class ConnectionPoolFactory {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(ConnectionPoolFactory.class);
+
+    
+    /**
+     * The singleton Instance of this Factory.
+     */
+    private static ConnectionPoolFactory instance = null;
+
+    /**
+     * The ConnectionPool providing the Connections to the DatabaseBackends
+     */
+    private ConnectionPool connectionPool = null;
+
+    /**
+     * Basic-Constructor of this Class
+     */
+    private ConnectionPoolFactory() {
+    	super();
+    }
+
+    /**
+     * This Method provides an singleton Instance of this Class.
+     * @return an singleton Instance of this Class
+     */
+    public static ConnectionPoolFactory getInstance(){
+        if (instance == null){
+        	instance = new ConnectionPoolFactory();
+        }
+        return instance;
+    }
+    
+    
+    /**
+     * Getting the ConnectionPool
+     * @return the ConnectionPool
+     */
+    public ConnectionPool getConnectionPool(){
+        return this.connectionPool;
+    }
+
+    /**
+     * Initializes the ConnectionPool.
+     * Should only be called once on system startup
+     * @param properties the Properties for the Individual Configuration of the ConnectionPool
+     */
+    public void initializeConnectionPool(Properties properties){
+        log.debug("ConnectionPoolFactory.initializeConnectionPool");
+        if (this.connectionPool == null){
+            //TODO: Hier könnte anhand eines Flags die Instanz des Connectionpools umgeschaltet werden.
+            this.connectionPool = new ArcSDEConnectionPool();
+            this.connectionPool.initialize(properties);
+        }else{
+            log.warn("ConnectionPool already initialized");
+        }	
+    }
+
+    /**
+     * Checks if the ConnectionPool has already been initialized.
+     * @return true if the ConnectionPool is initialized.
+     */
+    public boolean isInitialized(){
+        return this.connectionPool != null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/connectionpool/exception/ConnectionException.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,114 @@
+/**
+ * Title:           lConnectionException, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/ConnectionException.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/ConnectionException.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     21.11.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: drewnak $
+ * modified on:     $Date: 2008/08/18 14:50:33 $
+ * Version:         $Revision: 1.2 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.geobackend.base.connectionpool.exception;
+
+import com.esri.sde.sdk.client.SeError;
+import com.esri.sde.sdk.client.SeException;
+
+import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The class <code>lConnectionException</code> fulfills the following purposes:
+ * <ol>
+ * <li></li>
+ * </ol>
+ *
+ * @author blume
+ * @version 1.0
+ * @serial 1.0
+ * @see
+ * @since 21.11.2007 08:13:05
+ */
+public class ConnectionException extends TechnicalException {
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(ConnectionException.class);
+
+    /**
+     * Constructs a new exception with <code>null</code> as its detail message.
+     * The cause is not initialized, and may subsequently be initialized by a
+     * call to {@link #initCause}.
+     */
+    public ConnectionException() {
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message.  The
+     * cause is not initialized, and may subsequently be initialized by
+     * a call to {@link #initCause}.
+     *
+     * @param message the detail message. The detail message is saved for
+     *                later retrieval by the {@link #getMessage()} method.
+     */
+    public ConnectionException(String message) {
+        super(message);
+    }
+    public ConnectionException(Throwable pCause) {
+        super(pCause);
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message and
+     * cause.  <p>Note that the detail message associated with
+     * <code>cause</code> is <i>not</i> automatically incorporated in
+     * this exception's detail message.
+     *
+     * @param message the detail message (which is saved for later retrieval
+     *                by the {@link #getMessage()} method).
+     * @param cause   the cause (which is saved for later retrieval by the
+     *                {@link #getCause()} method).  (A <tt>null</tt> value is
+     *                permitted, and indicates that the cause is nonexistent or
+     *                unknown.)
+     * @since 1.4
+     */
+    public ConnectionException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    /**
+     * Displays the details of an SeException (if available).
+     *
+     */
+    public void printError() {
+        if (getCause() != null && getCause() instanceof SeException) {
+            SeException exception = (SeException) getCause();
+            SeError error = exception.getSeError();
+
+            sLogger.debug("\n ArcSDE Error Number        : " + error.getSdeError());
+            sLogger.debug(" Error Description          : " + error.getErrDesc());
+
+            int extError = error.getExtError();
+            if (extError != 0)
+                sLogger.debug(" Extended Error Number      : " + extError);
+
+            String desc = error.getSdeErrMsg();
+            if (desc != null && desc.length() != 0)
+                sLogger.debug(" Extended Error Description : " + desc);
+
+            desc = error.getExtErrMsg();
+            if (desc != null && desc.length() != 0)
+                sLogger.debug(" Extended Error Description : " + desc);
+
+            sLogger.debug(exception);
+
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/DefaultQueryExceutor.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,106 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base.query;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Collection;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool;
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory;
+import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
+import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory;
+import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+
+/**
+ * This is an Standard Implementation of the Interface QueryExecutor.
+ * It fetchs the Query from the Querycontainer an put the Filtervalues into the Query.
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class DefaultQueryExceutor extends QueryExecutorBase{
+    
+    
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(DefaultQueryExceutor.class);
+    
+    /**
+     * The ConnectionID identifing the Connection to use executing the Query.
+     */
+    private String connectionID = "N/N";
+    
+    /**
+     * Constructor
+     */
+    public DefaultQueryExceutor() {
+        super();
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.query.QueryExecutor#executeQuery(java.lang.String, java.lang.String[])
+     */
+    public Collection<Result> executeQuery(String queryID, String[] filter) throws QueryException {
+        Collection<Result> returnValue = null;
+        try {
+            String queryString = QueryContainerFactory.getInstance().getQueryContainer().getQuery(queryID);
+            if (queryString != null){
+                if (filter != null && filter.length > 0){
+                  //Insert the Filtervalues into the QueryString
+                    queryString = super.setFilterValues(queryString, filter);
+                }
+                
+                log.debug("############   QUERY ##################");
+                log.debug(queryString);
+                log.debug("#######################################");
+                Connection connection = null;
+                ConnectionPool connectionPool = ConnectionPoolFactory.getInstance().getConnectionPool();
+                try {
+                    // Submit the Query
+                    connection = connectionPool.getConnection(this.connectionID);
+                    if (connection != null){
+                        Statement stmt = connection.createStatement();
+                        ResultSet rs = stmt.executeQuery(queryString);
+                        returnValue = super.createResultCollection(rs);
+                        
+                    }else{
+                        log.error("Could not establish Databaseconnection.");
+                        throw new QueryException("Could not establish Databaseconnection.");
+                    }
+                    
+                } catch (ConnectionException e) {
+                    log.error(e,e);
+                    throw new QueryException("Could not establish Databaseconnection.",e);
+                } catch (SQLException e) {
+                    log.error(e,e);
+                    throw new QueryException(e);
+                }finally{
+                    if (connection != null){
+                        try {
+                            connectionPool.closeConnection(connection);
+                        } catch (ConnectionException e) {
+                            log.error("Connection could not be returned to ConnectionPool.");
+                            log.error(e,e);
+                        }
+                    }
+                }
+            }else{
+                log.error("No QueryString defined for "+queryID);
+                throw new QueryException("Cannot get the Querystring");
+            }
+        
+        } catch (QueryContainerException e) {
+            log.error(e,e);
+            throw new QueryException("Cannot get the Querystring",e);
+        }
+        return returnValue;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutor.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,29 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base.query;
+
+import java.util.Collection;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+
+/**
+ * This Interface provides the Method to execute Queries
+ * against a Datastore eg. Databases
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public interface QueryExecutor {
+
+
+    /**
+     * This Method executes the Query an returns the Result
+     * in an Collection.
+     * @param queryID the ID of the Query which should be used.
+     * @param filter the Filterarguments to limit the Data
+     * @return the fetched Values
+     * @throws QueryException
+     */
+    public Collection<Result> executeQuery(String queryID, String[] filter) throws QueryException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorBase.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,97 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base.query;
+
+import java.sql.ResultSet;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import de.intevation.gnv.geobackend.base.DefaultResult;
+import de.intevation.gnv.geobackend.base.DefaultResultDescriptor;
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+
+/**
+ * This is an abstract Basicimplementation of the Interface
+ * QueryExecutor providing several Helpermethods.
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public abstract class QueryExecutorBase implements QueryExecutor {
+
+    /**
+     * Constructor
+     */
+    public QueryExecutorBase() {
+        super();
+    }
+    
+    /**
+     * This Method puts the Filtervalues into the Querystring
+     * @param queryString the Query which should be manipulated
+     * @param filter the values which should be put into the Query
+     * @return the manipulated Query
+     */
+    protected String setFilterValues(String queryString, String[] filter){
+        String returnValue = queryString;
+        for (int i = 0; i < filter.length; i++){
+            returnValue = returnValue.replaceFirst("[?]", filter[i]);
+        }
+        return returnValue;
+    }
+    
+    /**
+     * This Methods converts the ResultSet into an Collection of Result-objects
+     * @param resultSet the ResultSet which should be converted
+     * @return an Collection containing Result-Objects
+     * @throws SQLException
+     */
+    protected Collection<Result> createResultCollection(ResultSet resultSet) throws SQLException{
+        Collection<Result> returnValue =  new ArrayList<Result>();
+        
+        ResultDescriptor resultDescriptor = null;
+        int columns = -1;
+        List<String> columnNames = null;
+        while (resultSet.next()){
+            if (resultDescriptor == null){
+                resultDescriptor = new DefaultResultDescriptor();
+                ResultSetMetaData rsmd = resultSet.getMetaData();
+                columns = rsmd.getColumnCount();
+                columnNames = new ArrayList<String>(columns);
+                for (int i = 1; i <= columns; i++){
+                    resultDescriptor.addColumn(rsmd.getColumnName(i), rsmd.getColumnClassName(i));
+                    columnNames.add(rsmd.getColumnName(i));
+                }
+            }
+            
+            Result result = convertResult(resultSet, resultDescriptor,columnNames);
+            
+            returnValue.add(result);
+        }
+        return returnValue;
+    }
+
+    /**
+     * This Method converts one Singel ResultSetEntry into an Result-Object
+     * @param resultSet the ResultSet where the Entry should be took from.
+     * @param resultDescriptor the ResultsetDescriptor which describes the Entry
+     * @param columnNames the Name of the Columns which Values should be fetched.
+     * @return an new Result-Objects containing the Values of the ResultSet-Entry
+     * @throws SQLException
+     */
+    private Result convertResult(ResultSet resultSet,
+            ResultDescriptor resultDescriptor, List<String> columnNames)
+            throws SQLException {
+        Result result = new DefaultResult(resultDescriptor);
+        for (int i = 0; i < columnNames.size(); i++){
+            String columnName = columnNames.get(i);
+            result.addColumnValue(columnName, resultSet.getObject(columnName));
+        }
+        return result;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/QueryExecutorFactory.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,51 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base.query;
+
+import org.apache.log4j.Logger;
+
+/**
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class QueryExecutorFactory {
+    
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(QueryExecutorFactory.class);
+
+    
+    /**
+     * The singleton Instance of this Factory.
+     */
+    private static QueryExecutorFactory instance = null;
+
+    /**
+     * Basic-Constructor of this Class
+     */
+    private QueryExecutorFactory() {
+        super();
+    }
+
+    /**
+     * This Method provides an singleton Instance of this Class.
+     * @return an singleton Instance of this Class
+     */
+    public static QueryExecutorFactory getInstance(){
+        if (instance == null){
+            instance = new QueryExecutorFactory();
+        }
+        return instance;
+    }
+    
+    
+    /**
+     * Getting the QueryExecutor
+     * @return the QueryExecutor
+     */
+    public QueryExecutor getQueryExecutor(){
+        return new DefaultQueryExceutor();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/DefaultQueryContainer.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,63 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base.query.container;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Properties;
+
+import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
+
+/**
+ * Defaultimplementation of an QueryContainer.
+ * All Queries are provided using a Propertiescontainer.
+ * @author Tim Englich <tim.englich@intevation.de>
+ */
+public class DefaultQueryContainer implements QueryContainer {
+
+    /**
+     * The Properties-Object all Queries are provided in.
+     */
+    private Properties queries = null;
+
+    /**
+     * Constructor
+     */
+    public DefaultQueryContainer() {
+        super();
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.query.container.QueryContainer#gerQueryIDs()
+     */
+    public Collection<String> gerQueryIDs() throws QueryContainerException {
+        //TODO: Typsicherheit herstellen.
+        Collection returnValue = null;
+        if (this.queries != null){
+           returnValue = this.queries.keySet();
+        }else{
+            returnValue = new ArrayList<String>(0);
+        }
+        return returnValue;
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.query.container.QueryContainer#getQuery(java.lang.String)
+     */
+    public String getQuery(String queryID) throws QueryContainerException {
+        String returnValue = null;
+        if (this.queries != null){
+            returnValue = this.queries.getProperty(queryID);
+        }
+        return returnValue;
+    }
+
+    /**
+     * @see de.intevation.gnv.geobackend.base.query.container.QueryContainer#initialize(java.util.Properties)
+     */
+    public void initialize(Properties properties) throws QueryContainerException {
+        this.queries = properties;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainer.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,39 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base.query.container;
+
+import java.util.Collection;
+import java.util.Properties;
+
+import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
+
+/**
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public interface QueryContainer {
+    
+
+    /**
+     * Returns the Query specified by the given queryID.
+     * @param queryID the ID which speciogies the Query which should be returned
+     * @return the Query
+     * @throws QueryContainerException
+     */
+    public String getQuery(String queryID) throws QueryContainerException;
+
+    /**
+     * Returns all QueryIDs provided by the Querycontainer
+     * @return ll QueryIDs provided by the Querycontainer
+     * @throws QueryContainerException
+     */
+    public Collection<String> gerQueryIDs() throws QueryContainerException;;
+
+    /**
+     * Initializes the QueryContainer
+     * @param properties The Properties which should be used for initializing QueryContainer
+     * @throws QueryContainerException
+     */
+    public void initialize(Properties properties) throws QueryContainerException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/QueryContainerFactory.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,84 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base.query.container;
+
+import java.util.Properties;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.gnv.geobackend.base.query.container.exception.QueryContainerException;
+
+/**
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class QueryContainerFactory {
+    
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(QueryContainerFactory.class);
+
+    
+    /**
+     * The singleton Instance of this Factory.
+     */
+    private static QueryContainerFactory instance = null;
+
+    /**
+     * The ConnectionPool providing the Connections to the DatabaseBackends
+     */
+    private QueryContainer queryContainer = null;
+
+    /**
+     * Basic-Constructor of this Class
+     */
+    private QueryContainerFactory() {
+        super();
+    }
+
+    /**
+     * This Method provides an singleton Instance of this Class.
+     * @return an singleton Instance of this Class
+     */
+    public static QueryContainerFactory getInstance(){
+        if (instance == null){
+            instance = new QueryContainerFactory();
+        }
+        return instance;
+    }
+    
+    
+    /**
+     * Getting the QueryContainer
+     * @return the QueryContainer
+     */
+    public QueryContainer getQueryContainer(){
+        return this.queryContainer;
+    }
+
+    /**
+     * Initializes the QueryContainer.
+     * Should only be called once on system startup
+     * @param properties the Properties for the Individual Configuration of the QueryContainerbb
+     * @throws QueryContainerException 
+     */
+    public synchronized void initializeQueryContainer(Properties properties) throws QueryContainerException{
+        log.debug("ConnectionPoolFactory.initializeConnectionPool");
+        if (this.queryContainer == null){
+            this.queryContainer = new DefaultQueryContainer();
+            this.queryContainer.initialize(properties);
+        }else{
+            log.warn("ConnectionPool already initialized");
+        }
+    }
+
+    /**
+     * Checks if the QueryContainer has already been initialized.
+     * @return true if the QueryContainer is initialized.
+     */
+    public boolean isInitialized(){
+        return this.queryContainer != null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/container/exception/QueryContainerException.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,49 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base.query.container.exception;
+/**
+ * Exceptioncalls which will be used to retun Exception in
+ * the QuerContainer-Package.
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class QueryContainerException extends Exception {
+
+    /**
+     * The UID auf this Class
+     */
+    private static final long serialVersionUID = -1811252311941938708L;
+
+    /**
+     * Constructor
+     */
+    public QueryContainerException() {
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     */
+    public QueryContainerException(String arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     */
+    public QueryContainerException(Throwable arg0) {
+        super(arg0);
+    }
+
+    /**
+     * Constructor
+     * @param arg0
+     * @param arg1
+     */
+    public QueryContainerException(String arg0, Throwable arg1) {
+        super(arg0, arg1);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/base/query/exception/QueryException.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,47 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base.query.exception;
+/**
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class QueryException extends Exception {
+
+    /**
+     * The UID for this Class
+     */
+    private static final long serialVersionUID = -1337567603858112424L;
+
+    /**
+     * Constructor
+     */
+    public QueryException() {
+    }
+
+    /**
+     * Constructor
+     * @param message
+     */
+    public QueryException(String message) {
+        super(message);
+    }
+
+    /**
+     * Constructor
+     * @param cause
+     */
+    public QueryException(Throwable cause) {
+        super(cause);
+    }
+
+    /**
+     * Constructor
+     * @param message
+     * @param cause
+     */
+    public QueryException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEConnectionPool.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,81 @@
+package de.intevation.gnv.geobackend.sde.connectionpool;
+
+import java.sql.Connection;
+import java.util.Properties;
+
+import org.apache.commons.pool.PoolableObjectFactory;
+import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.log4j.Logger;
+
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool;
+import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
+
+/**
+ *This is the ArcSDE specific implementation of the Interface ConnectionPool
+ * @author Tim Englich <tim.englich@intevation.de>
+ */
+public class ArcSDEConnectionPool implements ConnectionPool {
+
+	/**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(ArcSDEPoolableObjectFactory.class);
+    
+	/**
+	 * The Pool which stores the Connections to the ArcSDE Backend
+	 */
+	private GenericObjectPool pool = null;
+	
+	/**
+	 * @see de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool#closeConnection(java.lang.Object)
+	 */
+	public void closeConnection(Connection connection) throws ConnectionException {
+		
+		try {
+			//TODO: Muss Connection geschlossen werden?
+			this.pool.returnObject(connection);
+		} catch (Exception e) {
+			log.error(e,e);
+			throw new ConnectionException(e);
+		}
+
+	}
+
+	/**
+	 * @see de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool#getConnection(java.lang.String)
+	 */
+	public synchronized Connection getConnection(String connectionID) throws ConnectionException{
+		try {
+			Object object = this.pool.borrowObject();
+			
+			if (object instanceof Connection){
+				return (Connection)object;
+			}else{
+				throw new ConnectionException("Created Object is not an java.sql.Connection");
+			}
+			
+		} catch (Exception e) {
+			log.error(e,e);
+			throw new ConnectionException(e);
+		}
+	}
+	
+	/**
+	 * @see de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool#initialize(java.util.Properties)
+	 */
+	public void initialize(Properties properties) {
+		log.info("ArcSDEConnectionPool.initialize has been called");
+		log.info("ConnectionPool will be initialized");
+		
+		PoolableObjectFactory poolableObjectFactory = new ArcSDEPoolableObjectFactory(properties);
+		
+		int maxActive = Integer.parseInt(properties.getProperty("maxActive", "10"));
+		
+	    log.info("Maximum Number of active Connections: "+maxActive);
+		// TODO weitere Werte einparsen und setzen.
+		
+		this.pool = new GenericObjectPool(poolableObjectFactory,maxActive);
+		
+	}
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/connectionpool/ArcSDEPoolableObjectFactory.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,120 @@
+/**
+ * 
+ */
+package de.intevation.gnv.geobackend.sde.connectionpool;
+
+import java.sql.Connection;
+import java.util.Properties;
+
+import org.apache.commons.pool.PoolableObjectFactory;
+import org.apache.log4j.Logger;
+
+import com.esri.sde.sdk.client.SeConnection;
+
+import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
+import de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnection;
+
+/**
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class ArcSDEPoolableObjectFactory implements PoolableObjectFactory {
+
+	/**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(ArcSDEPoolableObjectFactory.class);
+	
+	/**
+	 * The URL to the ArcSDE Server
+	 */
+	private String server = null;
+	/**
+	 * The Port the ArcSDE Server is connected to.
+	 */
+	private String port = null;
+	/**
+	 * The Name of the Database
+	 */
+	private String database = null;
+	/**
+	 * The Username for the Authentication
+	 */
+	private String username = null;
+	/**
+	 * The Credentials which belongs to the User
+	 */
+	private String credentials = null;
+      
+    
+	/**
+	 * Constructor of this Class
+	 * @param properties the Properties which includes the ConnectionParams to the Database
+	 */
+	public ArcSDEPoolableObjectFactory(Properties properties) {
+		
+		this.server = properties.getProperty("server");
+		this.port = properties.getProperty("port");
+		this.database = properties.getProperty("database");
+		this.username = properties.getProperty("username");
+		this.credentials = properties.getProperty("credentials");
+		
+		log.info("ArcSDEPoolableObjectFactory initialized");
+		log.info("Server: "+this.server);
+		log.info("Port: "+this.port);
+		log.info("Database: "+this.database);
+		log.info("User: "+this.username);
+	}
+
+	/**
+	 * @see org.apache.commons.pool.PoolableObjectFactory#activateObject(java.lang.Object)
+	 */
+	public void activateObject(Object arg0) throws Exception {
+		log.debug("ArcSDEPoolableObjectFactory.activateObject");
+		// TODO Was muss hier passieren?
+	}
+
+	/**
+	 * @see org.apache.commons.pool.PoolableObjectFactory#destroyObject(java.lang.Object)
+	 */
+	public void destroyObject(Object arg0) throws Exception {
+		log.debug("ArcSDEPoolableObjectFactory.destroyObjectb");
+		if (arg0 instanceof SeConnection){
+			((SeConnection)arg0).close();
+		}else{
+			log.warn("Object cannot be handled");
+		}
+	}
+
+	/**
+	 * @see org.apache.commons.pool.PoolableObjectFactory#makeObject()
+	 */
+	public Object makeObject() throws Exception {
+		log.debug("ArcSDEPoolableObjectFactory.makeObject");
+		Connection con;
+		try {
+            con = new ArcSDEConnection(this.server, this.port, this.database, this.username, this.credentials);
+        }
+        catch (ConnectionException e) {
+            throw new ConnectionException("Establishing a connection to database failed: " + e.toString(), e);
+        }
+        return con;
+	}
+
+	/**
+	 * @see org.apache.commons.pool.PoolableObjectFactory#passivateObject(java.lang.Object)
+	 */
+	public void passivateObject(Object arg0) throws Exception {
+		log.debug("ArcSDEPoolableObjectFactory.passivateObject");
+		// TODO Was muss hier passieren?
+	}
+
+	/**
+	 * @see org.apache.commons.pool.PoolableObjectFactory#validateObject(java.lang.Object)
+	 */
+	public boolean validateObject(Object arg0) {
+		// TODO Was muss hier passieren?
+		log.debug("ArcSDEPoolableObjectFactory.validateObject");
+		return true;
+	}
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,352 @@
+/**
+		*
+		*/
+		package de.intevation.gnv.geobackend.sde.datasources;
+
+import java.sql.CallableStatement;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Savepoint;
+import java.sql.Statement;
+import java.util.Map;
+
+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;
+	
+
+
+	/**
+	 * Constructor
+	 */
+	public ArcSDEConnection(String server,String port,String database,String username,String credentials) throws ConnectionException {
+		try {
+	        seConnection = new SeConnection(server,port,database,username,credentials);
+        } 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 {
+		// TODO: Übergabeparameter beachten
+		return new ArcSDEStatement(this);
+	}
+
+	/**
+	 * @see java.sql.Connection#createStatement(int, int, int)
+	 */
+	public Statement createStatement(int resultSetType,
+	        int resultSetConcurrency, int resultSetHoldability)
+	        throws SQLException {
+		// TODO: Übergabeparameter beachtenbb
+		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;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionParams.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,92 @@
+/**
+ * Title:           ArcSDEConnectionParams, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEConnectionParams.java,v 1.1 2007/11/22 07:40:11 blume Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEConnectionParams.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     22.11.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: blume $
+ * modified on:     $Date: 2007/11/22 07:40:11 $
+ * Version:         $Revision: 1.1 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The class <code>ArcSDEConnectionParams</code> fulfills the following purposes:
+ * <ol>
+ * <li></li>
+ * </ol>
+ *
+ * @author blume
+ * @version 1.0
+ * @serial 1.0
+ * @see
+ * @since 22.11.2007 08:10:11
+ */
+public class ArcSDEConnectionParams {
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(ArcSDEConnectionParams.class);
+    private static boolean sDebug = sLogger.isDebugEnabled();
+
+    private String mServer;
+    private int mInstance;
+    private String mDatabase;
+    private String mUser;
+    private String mPwd;
+    private int mInitConnections;
+    private int mMaxConnections;
+    private long mTimeToHold;
+
+    public ArcSDEConnectionParams(String pServer, int pInstance, String pDatabase, String pUser, String pPwd, int pInitConnections, int pMaxConnections, long pTimeToHold) {
+        mServer = pServer;
+        mInstance = pInstance;
+        mDatabase = pDatabase;
+        mUser = pUser;
+        mPwd = pPwd;
+        mMaxConnections = pMaxConnections;
+        mInitConnections = pInitConnections;
+        mTimeToHold = pTimeToHold;
+    }
+
+
+    public String getServer() {
+        return mServer;
+    }
+
+    public int getInstance() {
+        return mInstance;
+    }
+
+    public String getDatabase() {
+        return mDatabase;
+    }
+
+    public String getUser() {
+        return mUser;
+    }
+
+    public String getPwd() {
+        return mPwd;
+    }
+
+    public int getInitConnections() {
+        return mInitConnections;
+    }
+
+    public int getMaxConnections() {
+        return mMaxConnections;
+    }
+
+    public long getTimeToHold() {
+        return mTimeToHold;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEResultSetMetaData.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,194 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.util.List;
+
+/**
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class ArcSDEResultSetMetaData implements ResultSetMetaData {
+
+    private List<ColDefinition> columnDefinitions = null;
+    /**
+     * Constructor
+     */
+    public ArcSDEResultSetMetaData(List<ColDefinition> columnDefinitions) {
+        this.columnDefinitions = columnDefinitions;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#getCatalogName(int)
+     */
+    public String getCatalogName(int column) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#getColumnClassName(int)
+     */
+    public String getColumnClassName(int column) throws SQLException {
+        
+        int type = this.getColumnType(column);
+        Class clazz = java.lang.Object.class;
+        if (type == 2){
+            clazz = int.class;
+        }
+        // TODO weitere Klassen Implementieren
+        return  clazz.getName();
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#getColumnCount()
+     */
+    public int getColumnCount() throws SQLException {
+        return columnDefinitions.size();
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#getColumnDisplaySize(int)
+     */
+    public int getColumnDisplaySize(int column) throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#getColumnLabel(int)
+     */
+    public String getColumnLabel(int column) throws SQLException {
+        return columnDefinitions.get(column-1).getName();
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#getColumnName(int)
+     */
+    public String getColumnName(int column) throws SQLException {
+        return columnDefinitions.get(column-1).getName();
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#getColumnType(int)
+     */
+    public int getColumnType(int column) throws SQLException {
+        return  columnDefinitions.get(column-1).getType();
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#getColumnTypeName(int)
+     */
+    public String getColumnTypeName(int column) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#getPrecision(int)
+     */
+    public int getPrecision(int column) throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#getScale(int)
+     */
+    public int getScale(int column) throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#getSchemaName(int)
+     */
+    public String getSchemaName(int column) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#getTableName(int)
+     */
+    public String getTableName(int column) throws SQLException {
+
+        return null;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#isAutoIncrement(int)
+     */
+    public boolean isAutoIncrement(int column) throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#isCaseSensitive(int)
+     */
+    public boolean isCaseSensitive(int column) throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#isCurrency(int)
+     */
+    public boolean isCurrency(int column) throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#isDefinitelyWritable(int)
+     */
+    public boolean isDefinitelyWritable(int column) throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#isNullable(int)
+     */
+    public int isNullable(int column) throws SQLException {
+
+        return 0;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#isReadOnly(int)
+     */
+    public boolean isReadOnly(int column) throws SQLException {
+
+        return true;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#isSearchable(int)
+     */
+    public boolean isSearchable(int column) throws SQLException {
+
+        return true;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#isSigned(int)
+     */
+    public boolean isSigned(int column) throws SQLException {
+
+        return false;
+    }
+
+    /**
+     * @see java.sql.ResultSetMetaData#isWritable(int)
+     */
+    public boolean isWritable(int column) throws SQLException {
+
+        return false;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEStatement.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,350 @@
+/**
+		*
+		*/
+		package de.intevation.gnv.geobackend.sde.datasources;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+
+import org.apache.log4j.Logger;
+
+import com.esri.sde.sdk.client.SeColumnDefinition;
+import com.esri.sde.sdk.client.SeException;
+import com.esri.sde.sdk.client.SeQuery;
+import com.esri.sde.sdk.client.SeRow;
+
+		/**
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class ArcSDEStatement implements Statement {
+
+	/**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = Logger.getLogger(ArcSDEStatement.class);
+    
+	private ArcSDEConnection connection = null;
+	
+	/**
+	 * Constructor
+	 */
+	public ArcSDEStatement(ArcSDEConnection connection) {
+		this.connection = connection;
+	}
+
+	/**
+	 * @see java.sql.Statement#addBatch(java.lang.String)
+	 */
+	public void addBatch(String arg0) throws SQLException {
+	}
+
+	/**
+	 * @see java.sql.Statement#cancel()
+	 */
+	public void cancel() throws SQLException {
+	}
+
+	/**
+	 * @see java.sql.Statement#clearBatch()
+	 */
+	public void clearBatch() throws SQLException {
+	}
+
+	/**
+	 * @see java.sql.Statement#clearWarnings()
+	 */
+	public void clearWarnings() throws SQLException {
+	}
+
+	/**
+	 * @see java.sql.Statement#close()
+	 */
+	public void close() throws SQLException {
+	}
+
+	/**
+	 * @see java.sql.Statement#execute(java.lang.String)
+	 */
+	public boolean execute(String arg0) throws SQLException {
+
+		return false;
+	}
+
+	/**
+	 * @see java.sql.Statement#execute(java.lang.String, int)
+	 */
+	public boolean execute(String arg0, int arg1) throws SQLException {
+
+		return false;
+	}
+
+	/**
+	 * @see java.sql.Statement#execute(java.lang.String, int[])
+	 */
+	public boolean execute(String arg0, int[] arg1) throws SQLException {
+
+		return false;
+	}
+
+	/**
+	 * @see java.sql.Statement#execute(java.lang.String, java.lang.String[])
+	 */
+	public boolean execute(String arg0, String[] arg1) throws SQLException {
+
+		return false;
+	}
+
+	/**
+	 * @see java.sql.Statement#executeBatch()
+	 */
+	public int[] executeBatch() throws SQLException {
+
+		return null;
+	}
+
+	/**
+	 * @see java.sql.Statement#executeQuery(java.lang.String)
+	 */
+	public ResultSet executeQuery(String statement) throws SQLException {
+		try {
+	        SeQuery query = new SeQuery(this.connection.getSeConnection());
+	        query.prepareSql(statement);
+	        query.execute();
+	        return this.handleResultSet(query);
+		} catch (SeException e) {
+	        log.error(e,e);
+	        throw new SQLException(e.getMessage());
+        }
+        
+        
+	}
+
+	/**
+	 * @see java.sql.Statement#executeUpdate(java.lang.String)
+	 */
+	public int executeUpdate(String arg0) throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#executeUpdate(java.lang.String, int)
+	 */
+	public int executeUpdate(String arg0, int arg1) throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#executeUpdate(java.lang.String, int[])
+	 */
+	public int executeUpdate(String arg0, int[] arg1) throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#executeUpdate(java.lang.String, java.lang.String[])
+	 */
+	public int executeUpdate(String arg0, String[] arg1) throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#getConnection()
+	 */
+	public Connection getConnection() throws SQLException {
+		return this.connection;
+	}
+
+	/**
+	 * @see java.sql.Statement#getFetchDirection()
+	 */
+	public int getFetchDirection() throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#getFetchSize()
+	 */
+	public int getFetchSize() throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#getGeneratedKeys()
+	 */
+	public ResultSet getGeneratedKeys() throws SQLException {
+
+		return null;
+	}
+
+	/**
+	 * @see java.sql.Statement#getMaxFieldSize()
+	 */
+	public int getMaxFieldSize() throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#getMaxRows()
+	 */
+	public int getMaxRows() throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#getMoreResults()
+	 */
+	public boolean getMoreResults() throws SQLException {
+
+		return false;
+	}
+
+	/**
+	 * @see java.sql.Statement#getMoreResults(int)
+	 */
+	public boolean getMoreResults(int arg0) throws SQLException {
+
+		return false;
+	}
+
+	/**
+	 * @see java.sql.Statement#getQueryTimeout()
+	 */
+	public int getQueryTimeout() throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#getResultSet()
+	 */
+	public ResultSet getResultSet() throws SQLException {
+
+		return null;
+	}
+
+	/**
+	 * @see java.sql.Statement#getResultSetConcurrency()
+	 */
+	public int getResultSetConcurrency() throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#getResultSetHoldability()
+	 */
+	public int getResultSetHoldability() throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#getResultSetType()
+	 */
+	public int getResultSetType() throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#getUpdateCount()
+	 */
+	public int getUpdateCount() throws SQLException {
+
+		return 0;
+	}
+
+	/**
+	 * @see java.sql.Statement#getWarnings()
+	 */
+	public SQLWarning getWarnings() throws SQLException {
+
+		return null;
+	}
+
+	/**
+	 * @see java.sql.Statement#setCursorName(java.lang.String)
+	 */
+	public void setCursorName(String arg0) throws SQLException {
+	}
+
+	/**
+	 * @see java.sql.Statement#setEscapeProcessing(boolean)
+	 */
+	public void setEscapeProcessing(boolean arg0) throws SQLException {
+	}
+
+	/**
+	 * @see java.sql.Statement#setFetchDirection(int)
+	 */
+	public void setFetchDirection(int arg0) throws SQLException {
+	}
+
+	/**
+	 * @see java.sql.Statement#setFetchSize(int)
+	 */
+	public void setFetchSize(int arg0) throws SQLException {
+	}
+
+	/**
+	 * @see java.sql.Statement#setMaxFieldSize(int)
+	 */
+	public void setMaxFieldSize(int arg0) throws SQLException {
+	}
+
+	/**
+	 * @see java.sql.Statement#setMaxRows(int)
+	 */
+	public void setMaxRows(int arg0) throws SQLException {
+	}
+
+	/**
+	 * @see java.sql.Statement#setQueryTimeout(int)
+	 */
+	public void setQueryTimeout(int arg0) throws SQLException {
+	}
+	
+	/**
+	 * Copied from de.intevation.gnv.geobackend.sde.datasources.SDEQuery
+	 *  @param pSeQuery
+	 *  @return
+	 * @throws SeException
+	 */
+    private ResultSet handleResultSet(SeQuery pSeQuery) throws SeException {
+        log.debug("ArcSDEStatement,handleResultSet()");
+        SDEResultSet lSet = new SDEResultSet();
+        SeRow row;
+        int lCount;
+        for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) {
+            // one time execution
+            if (lCount == 0) {
+                // analyze cols of result set
+                SeColumnDefinition[] lCols = row.getColumns();
+                for (SeColumnDefinition lCol : lCols) {
+                    lSet.addCol(new ColDefinition(lCol.getName(), lCol.getType()));// notice: esri-types have been copied into colDefinition class!
+                }
+            }
+            short lNumCols = row.getNumColumns();
+            Row lBackingRow = new Row(lNumCols);
+            for (int i = 0; i < lNumCols; i++) {
+                lBackingRow.addObject(row.getObject(i), i);
+            }
+            lSet.addRow(lBackingRow);
+        }
+        pSeQuery.close();
+        return lSet;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEUtils.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,210 @@
+/**
+ * Title:           ArcSDEUtils, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEUtils.java,v 1.7 2007/11/28 14:05:39 blume Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/ArcSDEUtils.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     21.11.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: blume $
+ * modified on:     $Date: 2007/11/28 14:05:39 $
+ * Version:         $Revision: 1.7 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import java.util.Vector;
+
+import org.apache.log4j.Logger;
+
+import com.esri.sde.sdk.client.SDEPoint;
+import com.esri.sde.sdk.client.SeColumnDefinition;
+import com.esri.sde.sdk.client.SeConnection;
+import com.esri.sde.sdk.client.SeError;
+import com.esri.sde.sdk.client.SeException;
+import com.esri.sde.sdk.client.SeQuery;
+import com.esri.sde.sdk.client.SeQueryInfo;
+import com.esri.sde.sdk.client.SeSqlConstruct;
+import com.esri.sde.sdk.client.SeTable;
+
+import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
+import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;
+
+/**
+ * The class <code>ArcSDEUtils</code> fulfills the following purposes:
+ * <ol>
+ * <li></li>
+ * </ol>
+ *
+ * @author blume
+ * @version 1.0
+ * @serial 1.0
+ * @see
+ * @since 21.11.2007 08:20:40
+ */
+public class ArcSDEUtils {
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(ArcSDEUtils.class);
+
+
+    /**
+     * @param pTable e.g. "BSH.ARCMARINE_TIMESERIES_VIEW"
+     * @param pWhere where-Clause (can be empty, null-case not tested)
+     */
+    public void getTableStats(String pTable, String pWhere) {
+        sLogger.debug("getTableStats()");
+        SeConnection conn = null;
+        SeTable.SeTableStats tableStats;
+        try {
+            conn = getConnection();
+            SeTable table = new SeTable(conn, pTable);
+
+            SeSqlConstruct sqlCons = new SeSqlConstruct(table.getQualifiedName());
+            sqlCons.setWhere(pWhere);
+            SeQuery query = new SeQuery(conn);
+            SeQueryInfo queryInfo = new SeQueryInfo();
+            queryInfo.setConstruct(sqlCons);
+            int mask = SeTable.SeTableStats.SE_ALL_STATS;
+            int maxDistinct = 0;
+
+            SeColumnDefinition[] colDefs = table.describe();
+
+            for (SeColumnDefinition lColDef : colDefs) {
+                sLogger.debug(lColDef.getName() + " - " + ArcSDEUtils.resolveType(lColDef.getType()));
+            }
+
+
+            tableStats = query.calculateTableStatistics(colDefs[1].getName(), mask, queryInfo, maxDistinct);
+            displayStats(tableStats);
+
+
+        } catch (SeException e) {
+            printError(e);
+        } catch (ConnectionException e) {
+            sLogger.error(e.getMessage(), e);
+            e.printError();
+        } catch (TechnicalException e) {
+            sLogger.error(e.getMessage(), e);
+        } finally {
+            // return connection
+            returnConnection(conn);
+        }
+
+    }// End method getTableStats
+
+
+    public void displayStats(SeTable.SeTableStats tableStats) {
+
+        sLogger.debug("\n--> Table Statistics\n");
+        if (tableStats != null) {
+
+            sLogger.debug("Average - " + tableStats.getAverage());
+            sLogger.debug("No of rows - " + tableStats.getCount());
+            sLogger.debug("Maximum Value - " + tableStats.getMax());
+            sLogger.debug("Minimum Value - " + tableStats.getMin());
+            sLogger.debug("No of distinct values - " + tableStats.getNumDistinct());
+            sLogger.debug("Standard Deviation - " + tableStats.getStdDev());
+
+            sLogger.debug("Distinct type - " + ArcSDEUtils.resolveType(tableStats.getDistinctType()));
+
+            int[] distinctFreq = tableStats.getDistinctValueFrequencies();
+            Vector distinctValues = tableStats.getDistinctValues();
+            sLogger.debug("Distinct values & their frequencies : ");
+            for (int i = 0; i < distinctFreq.length; i++)
+                sLogger.debug(distinctValues.elementAt(i) + " - " + distinctFreq[i]);
+        }// End if
+
+    }// End displayStats
+
+
+    /**
+     * Takes an integer corresponding to an ArcSDE data type
+     * and returns a string description of the type.
+     *
+     * @param type SDE data type bit-mask.
+     */
+    public static String resolveType(int type) {
+
+        String typeName = "Invalid Type";
+        switch (type) {
+
+            case SeColumnDefinition.TYPE_SMALLINT:
+                typeName = "Small Int";
+                break;
+            case SeColumnDefinition.TYPE_INTEGER:
+                typeName = "Int";
+                break;
+            case SeColumnDefinition.TYPE_FLOAT:
+                typeName = "Float";
+                break;
+            case SeColumnDefinition.TYPE_DOUBLE:
+                typeName = "Double";
+                break;
+            case SeColumnDefinition.TYPE_STRING:
+                typeName = "String";
+                break;
+            case SeColumnDefinition.TYPE_BLOB:
+                typeName = "Blob";
+                break;
+            case SeColumnDefinition.TYPE_DATE:
+                typeName = "Date";
+                break;
+            case SeColumnDefinition.TYPE_SHAPE:
+                typeName = "Shape";
+                break;
+            case SeColumnDefinition.TYPE_RASTER:
+                typeName = "Raster";
+                break;
+        }
+        return typeName;
+    }// End method resolveType
+
+    public static void printError(SeException exception) {
+
+        SeError error = exception.getSeError();
+
+        sLogger.debug("\n ArcSDE Error Number        : " + error.getSdeError());
+        sLogger.debug(" Error Description          : " + error.getErrDesc());
+
+        int extError = error.getExtError();
+        if (extError != 0)
+            sLogger.debug(" Extended Error Number      : " + extError);
+
+        String desc = error.getSdeErrMsg();
+        if (desc != null && desc.length() != 0)
+            sLogger.debug(" Extended Error Description : " + desc);
+
+        desc = error.getExtErrMsg();
+        if (desc != null && desc.length() != 0)
+            sLogger.debug(" Extended Error Description : " + desc);
+
+        sLogger.debug(exception);
+
+    }// End printError
+
+    private SeConnection getConnection() throws TechnicalException {
+        //DatasourceConnection lConnection = ConnectionPoolManager.getInstance().getConnection(ConnectionPoolManager.CON_SDE);
+        //return ((SDEConnection) lConnection).getConnection();
+        return null;
+    }
+
+    private void returnConnection(SeConnection pConnection) {
+        //ConnectionPoolManager.getInstance().returnConnection(pConnection);
+    }
+
+    public static SDEPoint[] createPoints(double[][] pPoints) {
+        sLogger.debug("createPoints()");
+        SDEPoint[] lSDEPoints = new SDEPoint[pPoints.length];
+        for (int i = 0; i < pPoints.length; i++) {
+            double[] lPoint = pPoints[i];
+            lSDEPoints[i] = new SDEPoint(lPoint[0], lPoint[1]);
+        }
+        return lSDEPoints;
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ColDefinition.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,86 @@
+/**
+ * Title:           ColDefinition, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ColDefinition.java,v 1.2 2007/12/21 12:31:15 blume Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ColDefinition.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     21.11.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: blume $
+ * modified on:     $Date: 2007/12/21 12:31:15 $
+ * Version:         $Revision: 1.2 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The class <code>ColDefinition</code> fulfills the following purposes:
+ * <ol>
+ * <li></li>
+ * </ol>
+ *
+ * @author blume
+ * @version 1.0
+ * @serial 1.0
+ * @see
+ * @since 21.11.2007 10:59:45
+ */
+public class ColDefinition {
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(ColDefinition.class);
+
+    /**
+     * @deprecated
+     */
+    public static final int SMALLINT = 1;
+    /**
+     * @deprecated
+     */
+    public static final int INTEGER = 2;
+    /**
+     * @deprecated
+     */
+    public static final int FLOAT = 3;
+    /**
+     * @deprecated
+     */
+    public static final int DOUBLE = 4;
+    public static final int INT16 = 1;
+    public static final int INT32 = 2;
+    public static final int FLOAT32 = 3;
+    public static final int FLOAT64 = 4;
+    public static final int STRING = 5;
+    public static final int BLOB = 6;
+    public static final int DATE = 7;
+    public static final int SHAPE = 8;
+    public static final int RASTER = 9;
+    public static final int XML = 10;
+    public static final int INT64 = 11;
+    public static final int UUID = 12;
+    public static final int CLOB = 13;
+    public static final int NSTRING = 14;
+    public static final int NCLOB = 15;
+
+    private String mName;
+    private int mType;
+
+    public ColDefinition(String pName, int pType) {
+        mName = pName;
+        mType = pType;
+    }
+
+    public String getName() {
+        return mName;
+    }
+
+    public int getType() {
+        return mType;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Datasource.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,92 @@
+/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de)
+ * All rights reserved
+ *
+ * $Id: Datasource.java,v 1.4 2008/01/30 12:38:34 blume Exp $
+ *
+ * created by:      drewnak
+ * created at :     21.11.2007
+ * created at :     14:25:50
+ *
+ * modified by:     $Author: blume $
+ * modified at:     $Date: 2008/01/30 12:38:34 $
+ */
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import java.util.Map;
+
+import de.intevation.gnv.geobackend.sde.datasources.exception.DatasourceException;
+
+/**
+ * Abstract class for handling different datasources.
+ * This method provides a static method for creating dataosurce objects.
+ *
+ * @author drewnak
+ */
+public abstract class Datasource {
+
+    protected Map mParameters;
+
+    protected String mName;
+
+
+    /**
+     * Triggers the creation of a dataosurce object. Following the guidelines, the parameters for creating this datasource are delivered by the configuration file.
+     *
+     * @param pName      a name for the datasource.
+     * @param pClassname The name of the class extending this abstract datasource class. Used to create a new instance.
+     * @param pParams    a Map of Parameters needed for the initialization of the datasource.
+     * @return a datasourceobject
+     * @throws DatasourceException if the class could not be found or the initialization of the datasource fails.
+     */
+    public static final Datasource create(String pName, String pClassname,
+                                          Map pParams) throws DatasourceException {
+        Class lDatasourceClass;
+        try {
+            lDatasourceClass = Class.forName(pClassname);
+        } catch (ClassNotFoundException e) {
+            throw new DatasourceException("Could not load class " + pClassname);
+        }
+        Datasource lNewInstance;
+        try {
+            lNewInstance = (Datasource) lDatasourceClass.newInstance();
+        } catch (Exception e) {
+            throw new DatasourceException("Could not create instance of " + pClassname, e);
+        }
+        lNewInstance.init(pName, pParams);
+
+        return lNewInstance;
+    }
+
+    /**
+     * An abstract method for the initialization of a datasource instance.
+     * Of course, only the concrete implementation knwos about the ncessary parameters for the initialization.
+     *
+     * @param pName   a name for the datasource.
+     * @param pParams a Map of Parameters needed for the initialization of the datasource.
+     */
+    protected abstract void init(String pName, Map pParams) throws DatasourceException;
+
+    /**
+     * @return
+     */
+    public String getName() {
+        return mName;
+    }
+
+
+    /**
+     * This method returns a datasourceconnection.
+     * Only the concrete implementation of the Datasource knwos about the DatasourceConnection-Implementation to return.
+     *
+     * @return a DatasourceConnection
+     */
+    public abstract DatasourceConnection getConnection();
+
+    /**
+     * Returns a DatasourceConnection. This method is usualy called after an executed query.
+     * See: Some datasource implementations need to explicitly close an existing connection.
+     *
+     * @param pConnection the connection to be returned.
+     */
+    public abstract void returnConnection(DatasourceConnection pConnection);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/DatasourceConnection.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,31 @@
+/**
+ * Title:           IDatasourceConnection, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/DatasourceConnection.java,v 1.2 2008/01/30 12:38:34 blume Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/DatasourceConnection.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     21.11.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: blume $
+ * modified on:     $Date: 2008/01/30 12:38:34 $
+ * Version:         $Revision: 1.2 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.geobackend.sde.datasources;
+
+/**
+ * The interface <code>DatasourceConnection</code> fulfills the following purposes:
+ * <ol>
+ * <li>Beeing a marker interface for datasource connections.</li>
+ * </ol>
+ *
+ * @author blume
+ * @version 1.0
+ * @serial 1.0
+ * @see
+ * @since 21.11.2007 08:50:20
+ */
+public interface DatasourceConnection {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ResultSet.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,68 @@
+/**
+ * Title:           ResultSet, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ResultSet.java,v 1.2 2008/01/30 12:38:34 blume Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/ResultSet.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     21.11.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: blume $
+ * modified on:     $Date: 2008/01/30 12:38:34 $
+ * Version:         $Revision: 1.2 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The class <code>ResultSet</code> fulfills the following purposes:
+ * <ol>
+ * <li>Providing an abstract object for dealing with result sets.</li>
+ * </ol>
+ *
+ * @author blume
+ * @version 1.0
+ * @serial 1.0
+ * @see
+ * @since 21.11.2007 09:26:53
+ */
+public abstract class ResultSet implements java.sql.ResultSet {
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(ResultSet.class);
+
+    /**
+     * Returns the number of hits.
+     *
+     * @return count of results.
+     */
+    public abstract int getCount();
+
+    /**
+     * Returns the number of columns returned through the query.
+     *
+     * @return the number of columns.
+     */
+    public abstract int getNumberOfColumns();
+
+    /**
+     * A ResultSet can tell about the concrete definition of each column.
+     * This method returns an array of {@link de.conterra.bsh.gdi.gnviewer.datasources.ColDefinition}-Objects.
+     *
+     * @return the definitions describing the result set.
+     */
+    public abstract ColDefinition[] getColumnDefinitions();
+
+    /**
+     * Returns an array of Rows. The rows contain the "content" of the current ResultSet.
+     *
+     * @return the results itself.
+     */
+    public abstract Row[] getResults();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/Row.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,249 @@
+/**
+ * Title:           Row, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/Row.java,v 1.4 2008/01/30 12:38:34 blume Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/Row.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     21.11.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: blume $
+ * modified on:     $Date: 2008/01/30 12:38:34 $
+ * Version:         $Revision: 1.4 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.log4j.Logger;
+
+import com.esri.sde.sdk.client.SDEPoint;
+import com.esri.sde.sdk.client.SeException;
+import com.esri.sde.sdk.client.SeShape;
+
+import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;
+import de.intevation.gnv.geobackend.util.DateUtils;
+
+/**
+ * A Row represents a set of values.
+ * In a technical manner (e.g. database manner) a row contains all attributes of a single "hit".
+ *
+ * @author blume
+ * @version 1.0
+ * @serial 1.0
+ * @see
+ * @since 21.11.2007 11:00:54
+ */
+public class Row {
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(Row.class);
+    private static boolean sDebug = sLogger.isDebugEnabled();
+
+    /**
+     * Data container.
+     */
+    private Object[] mObjects;
+
+    /**
+     * Constructor.
+     *
+     * @param pRowSize the number of attributes contained by this row.
+     */
+    public Row(int pRowSize) {
+        mObjects = new Object[pRowSize];
+    }
+    
+    /**
+     * Constructor.
+     *
+     * @param ArrayStr a line from CSV-File.
+     */
+    public Row (String[] ArrayStr){
+    	this (ArrayStr.length);
+    	int nLength = ArrayStr.length;
+    	for (int i=0; i < nLength; i++){
+    		//if (sDebug)
+    		//	sLogger.debug(" ArrayStr["+i+" ]=" + ArrayStr[i]);
+    		addObject(ArrayStr[i], i);
+    		
+    	}	
+    	
+    }
+    
+    
+    /**
+     * Adds an attribute value to a specific position of this row.
+     *
+     * @param pObject the object to be stored.
+     * @param pPos    the postion the value to be saved
+     */
+    public void addObject(Object pObject, int pPos) {
+        mObjects[pPos] = pObject;
+    }
+
+    /**
+     * Returns a Value out of the Row.
+     *
+     * @param pPos the position of the value to be returned.
+     * @return an Object! (not strongly typed)
+     * @throws TechnicalException
+     */
+    public Object getValue(int pPos) throws TechnicalException {
+        if (pPos < mObjects.length) {
+            return mObjects[pPos];
+        } else {
+            throw new TechnicalException("Cannot access this field position. Size is: " + mObjects.length);
+        }
+    }
+
+
+    /**
+     * This is a covenient method for getting strongly typed objects out of the row.
+     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
+     * In fact, this method executes a simple cast to the desired type.
+     *
+     * @param pPos the position of the object to be resolved.
+     * @return a strongly typed Date
+     * @throws TechnicalException
+     * @see #getValue(int)
+     */
+    public Date getDateValue(int pPos) throws TechnicalException {
+    	Date date =  null;
+        try {
+            Calendar lCalendar = (Calendar) getValue(pPos);
+            date = lCalendar.getTime();
+        } 
+        catch (ClassCastException e) {
+        	try{
+        		//SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
+        		date = DateUtils.getDateFromString ((String)getValue(pPos)); //(Date)formatter.parse((String)getValue(pPos));
+        	    
+        		
+        	}
+        	catch (Exception ex){
+        		sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex);
+        		throw new TechnicalException("Could not cast this value to the Date Type. Object is of value type: " + getValue(pPos).getClass().getName());
+        	}
+        }	
+      
+        return date;
+    }
+
+    /**
+     * This is a covenient method for getting strongly typed objects out of the row.
+     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
+     * In fact, this method executes a simple cast to the desired type.
+     *
+     * @param pPos the position of the object to be resolved.
+     * @return a strongly typed String
+     * @throws TechnicalException
+     * @see #getValue(int)
+     */
+    public String getStringValue(int pPos) throws TechnicalException {
+        try {
+            return (String) getValue(pPos);
+        } catch (ClassCastException e) {
+            throw new TechnicalException("Could not cast this value to the String Type. Object is of value type: " + getValue(pPos).getClass().getName());
+        }
+    }
+
+    /**
+     * This is a covenient method for getting strongly typed objects out of the row.
+     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
+     * In fact, this method executes a simple cast to the desired type.
+     *
+     * @param pPos the position of the object to be resolved.
+     * @throws TechnicalException
+     * @see #getValue(int)
+     *      * @return a strongly typed int
+     */
+    public int getIntValue(int pPos) throws TechnicalException {
+        try {
+            return (Integer) getValue(pPos);
+        } catch (ClassCastException e) {
+            throw new TechnicalException("Could not cast this value to the Integer Type. Object is of value type: " + getValue(pPos).getClass().getName());
+        }
+    }
+
+    /**
+     * This is a covenient method for getting strongly typed objects out of the row.
+     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
+     * In fact, this method executes a simple cast to the desired type.
+     *
+     * @param pPos the position of the object to be resolved.
+     * @throws TechnicalException
+     * @see #getValue(int)
+     *      * @return a strongly typed Double
+     */
+    public Double getDoubleValue(int pPos) throws TechnicalException {
+        try {
+            return (Double) getValue(pPos);
+        } catch (ClassCastException e) {
+        	try{
+        		return new Double ((String)getValue(pPos));
+        	}
+        	catch(Exception ex){
+        		sLogger.error(getValue(pPos) + " " + ex.getMessage(), ex);
+        		throw new TechnicalException("Could not cast this value to the Double Type. Object is of value type: " + getValue(pPos).getClass().getName());
+        	}
+        }
+    }
+
+    /**
+     * This is a covenient method for getting strongly typed objects out of the row.
+     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
+     * In fact, this method executes a simple cast to the desired type.
+     *
+     * @param pPos the position of the object to be resolved.
+     * @return a strongly typed Float
+     * @throws TechnicalException
+     * @see #getValue(int)
+     */
+    public Float getFloatValue(int pPos) throws TechnicalException {
+        try {
+            return (Float) getValue(pPos);
+        } catch (ClassCastException e) {
+            throw new TechnicalException("Could not cast this value to the Float Type. Object is of value type: " + getValue(pPos).getClass().getName());
+        }
+    }
+    /**
+     * This is a covenient method for getting strongly typed objects out of the row.
+     * It has to be ensured, that the type of the requested row position has been resolved out of the ColumnDefinition ({@link ResultSet#getColumnDefinitions()}).
+     * In fact, this method executes a simple cast to the desired type.
+     *
+     * @param pPos the position of the object to be resolved.
+     * @return a strongly typed Float
+     * @throws TechnicalException
+     * @see #getValue(int)
+     */    
+    public String getPosValue(int pPos)throws TechnicalException{
+    	SeShape val;
+    	ArrayList aList;
+    	SDEPoint mPoint[];
+    	double lat,lon;
+    	try {
+    		val = (SeShape) getValue(pPos);
+    		aList = val.getAllPoints(0,false);
+    		mPoint = (SDEPoint[])aList.get(0);
+    		lat = mPoint[0].getY();
+    		lon = mPoint[0].getX();
+    		String nord="N";
+    		String ost="E";
+    		if (lat <0 ){nord="S"; lat=-lat;}
+    		if (lon <0 ){ost="W"; lon=-lon;}
+    		return String.format("%1$02d°%2$1S %3$05.2f' %4$03d°%5$1S %6$05.2f'",
+    				              (int)lat, nord,60.*(lat-((int)lat)),(int)lon,ost,60.*(lon-((int)lon)));
+    				              
+
+        } catch (SeException e) {
+            throw new TechnicalException("Could not cast this value to the Float Type. Object is of value type: " + getValue(pPos).getClass().getName());   
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEQuery.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,383 @@
+/**
+ * Title:           SdeQuery, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEQuery.java,v 1.3 2008/01/30 12:38:34 blume Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEQuery.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     21.11.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: blume $
+ * modified on:     $Date: 2008/01/30 12:38:34 $
+ * Version:         $Revision: 1.3 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import java.sql.Connection;
+import java.sql.Statement;
+
+import org.apache.log4j.Logger;
+
+import com.esri.sde.sdk.client.SDEPoint;
+import com.esri.sde.sdk.client.SeColumnDefinition;
+import com.esri.sde.sdk.client.SeConnection;
+import com.esri.sde.sdk.client.SeCoordinateReference;
+import com.esri.sde.sdk.client.SeException;
+import com.esri.sde.sdk.client.SeFilter;
+import com.esri.sde.sdk.client.SeLayer;
+import com.esri.sde.sdk.client.SeQuery;
+import com.esri.sde.sdk.client.SeRow;
+import com.esri.sde.sdk.client.SeShape;
+import com.esri.sde.sdk.client.SeShapeFilter;
+import com.esri.sde.sdk.client.SeSqlConstruct;
+
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool;
+import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
+import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;
+
+/**
+ * // todo: supply a general interface for Query-Objects (Query = read access to datasource implementation)
+ *
+ * @author blume
+ * @version 1.0
+ * @serial 1.0
+ * @see
+ * @since 21.11.2007 11:32:19
+ */
+public class SDEQuery {
+
+    /**
+     * Default Logging instance
+     */
+    private static final Logger sLogger = Logger.getLogger(SDEQuery.class);
+    private static boolean sDebug = sLogger.isDebugEnabled();
+
+
+    private ConnectionPool connectionPool = null;
+    private String connectionID = "N/N";
+
+    public SDEQuery(ConnectionPool connectionPool) {
+        if (sDebug) sLogger.debug("SDEQuery()");
+        this.connectionPool = connectionPool;
+    }
+
+    /**
+     * Execute a query against a sde datasource.
+     * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object.
+     *
+     * @param pTables
+     * @param pCols
+     * @param pWhere  the where-clause to be executed.
+     * @return a ResultSet
+     * @see SeSqlConstruct
+     * @see SeQuery
+     */
+    public ResultSet executeQuery(String pTables[], String pCols[], String pWhere) throws TechnicalException {
+        sLogger.debug("executeQuery()");
+        Connection con = null;
+        try {
+            con = getConnection();
+//            SeSqlConstruct lSeSqlConstruct = new SeSqlConstruct(pTables, pWhere);
+//            SeQuery lSeQuery = new SeQuery(con, pCols, lSeSqlConstruct);
+//            long lStart = System.currentTimeMillis();
+//            lSeQuery.prepareQuery();
+            ResultSet lSet = null;//handleResultSet(lSeQuery);
+//            long lEnd = System.currentTimeMillis();
+//            if (sDebug)
+//                sLogger.debug((new StringBuilder()).append("lSeQuery lasts ").append((double) (lEnd - lStart) / 1000D).append(" seconds").toString());
+            return lSet;
+        } catch (TechnicalException e) {
+            sLogger.error(e.getMessage(), e);
+            throw e;
+        } catch (Exception e) {
+            sLogger.error(e.getMessage(), e);
+            throw new TechnicalException("Error during executeQuery", e);
+        } finally {
+            returnConnection(con);
+        }
+
+    }
+
+    /**
+     * Execute a query against a sde datasource.
+     * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object.
+     *
+     * @param pSQLStatement the SQL-Statement to be executed.
+     * @return a ResultSet
+     * @see SeQuery
+     */
+    public ResultSet executeQuery(String pSQLStatement) throws TechnicalException {
+        if (sDebug) sLogger.debug("executeQuery():\n" + pSQLStatement);
+        Connection con = null;
+        try {
+            con = getConnection();
+
+
+            long lStart = System.currentTimeMillis();
+            
+            Statement stmt = con.createStatement();
+            java.sql.ResultSet rs = stmt.executeQuery(pSQLStatement);
+            
+            long lEnd = System.currentTimeMillis();
+            if (sDebug)
+                sLogger.debug((new StringBuilder()).append("lSeQuery lasts ").append((double) (lEnd - lStart) / 1000D).append(" seconds").toString());
+            return (ResultSet)rs;
+        } catch (TechnicalException e) {
+            sLogger.error(e.getMessage(), e);
+            throw e;
+        } catch (Exception e) {
+            sLogger.error(e.getMessage(), e);
+            throw new TechnicalException("Error during executeQuery", e);
+        } finally {
+            returnConnection(con);
+        }
+
+
+    }
+    
+//    /**
+//     * Execute a query against a sde datasource.
+//     * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object.
+//     *
+//     * @param pSQLStatement the SQL-Statement to be executed.
+//     * @return File
+//     * @see SeQuery
+//     */
+//    public TempFile  executeQueryDiagram (String pSQLStatement) throws TechnicalException {
+//        if (sDebug) sLogger.debug("executeQueryDiagram():\n" + pSQLStatement);
+//        SeConnection con = null;
+//        TempFile lImageFile = null;
+//        try {
+//            con = getConnection();
+//
+//            SeQuery lSeQuery = new SeQuery(con);
+//            long lStart = System.currentTimeMillis();
+//            lSeQuery.prepareSql(pSQLStatement);
+//            lSeQuery.execute();
+//
+//            //ResultSet lSet = handleResultSet(lSeQuery);
+//            lImageFile = handleRowToCSVFile(lSeQuery);
+//            
+//
+//            long lEnd = System.currentTimeMillis();
+//            if (sDebug)
+//                sLogger.debug((new StringBuilder()).append("lSeQuery lasts ").append((double) (lEnd - lStart) / 1000D).append(" seconds").toString());
+//            
+//        } catch (TechnicalException e) {
+//            sLogger.error(e.getMessage(), e);
+//            throw e;
+//        } catch (SeException e) {
+//            sLogger.error(e.getMessage(), e);
+//            throw new TechnicalException("Error during executeQuery", e);
+//        } finally {
+//            returnConnection(con);
+//        }
+//        return lImageFile;
+//
+//    }
+
+    /**
+     * Execute a spatial query against a sde datasource.
+     * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object.
+     * // todo: there is work needed to fully implement the wanted functionality.
+     *
+     * @param pLayername
+     * @param pSpatialColumnName
+     * @param pPoints
+     * @param pReturnFields
+     * @return a ResultSet
+     * @see SeShapeFilter
+     * @see SeQuery
+     */
+    public ResultSet executeQuery(String pLayername, String pSpatialColumnName, double[][] pPoints, String[] pReturnFields) throws TechnicalException {
+        sLogger.debug("executeQuery()");
+        Connection con = null;
+        try {
+            con = getConnection();
+//            // get the layer for querying
+//            SeLayer lLayer = new SeLayer(con, pLayername, pSpatialColumnName);
+//            SeCoordinateReference cref = lLayer.getCoordRef();
+//
+//
+//            SeShape shape = new SeShape();
+//            shape.setCoordRef(lLayer.getCoordRef());
+//            SDEPoint[] lPoints = ArcSDEUtils.createPoints(pPoints);
+//
+//            /*
+//            * int numPts, int numParts, int[] partOffsets,SDEPoint[] ptArray
+//            * */
+//            shape.generatePolygon(lPoints.length, 1, null, lPoints);
+//            SeShapeFilter filter = new SeShapeFilter(pLayername, pSpatialColumnName, shape, SeFilter.METHOD_AI);
+//            SeShapeFilter[] filters = new SeShapeFilter[1];
+//            filters[0] = filter;
+//
+//            SeQuery spatialQuery = null;
+//            SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername);
+//            spatialQuery = new SeQuery(con, pReturnFields, sqlCons);
+//            spatialQuery.prepareQuery();
+//            /*
+//            *   Set spatial constraints
+//            */
+//            spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false, filters);
+//            spatialQuery.execute();
+
+            return null;//handleResultSet(spatialQuery);
+
+        } catch (TechnicalException e) {
+            sLogger.error(e.getMessage(), e);
+            throw e;
+        } catch (Exception e) {
+            sLogger.error(e.getMessage(), e);
+            throw new TechnicalException("Error accessing Spatial Database: " + e.getMessage(), e);
+        } finally {
+            returnConnection(con);
+        }
+    }
+    /**
+     * Execute a spatial query against a sde datasource.
+     * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object.
+     * // todo: there is work needed to fully implement the wanted functionality.
+     *
+     * @param pLayername
+     * @param pSpatialColumnName
+     * @param pPoints
+     * @param pReturnFields
+     * @return a ResultSet
+     * @see SeShapeFilter
+     * @see SeQuery
+     */
+    public ResultSet executeQuery(String pLayername, String pSpatialColumnName, String pWhere, double[][] pPoints, String[] pReturnFields) throws TechnicalException {
+        sLogger.debug("executeQuery()");
+        Connection con = null;
+        try {
+            con = getConnection();
+//            // get the layer for querying
+//            SeLayer lLayer = new SeLayer(con, pLayername, pSpatialColumnName);
+//            SeCoordinateReference cref = lLayer.getCoordRef();
+//
+//
+//            SeShape shape = new SeShape();
+//            shape.setCoordRef(lLayer.getCoordRef());
+//            SDEPoint[] lPoints = ArcSDEUtils.createPoints(pPoints);
+//
+//            /*
+//            * int numPts, int numParts, int[] partOffsets,SDEPoint[] ptArray
+//            * */
+//            shape.generatePolygon(lPoints.length, 1, null, lPoints);
+//            SeShapeFilter filter = new SeShapeFilter(pLayername, pSpatialColumnName, shape, SeFilter.METHOD_AI);
+//            SeShapeFilter[] filters = new SeShapeFilter[1];
+//            filters[0] = filter;
+//
+//            SeQuery spatialQuery = null;
+//            SeSqlConstruct sqlCons = new SeSqlConstruct(pLayername,pWhere);
+//            spatialQuery = new SeQuery(con, pReturnFields, sqlCons);
+//            spatialQuery.prepareQuery();
+//            /*
+//            *   Set spatial constraints
+//            */
+//            spatialQuery.setSpatialConstraints(SeQuery.SE_OPTIMIZE, false, filters);
+//            spatialQuery.execute();
+
+            return null;//handleResultSet(spatialQuery);
+
+        } catch (TechnicalException e) {
+            sLogger.error(e.getMessage(), e);
+            throw e;
+        } catch (Exception e) {
+            sLogger.error(e.getMessage(), e);
+            throw new TechnicalException("Error accessing Spatial Database: " + e.getMessage(), e);
+        } finally {
+            returnConnection(con);
+        }
+    }
+    private Connection getConnection() throws TechnicalException {
+    	Connection  connection = connectionPool.getConnection(connectionID);
+        return connection;
+    }
+
+    private void returnConnection(Connection connection) {
+        try {
+	        this.connectionPool.closeConnection(connection);
+        } catch (ConnectionException e) {
+        	sLogger.error(e,e);
+        }
+    }
+
+
+    private ResultSet handleResultSet(SeQuery pSeQuery) throws SeException {
+        sLogger.debug("handleResultSet()");
+        SDEResultSet lSet = new SDEResultSet();
+        SeRow row;
+        int lCount;
+        for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) {
+            // one time execution
+            if (lCount == 0) {
+                // analyze cols of result set
+                SeColumnDefinition[] lCols = row.getColumns();
+                for (SeColumnDefinition lCol : lCols) {
+                    lSet.addCol(new ColDefinition(lCol.getName(), lCol.getType()));// notice: esri-types have been copied into colDefinition class!
+                }
+            }
+            short lNumCols = row.getNumColumns();
+            Row lBackingRow = new Row(lNumCols);
+            for (int i = 0; i < lNumCols; i++) {
+                lBackingRow.addObject(row.getObject(i), i);
+            }
+            lSet.addRow(lBackingRow);
+        }
+        pSeQuery.close();
+        return lSet;
+    }
+ 
+//    private TempFile handleRowToCSVFile(SeQuery pSeQuery) throws SeException {
+//        sLogger.debug("handleRowToTempFile()");
+//        TempFile lImageFile = TemporaryFileDirectory.getInstance().createFile(".csv");
+//        sLogger.debug("handleRowToTempFile() erstellen " + lImageFile.getFile().getName());
+//        CSVWriter writer = null;
+//        ColDefinition[] lColDefinitions = null;
+//        
+//        SeRow row;
+//        int lCount;
+//        try {
+//	        writer = new CSVWriter(new FileWriter(lImageFile.getFile()), ';');
+//	        for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) {
+//	            // one time execution
+//	            if (lCount == 0) {
+//	            	lColDefinitions = new ColDefinition[row.getNumColumns()];
+//	                // analyze cols of result set
+//	                SeColumnDefinition[] lCols = row.getColumns();
+//	                int j = 0;
+//	                for (SeColumnDefinition lCol : lCols) {
+//	                	lColDefinitions[j] = new ColDefinition(lCol.getName(), lCol.getType());
+//	                	j = j + 1;
+//	                }
+//	            }
+//	            short lNumCols = row.getNumColumns();
+//	            Row lBackingRow = new Row(lNumCols);
+//	            for (int i = 0; i < lNumCols; i++) {
+//	                lBackingRow.addObject(row.getObject(i), i);
+//	            }
+//	          
+//	            writer.writeRow(lBackingRow,lColDefinitions, false);
+//	        }
+//        } catch (IOException e) {
+//        	 sLogger.error(e.getMessage(), e);
+//        } catch (TechnicalException e) {
+//        	 sLogger.error(e.getMessage(), e);     
+//        }
+//        finally {
+//        	pSeQuery.close();
+//        	try{
+//        	writer.close();
+//        	}
+//        	catch (Exception e){
+//        		sLogger.error(e.getMessage(), e);
+//        	}
+//        }
+//        
+//        return lImageFile;
+//    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEResultSet.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,1156 @@
+/**
+ * Title:           SDEResultSet, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEResultSet.java,v 1.2 2008/01/30 12:38:34 blume Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEResultSet.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     21.11.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: blume $
+ * modified on:     $Date: 2008/01/30 12:38:34 $
+ * Version:         $Revision: 1.2 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import java.io.InputStream;
+import java.io.Reader;
+import java.math.BigDecimal;
+import java.net.URL;
+import java.sql.Array;
+import java.sql.Blob;
+import java.sql.Clob;
+import java.sql.Date;
+import java.sql.Ref;
+import java.sql.ResultSetMetaData;
+import java.sql.SQLException;
+import java.sql.SQLWarning;
+import java.sql.Statement;
+import java.sql.Time;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+
+import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException;
+
+/**
+ * @author blume
+ * @version 1.0
+ * @serial 1.0
+ * @see
+ * @since 21.11.2007 11:01:27
+ */
+public class SDEResultSet extends ResultSet {
+    
+   /**
+     * Default Logging instance
+     */
+    private static Logger log = Logger.getLogger(SDEResultSet.class);
+    
+    private List<Row> mRows = Collections.synchronizedList(new ArrayList<Row>());
+    private List<ColDefinition> mCols = Collections.synchronizedList(new ArrayList<ColDefinition>());
+    
+    private Row currentRow = null;
+    private int cursor = 0;
+    
+    public SDEResultSet() {
+    }
+    
+    public int getCount() {
+    	return mRows.size();
+    }
+    
+    public int getNumberOfColumns() {
+    	return mCols.size();
+    }
+    
+    public ColDefinition[] getColumnDefinitions() {
+    	ColDefinition[] lColDefinitions = new ColDefinition[mCols.size()];
+    	return mCols.toArray(lColDefinitions);
+    }
+    
+    public Row[] getResults() {
+    	Row[] lRows = new Row[mRows.size()];
+    	return mRows.toArray(lRows);
+    }
+    
+    public void addRow(Row pRow) {
+    	mRows.add(pRow);
+    }
+    
+    public void addCol(ColDefinition pColDefinition) {
+    	mCols.add(pColDefinition);
+    }
+    
+    /**
+     * @see java.sql.ResultSet#absolute(int)
+     */
+    public boolean absolute(int row) throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#afterLast()
+     */
+    public void afterLast() throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#beforeFirst()
+     */
+    public void beforeFirst() throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#cancelRowUpdates()
+     */
+    public void cancelRowUpdates() throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#clearWarnings()
+     */
+    public void clearWarnings() throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#close()
+     */
+    public void close() throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#deleteRow()
+     */
+    public void deleteRow() throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#findColumn(java.lang.String)
+     */
+    public int findColumn(String columnName) throws SQLException {
+    
+    	return 0;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#first()
+     */
+    public boolean first() throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getArray(int)
+     */
+    public Array getArray(int i) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getArray(java.lang.String)
+     */
+    public Array getArray(String colName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getAsciiStream(int)
+     */
+    public InputStream getAsciiStream(int columnIndex) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getAsciiStream(java.lang.String)
+     */
+    public InputStream getAsciiStream(String columnName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getBigDecimal(int)
+     */
+    public BigDecimal getBigDecimal(int columnIndex) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getBigDecimal(java.lang.String)
+     */
+    public BigDecimal getBigDecimal(String columnName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getBigDecimal(int, int)
+     */
+    public BigDecimal getBigDecimal(int columnIndex, int scale)
+            throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getBigDecimal(java.lang.String, int)
+     */
+    public BigDecimal getBigDecimal(String columnName, int scale)
+            throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getBinaryStream(int)
+     */
+    public InputStream getBinaryStream(int columnIndex) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getBinaryStream(java.lang.String)
+     */
+    public InputStream getBinaryStream(String columnName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getBlob(int)
+     */
+    public Blob getBlob(int i) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getBlob(java.lang.String)
+     */
+    public Blob getBlob(String colName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getBoolean(int)
+     */
+    public boolean getBoolean(int columnIndex) throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getBoolean(java.lang.String)
+     */
+    public boolean getBoolean(String columnName) throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getByte(int)
+     */
+    public byte getByte(int columnIndex) throws SQLException {
+    
+    	return 0;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getByte(java.lang.String)
+     */
+    public byte getByte(String columnName) throws SQLException {
+    
+    	return 0;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getBytes(int)
+     */
+    public byte[] getBytes(int columnIndex) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getBytes(java.lang.String)
+     */
+    public byte[] getBytes(String columnName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getCharacterStream(int)
+     */
+    public Reader getCharacterStream(int columnIndex) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getCharacterStream(java.lang.String)
+     */
+    public Reader getCharacterStream(String columnName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getClob(int)
+     */
+    public Clob getClob(int i) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getClob(java.lang.String)
+     */
+    public Clob getClob(String colName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getConcurrency()
+     */
+    public int getConcurrency() throws SQLException {
+    
+    	return 0;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getCursorName()
+     */
+    public String getCursorName() throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getDate(int)
+     */
+    public Date getDate(int columnIndex) throws SQLException {
+    	try {
+            return new java.sql.Date(this.currentRow.getDateValue(columnIndex-1).getTime());
+        } catch (TechnicalException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getDate(java.lang.String)
+     */
+    public Date getDate(String columnName) throws SQLException {
+    	int columnIndex = this.getColumnIndex(columnName);
+    	return this.getDate(columnIndex);
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getDate(int, java.util.Calendar)
+     */
+    public Date getDate(int columnIndex, Calendar cal) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getDate(java.lang.String, java.util.Calendar)
+     */
+    public Date getDate(String columnName, Calendar cal) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getDouble(int)
+     */
+    public double getDouble(int columnIndex) throws SQLException {
+    	try {
+            return this.currentRow.getDoubleValue(columnIndex-1);
+        } catch (TechnicalException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getDouble(java.lang.String)
+     */
+    public double getDouble(String columnName) throws SQLException {
+    	int columnIndex = this.getColumnIndex(columnName);
+    	return this.getDouble(columnIndex);
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getFetchDirection()
+     */
+    public int getFetchDirection() throws SQLException {
+    
+    	return 0;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getFetchSize()
+     */
+    public int getFetchSize() throws SQLException {
+    
+    	return 0;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getFloat(int)
+     */
+    public float getFloat(int columnIndex) throws SQLException {
+    	try {
+            return this.currentRow.getFloatValue(columnIndex-1);
+        } catch (TechnicalException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getFloat(java.lang.String)
+     */
+    public float getFloat(String columnName) throws SQLException {
+    	int columnIndex = this.getColumnIndex(columnName);
+    	return this.getFloat(columnIndex);
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getInt(int)
+     */
+    public int getInt(int columnIndex) throws SQLException {
+    
+    	try {
+            return this.currentRow.getIntValue(columnIndex-1);
+        } catch (TechnicalException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getInt(java.lang.String)
+     */
+    public int getInt(String columnName) throws SQLException {
+    	int columnIndex = this.getColumnIndex(columnName);
+    	return this.getInt(columnIndex);
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getLong(int)
+     */
+    public long getLong(int columnIndex) throws SQLException {
+    
+    	return 0;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getLong(java.lang.String)
+     */
+    public long getLong(String columnName) throws SQLException {
+    
+    	return 0;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getMetaData()
+     */
+    public ResultSetMetaData getMetaData() throws SQLException {
+        log.debug("SDEREsultSet.getMetaData");
+        return new ArcSDEResultSetMetaData(this.mCols);
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getObject(int)
+     */
+    public Object getObject(int columnIndex) throws SQLException {
+    	try {
+            return this.currentRow.getValue(columnIndex-1);
+        } catch (TechnicalException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getObject(java.lang.String)
+     */
+    public Object getObject(String columnName) throws SQLException {
+    	int columnIndex = this.getColumnIndex(columnName);
+    	return this.getObject(columnIndex);
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getObject(int, java.util.Map)
+     */
+    public Object getObject(int i, Map<String, Class<?>> map)
+            throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getObject(java.lang.String, java.util.Map)
+     */
+    public Object getObject(String colName, Map<String, Class<?>> map)
+            throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getRef(int)
+     */
+    public Ref getRef(int i) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getRef(java.lang.String)
+     */
+    public Ref getRef(String colName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getRow()
+     */
+    public int getRow() throws SQLException {
+    
+    	return 0;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getShort(int)
+     */
+    public short getShort(int columnIndex) throws SQLException {
+    
+    	return 0;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getShort(java.lang.String)
+     */
+    public short getShort(String columnName) throws SQLException {
+    
+    	return 0;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getStatement()
+     */
+    public Statement getStatement() throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getString(int)
+     */
+    public String getString(int columnIndex) throws SQLException {
+    
+    	try {
+            return this.currentRow.getStringValue(columnIndex-1);
+        } catch (TechnicalException e) {
+            log.error(e,e);
+            throw new SQLException(e.getMessage());
+        }
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getString(java.lang.String)
+     */
+    public String getString(String columnName) throws SQLException {
+    	int columnIndex = this.getColumnIndex(columnName);
+    	return this.getString(columnIndex);
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getTime(int)
+     */
+    public Time getTime(int columnIndex) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getTime(java.lang.String)
+     */
+    public Time getTime(String columnName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getTime(int, java.util.Calendar)
+     */
+    public Time getTime(int columnIndex, Calendar cal) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getTime(java.lang.String, java.util.Calendar)
+     */
+    public Time getTime(String columnName, Calendar cal) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getTimestamp(int)
+     */
+    public Timestamp getTimestamp(int columnIndex) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getTimestamp(java.lang.String)
+     */
+    public Timestamp getTimestamp(String columnName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getTimestamp(int, java.util.Calendar)
+     */
+    public Timestamp getTimestamp(int columnIndex, Calendar cal)
+            throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getTimestamp(java.lang.String,
+     *      java.util.Calendar)
+     */
+    public Timestamp getTimestamp(String columnName, Calendar cal)
+            throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getType()
+     */
+    public int getType() throws SQLException {
+    
+    	return 0;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getURL(int)
+     */
+    public URL getURL(int columnIndex) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getURL(java.lang.String)
+     */
+    public URL getURL(String columnName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getUnicodeStream(int)
+     */
+    public InputStream getUnicodeStream(int columnIndex) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getUnicodeStream(java.lang.String)
+     */
+    public InputStream getUnicodeStream(String columnName) throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#getWarnings()
+     */
+    public SQLWarning getWarnings() throws SQLException {
+    
+    	return null;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#insertRow()
+     */
+    public void insertRow() throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#isAfterLast()
+     */
+    public boolean isAfterLast() throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#isBeforeFirst()
+     */
+    public boolean isBeforeFirst() throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#isFirst()
+     */
+    public boolean isFirst() throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#isLast()
+     */
+    public boolean isLast() throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#last()
+     */
+    public boolean last() throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#moveToCurrentRow()
+     */
+    public void moveToCurrentRow() throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#moveToInsertRow()
+     */
+    public void moveToInsertRow() throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#next()
+     */
+    public boolean next() throws SQLException {
+    	
+    	boolean next = this.mRows.size() > this.cursor;
+    	if (next){
+    		//log.debug("Zeile "+(cursor+1)+" von "+this.mRows.size()+" wird angesteuert.");
+    		this.currentRow = this.mRows.get(this.cursor);
+    		this.cursor++;
+    	}else{
+    		this.currentRow = null;
+    	}
+    	return next;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#previous()
+     */
+    public boolean previous() throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#refreshRow()
+     */
+    public void refreshRow() throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#relative(int)
+     */
+    public boolean relative(int rows) throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#rowDeleted()
+     */
+    public boolean rowDeleted() throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#rowInserted()
+     */
+    public boolean rowInserted() throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#rowUpdated()
+     */
+    public boolean rowUpdated() throws SQLException {
+    
+    	return false;
+    }
+    
+    /**
+     * @see java.sql.ResultSet#setFetchDirection(int)
+     */
+    public void setFetchDirection(int direction) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#setFetchSize(int)
+     */
+    public void setFetchSize(int rows) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateArray(int, java.sql.Array)
+     */
+    public void updateArray(int columnIndex, Array x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateArray(java.lang.String, java.sql.Array)
+     */
+    public void updateArray(String columnName, Array x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateAsciiStream(int, java.io.InputStream, int)
+     */
+    public void updateAsciiStream(int columnIndex, InputStream x, int length)
+            throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateAsciiStream(java.lang.String,
+     *      java.io.InputStream, int)
+     */
+    public void updateAsciiStream(String columnName, InputStream x, int length)
+            throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateBigDecimal(int, java.math.BigDecimal)
+     */
+    public void updateBigDecimal(int columnIndex, BigDecimal x)
+            throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateBigDecimal(java.lang.String,
+     *      java.math.BigDecimal)
+     */
+    public void updateBigDecimal(String columnName, BigDecimal x)
+            throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateBinaryStream(int, java.io.InputStream, int)
+     */
+    public void updateBinaryStream(int columnIndex, InputStream x, int length)
+            throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateBinaryStream(java.lang.String,
+     *      java.io.InputStream, int)
+     */
+    public void updateBinaryStream(String columnName, InputStream x, int length)
+            throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateBlob(int, java.sql.Blob)
+     */
+    public void updateBlob(int columnIndex, Blob x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateBlob(java.lang.String, java.sql.Blob)
+     */
+    public void updateBlob(String columnName, Blob x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateBoolean(int, boolean)
+     */
+    public void updateBoolean(int columnIndex, boolean x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateBoolean(java.lang.String, boolean)
+     */
+    public void updateBoolean(String columnName, boolean x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateByte(int, byte)
+     */
+    public void updateByte(int columnIndex, byte x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateByte(java.lang.String, byte)
+     */
+    public void updateByte(String columnName, byte x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateBytes(int, byte[])
+     */
+    public void updateBytes(int columnIndex, byte[] x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateBytes(java.lang.String, byte[])
+     */
+    public void updateBytes(String columnName, byte[] x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateCharacterStream(int, java.io.Reader, int)
+     */
+    public void updateCharacterStream(int columnIndex, Reader x, int length)
+            throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateCharacterStream(java.lang.String,
+     *      java.io.Reader, int)
+     */
+    public void updateCharacterStream(String columnName, Reader reader,
+            int length) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateClob(int, java.sql.Clob)
+     */
+    public void updateClob(int columnIndex, Clob x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateClob(java.lang.String, java.sql.Clob)
+     */
+    public void updateClob(String columnName, Clob x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateDate(int, java.sql.Date)
+     */
+    public void updateDate(int columnIndex, Date x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateDate(java.lang.String, java.sql.Date)
+     */
+    public void updateDate(String columnName, Date x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateDouble(int, double)
+     */
+    public void updateDouble(int columnIndex, double x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateDouble(java.lang.String, double)
+     */
+    public void updateDouble(String columnName, double x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateFloat(int, float)
+     */
+    public void updateFloat(int columnIndex, float x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateFloat(java.lang.String, float)
+     */
+    public void updateFloat(String columnName, float x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateInt(int, int)
+     */
+    public void updateInt(int columnIndex, int x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateInt(java.lang.String, int)
+     */
+    public void updateInt(String columnName, int x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateLong(int, long)
+     */
+    public void updateLong(int columnIndex, long x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateLong(java.lang.String, long)
+     */
+    public void updateLong(String columnName, long x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateNull(int)
+     */
+    public void updateNull(int columnIndex) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateNull(java.lang.String)
+     */
+    public void updateNull(String columnName) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateObject(int, java.lang.Object)
+     */
+    public void updateObject(int columnIndex, Object x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object)
+     */
+    public void updateObject(String columnName, Object x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateObject(int, java.lang.Object, int)
+     */
+    public void updateObject(int columnIndex, Object x, int scale)
+            throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateObject(java.lang.String, java.lang.Object,
+     *      int)
+     */
+    public void updateObject(String columnName, Object x, int scale)
+            throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateRef(int, java.sql.Ref)
+     */
+    public void updateRef(int columnIndex, Ref x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateRef(java.lang.String, java.sql.Ref)
+     */
+    public void updateRef(String columnName, Ref x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateRow()
+     */
+    public void updateRow() throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateShort(int, short)
+     */
+    public void updateShort(int columnIndex, short x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateShort(java.lang.String, short)
+     */
+    public void updateShort(String columnName, short x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateString(int, java.lang.String)
+     */
+    public void updateString(int columnIndex, String x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateString(java.lang.String, java.lang.String)
+     */
+    public void updateString(String columnName, String x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateTime(int, java.sql.Time)
+     */
+    public void updateTime(int columnIndex, Time x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateTime(java.lang.String, java.sql.Time)
+     */
+    public void updateTime(String columnName, Time x) throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateTimestamp(int, java.sql.Timestamp)
+     */
+    public void updateTimestamp(int columnIndex, Timestamp x)
+            throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#updateTimestamp(java.lang.String,
+     *      java.sql.Timestamp)
+     */
+    public void updateTimestamp(String columnName, Timestamp x)
+            throws SQLException {
+    }
+    
+    /**
+     * @see java.sql.ResultSet#wasNull()
+     */
+    public boolean wasNull() throws SQLException {
+    
+            return false;
+    }
+    
+    
+    private int getColumnIndex(String columnName) throws SQLException{
+         //TODO: Es gibt effizentere Lösungen. Hier noch mal über HashMap nachdenken
+    for (int i = 0 ; i < this.mCols.size();i++){
+        if(this.mCols.get(i).getName().equalsIgnoreCase(columnName)){
+            return i +1; // PLUS 1 da SQL-Cursor 1 nasiert sind
+        }
+    }
+    throw new SQLException("Column "+columnName+" does not exist in ResulSet");
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/DatasourceException.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,37 @@
+/* Copyright (C) 2007 con terra GmbH (http://www.conterra.de)
+ * All rights reserved
+ *
+ * $Id: DatasourceException.java,v 1.2 2008/01/30 12:38:34 blume Exp $
+ *
+ * created by:      drewnak
+ * created at :     21.11.2007
+ * created at :     14:56:32
+ *
+ * modified by:     $Author: blume $
+ * modified at:     $Date: 2008/01/30 12:38:34 $
+ */
+package de.intevation.gnv.geobackend.sde.datasources.exception;
+
+/**
+ * A Class for encapsulating implementation specific datasource exceptions.
+ * This exception class can be used for all exceptions occuring in connection to "datasources actions".
+ */
+public class DatasourceException extends Exception {
+
+    public DatasourceException() {
+        super();
+    }
+
+    public DatasourceException(String pMessage) {
+        super(pMessage);
+    }
+
+    public DatasourceException(String pMessage, Throwable pCause) {
+        super(pMessage, pCause);
+    }
+
+    public DatasourceException(Throwable pCause) {
+        super(pCause);
+    }
+
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/exception/TechnicalException.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,79 @@
+/**
+ * Title:           TechnicalException, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/TechnicalException.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/exception/TechnicalException.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     21.11.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: drewnak $
+ * modified on:     $Date: 2008/08/18 14:50:33 $
+ * Version:         $Revision: 1.2 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.geobackend.sde.datasources.exception;
+
+import org.apache.log4j.Logger;
+
+/**
+ * The class <code>TechnicalException</code> fulfills the following purposes:
+ * <ol>
+ * <li></li>
+ * </ol>
+ *
+ * @author blume
+ * @version 1.0
+ * @serial 1.0
+ * @see
+ * @since 21.11.2007 08:12:08
+ */
+public class TechnicalException extends Exception{
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(TechnicalException.class);
+
+    /**
+     * Constructs a new exception with <code>null</code> as its detail message.
+     * The cause is not initialized, and may subsequently be initialized by a
+     * call to {@link #initCause}.
+     */
+    public TechnicalException() {
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message.  The
+     * cause is not initialized, and may subsequently be initialized by
+     * a call to {@link #initCause}.
+     *
+     * @param message the detail message. The detail message is saved for
+     *                later retrieval by the {@link #getMessage()} method.
+     */
+    public TechnicalException(String message) {
+        super(message);
+    }
+    public TechnicalException(Throwable pCause) {
+        super(pCause);
+    }
+
+    /**
+     * Constructs a new exception with the specified detail message and
+     * cause.  <p>Note that the detail message associated with
+     * <code>cause</code> is <i>not</i> automatically incorporated in
+     * this exception's detail message.
+     *
+     * @param message the detail message (which is saved for later retrieval
+     *                by the {@link #getMessage()} method).
+     * @param cause   the cause (which is saved for later retrieval by the
+     *                {@link #getCause()} method).  (A <tt>null</tt> value is
+     *                permitted, and indicates that the cause is nonexistent or
+     *                unknown.)
+     * @since 1.4
+     */
+    public TechnicalException(String message, Throwable cause) {
+        super(message, cause);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/main/java/de/intevation/gnv/geobackend/util/DateUtils.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,128 @@
+/**
+ * Title:           DateUtisl, $Header: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/util/DateUtils.java,v 1.2 2008/08/18 14:50:33 drewnak Exp $
+ * Source:          $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/util/DateUtils.java,v $
+ * created by:      Stefan Blume (blume)
+ * erstellt am:     21.12.2007
+ * Copyright:       con terra GmbH, 2005
+ *
+ * modified by:     $Author: drewnak $
+ * modified on:     $Date: 2008/08/18 14:50:33 $
+ * Version:         $Revision: 1.2 $
+ * TAG:             $Name:  $
+ * locked from:     $Locker:  $
+ * CVS State:       $State: Exp $
+ * Project:         $ProjectName$
+ */
+package de.intevation.gnv.geobackend.util;
+
+import org.apache.log4j.Logger;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+
+/**
+ * The class <code>DateUtisl</code> fulfills the following purposes:
+ * <ol>
+ * <li></li>
+ * </ol>
+ *
+ * @author blume
+ * @version 1.0
+ * @serial 1.0
+ * @see
+ * @since 21.12.2007 10:34:01
+ */
+public class DateUtils {
+
+    /**
+     * Default Logging instance
+     */
+    private static Logger sLogger = Logger.getLogger(DateUtils.class);
+    private static boolean sDebug = sLogger.isDebugEnabled();
+
+    public static final String DATE_PATTERN = "yyyy.MM.dd HH:mm:ss";
+    public static final String DATE_PATTERN1 = "dd-MMM-yyyy HH:mm:ss";
+    public static final String TimeRangeFilterPattern = "yyyy-MM-dd'T'HH:mm:ssZ";
+    public static final String TimeRangeFilterFormPattern = "dd.MM.yyyy HH:mm";
+
+    public static String getPatternedDateSDF(Date pDate) {
+        SimpleDateFormat fmt = new SimpleDateFormat();
+        fmt.applyPattern(DATE_PATTERN);
+        return fmt.format(pDate);
+    }
+    
+    public static String getPatternedDate(Date pDate, String  sPattern) {
+//    	DateTimeZone.setDefault(DateTimeZone.UTC);
+//    	DateTime dtf = new DateTime (pDate);
+//    	String sStr = dtf.toString(sPattern);
+//      return sStr;
+    	 SimpleDateFormat fmt = new SimpleDateFormat();
+         fmt.applyPattern(sPattern);
+         return fmt.format(pDate);
+    }
+    
+    public static String getPatternedDateAmer(Date pDate) {
+    	
+    	String sStr = getPatternedDate(pDate, DATE_PATTERN);
+        return sStr;
+    }
+    
+    public static String getPatternedDateGerm(Date pDate) {
+    	
+    	String sStr = getPatternedDate(pDate, DATE_PATTERN1);
+        return sStr;
+    }
+    
+    public static String getPatternedDateTimeRangeFilter(Date pDate) {
+    	
+    	String sStr = getPatternedDate(pDate, TimeRangeFilterPattern);
+        return sStr;
+    }
+    
+    public static String getPatternedDateTimeRangeFilterForm(Date pDate) {
+    	
+    	String sStr = getPatternedDate(pDate, TimeRangeFilterFormPattern);
+        return sStr;
+    }
+    
+    public synchronized static Date getDateFromStringSDF (String sStr)throws Exception {
+    	SimpleDateFormat formatter = new SimpleDateFormat("dd-MMM-yyyy HH:mm:ss");
+		Date   date = (Date)formatter.parse(sStr);
+		return date;
+    }
+    
+    public  static Date getDateFromString (String sStr)throws Exception {
+    	
+		Date   date = getDateFromString (sStr, DATE_PATTERN1);
+	    return date;
+    }
+    
+    public  static Date getDateFromStringTimeRangeFilter (String sStr)throws Exception {
+    	
+		Date   date = getDateFromString (sStr, TimeRangeFilterPattern);
+	        	return date;
+    } 
+    
+    public  static Date getDateFromStringTimeRangeFilterForm (String sStr)throws Exception {
+    	
+		Date   date = getDateFromString (sStr, TimeRangeFilterFormPattern);
+    	return date;
+    } 
+    
+    public  static Date getDateFromString (String sStr, String sPattern)throws Exception {
+//    	DateTime dtf = null;
+//    	DateTimeZone.setDefault(DateTimeZone.UTC); 
+//    	
+//	    dtf = DateTimeFormat.forPattern(sPattern).parseDateTime(sStr);
+//    	
+//		Date   date = dtf.toDate();
+//    	
+//    	return date;
+    	SimpleDateFormat fmt = new SimpleDateFormat();
+        fmt.applyPattern(sPattern);
+        return fmt.parse(sStr);
+    } 
+    
+     
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/base/query/QueryExecutorTestCase.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,155 @@
+/**
+ *
+ */
+package de.intevation.gnv.geobackend.base.query;
+
+import java.io.FileInputStream;
+import java.io.InputStream;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Logger;
+
+import de.intevation.gnv.geobackend.base.Result;
+import de.intevation.gnv.geobackend.base.ResultDescriptor;
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory;
+import de.intevation.gnv.geobackend.base.query.container.QueryContainerFactory;
+import de.intevation.gnv.geobackend.base.query.exception.QueryException;
+import junit.framework.TestCase;
+
+/**
+ * TestCase for the QueryExecutor interface
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class QueryExecutorTestCase extends TestCase {
+    
+    
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = null;
+    
+    static{
+        BasicConfigurator.configure();
+        log = Logger.getLogger(QueryExecutorTestCase.class);
+    }
+    
+    /**
+     * Constructor
+     * @param name
+     */
+    public QueryExecutorTestCase(String name) {
+        super(name);
+    }
+    
+    
+    public void  testSpatialQuery(){
+            try {
+            
+            this.testQuery(27031, "spatial_query", null);
+       } catch (QueryException e) {
+            log.error(e,e);
+            fail();
+        }
+    }
+    
+    
+    /**
+     * Tests if the Databaseconnection can be established and
+     * Data could be read from the Database
+     */
+    public void testQueryExecutor(){
+        
+        try {
+            
+            this.testQuery(6, "mesh", null);
+            
+            this.testQuery(1, "mesh_id", new String[]{"5"});
+            
+            
+            
+        } catch (QueryException e) {
+            log.error(e,e);
+            fail();
+        }
+    }
+    
+    public void testTimeSeriesQueries(){
+        
+        try{
+            // Test zum initialisieren der umgebung
+            this.testQuery(6, "mesh", null);
+            
+            
+            this.testQuery(11, "timeseries_stations", new String[]{"4"});
+            this.testQuery(11, "timeseries_stations_op", new String[]{"4"});
+            this.testQuery(1, "timeseries_interval", new String[]{"500042 ", "54"});
+            
+        } catch (QueryException e) {
+            log.error(e,e);
+            fail();
+        }
+        
+    }
+
+    /**
+     * @param resultsize
+     * @param queryID
+     * @param filter
+     * @throws QueryException
+     */
+    private void testQuery(int resultsize, String queryID, String[] filter)
+            throws QueryException {
+        long start = System.currentTimeMillis();
+        QueryExecutor queryExecutor = QueryExecutorFactory.getInstance().getQueryExecutor();
+        Collection<Result> results = queryExecutor.executeQuery(queryID, filter);
+        if (results == null || results.size() == 0){
+            log.error("Keine Daten erhalten");
+            fail();
+        }else {
+            assertEquals(resultsize, results.size());
+            log.debug(resultsize+" Datensätze erhalten");
+            Iterator<Result> it = results.iterator();
+            while (it.hasNext()){
+                Result tmpResult = it.next();
+                ResultDescriptor resultDescriptor = tmpResult.getResultDescriptor();
+                int columns = resultDescriptor.getColumnCount();
+                for (int i = 0; i < columns; i++){
+                    String columnName = resultDescriptor.getColumnName(i);
+                    Object value = tmpResult.getObject(columnName);
+                    log.debug(columnName + " ==> "+value.toString());
+                }
+            }
+        }
+        log.debug("Query dauerte: "+(System.currentTimeMillis()-start) +"ms");
+    }
+    
+
+
+    /**
+     * @see junit.framework.TestCase#setUp()
+     */
+    @Override
+    protected void setUp() throws Exception {
+        
+        super.setUp();
+        InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties");
+        Properties properties = new Properties();
+        properties.load(inputStream);
+        
+        ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance();
+        cpf.initializeConnectionPool(properties);
+        
+        
+        inputStream = new FileInputStream("src/test/ressources/QueryExecutorTestCase.properties");
+        properties = new Properties();
+        properties.load(inputStream);
+        
+        QueryContainerFactory qcf = QueryContainerFactory.getInstance();
+        qcf.initializeQueryContainer(properties);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,120 @@
+package de.intevation.gnv.geobackend.sde.datasources;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Properties;
+import java.sql.ResultSet;
+
+import junit.framework.TestCase;
+
+import org.apache.log4j.BasicConfigurator;
+import org.apache.log4j.Logger;
+
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool;
+import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPoolFactory;
+import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException;
+import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEPoolableObjectFactory;
+
+/**
+ * TestCase for the usage of the ArcSDEConnectionPool.
+ * @author Tim Englich <tim.englich@intevation.de>
+ *
+ */
+public class ArcSDEConnectionPoolTestCase extends TestCase {
+
+    /**
+     * the logger, used to log exceptions and additonaly information
+     */
+    private static Logger log = null;
+    
+    static {
+        BasicConfigurator.configure();
+        log = Logger.getLogger(ArcSDEPoolableObjectFactory.class);
+    }
+    /**
+     * 
+     */
+    public ArcSDEConnectionPoolTestCase() {
+        super();
+    }
+    
+    /**
+     * 
+     * @param name
+     */
+    public ArcSDEConnectionPoolTestCase(String name) {
+        super(name);
+    }
+    
+    /**
+     * Test if the ArcSDEConnectionPool can be established
+     * and if a Request could be done.
+     */
+    public void testArcSDEConnectionPool(){
+        log.debug("ArcSDEConnectionPoolTestCase.testArcSDEConnectionPool");
+        try {
+            InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties");
+            Properties properties = new Properties();
+            properties.load(inputStream);
+            
+            ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance();
+            cpf.initializeConnectionPool(properties);
+            
+            assertTrue(cpf.isInitialized());
+            log.debug("ConnectionPoolFactory ist initialisiert.");
+            
+            ConnectionPool cp = cpf.getConnectionPool();
+            assertNotNull(cp);
+            log.debug("ConnectionPool ist initialisiert.");			
+            
+            Connection connection = null; 
+            try{
+                try {
+                    connection = cp.getConnection("N/N");
+                    assertNotNull(connection);
+                    log.debug("Connection ist initialisiert.");
+                } catch (ConnectionException e) {
+                    log.error("Es traten Probleme bei der Verbinung zur Datenbank auf.");
+                    fail();
+                }
+                
+                
+                try {
+                    Statement stmt = connection.createStatement();
+                    ResultSet rs = stmt.executeQuery("Select MESHID, NAME from MEDIAN.MESH");
+                    
+                    while (rs.next()){
+                        log.debug(rs.getInt(1));
+                        log.debug(rs.getString(2));
+                        
+                        log.debug(rs.getInt("MESHID"));
+                        log.debug(rs.getString("NAME"));
+                    }
+                    
+                } catch (SQLException e) {
+                    log.error(e,e);
+                }
+            }finally{
+                if (connection != null){
+                    try {
+                            connection.close();
+                    } catch (SQLException e) {
+                        log.error(e,e);
+                        fail();
+                    }
+                }
+            }
+        } catch (FileNotFoundException e) {
+            log.error(e,e);
+            fail();
+        } catch (IOException e) {
+            log.error(e,e);
+            fail();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/test/ressources/ArcSDEConnectionPoolTestCase.properties	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,6 @@
+maxActive=2
+server=localhost
+username=gast
+credentials=gast
+port=22119
+database=esri_sde
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/src/test/ressources/QueryExecutorTestCase.properties	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,12 @@
+mesh=Select MESHID, NAME from MEDIAN.MESH
+mesh_id=Select MESHID, NAME from MEDIAN.MESH where MESHID = ?
+
+
+
+# Timeseries
+timeseries_stations=SELECT tsp.FEATUREID, tsp.NAME FROM MEDIAN.TIMESERIESPOINT tsp WHERE tsp.FEATUREID IN (SELECT DISTINCT mmt.FEATUREID FROM MEDIAN.MEASUREMENT mmt  WHERE  mmt.SOURCEID IN ( 4 )) order by tsp.name
+timeseries_stations_op=SELECT DISTINCT tsp.FEATUREID, tsp.NAME FROM MEDIAN.TIMESERIESPOINT tsp, MEDIAN.MEASUREMENT mmt WHERE tsp.FEATUREID =  mmt.FEATUREID AND mmt.SOURCEID IN ( 4 ) order by tsp.name
+timeseries_interval=select min(tv.TIMEVALUE) MIN, max(tv.TIMEVALUE) MAX from MEDIAN.TIMESERIES t , MEDIAN.TIMESERIESVALUE tv where tv.TIMESERIESID = t.TIMESERIESID and tv.MEASUREMENTID IN ( ? ) AND t.PARAMETERID IN ( ? )
+
+
+ spatial_query=SELECT FEATUREID, SHAPE FROM  MEDIAN.MESHPOINT WHERE MESHID = 3 AND KPOSITION = 1
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/target/surefire-reports/TEST-de.intevation.gnv.geobackend.base.query.QueryExecutorTestCase.xml	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite failures="0" time="1.135" errors="0" skipped="0" tests="1" name="de.intevation.gnv.geobackend.base.query.QueryExecutorTestCase">
+  <properties>
+    <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
+    <property name="sun.boot.library.path" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/i386"/>
+    <property name="java.vm.version" value="14.2-b01"/>
+    <property name="java.vm.vendor" value="Sun Microsystems Inc."/>
+    <property name="java.vendor.url" value="http://java.sun.com/"/>
+    <property name="path.separator" value=":"/>
+    <property name="java.vm.name" value="Java HotSpot(TM) Server VM"/>
+    <property name="file.encoding.pkg" value="sun.io"/>
+    <property name="user.country" value="DE"/>
+    <property name="sun.java.launcher" value="SUN_STANDARD"/>
+    <property name="sun.os.patch.level" value="unknown"/>
+    <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
+    <property name="user.dir" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend"/>
+    <property name="java.runtime.version" value="1.6.0_16-b01"/>
+    <property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/>
+    <property name="basedir" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend"/>
+    <property name="java.endorsed.dirs" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/endorsed"/>
+    <property name="os.arch" value="i386"/>
+    <property name="surefire.real.class.path" value="/tmp/surefirebooter6153140674202082692.jar"/>
+    <property name="java.io.tmpdir" value="/tmp"/>
+    <property name="line.separator" value="
+"/>
+    <property name="java.vm.specification.vendor" value="Sun Microsystems Inc."/>
+    <property name="os.name" value="Linux"/>
+    <property name="sun.jnu.encoding" value="ISO-8859-15"/>
+    <property name="java.library.path" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/i386/server:/vol1/opt/java/jdk1.6.0_16/jre/lib/i386:/vol1/opt/java/jdk1.6.0_16/jre/../lib/i386:/vol1/opt/java/maven2/current/lib:/vol1/opt/java/java6/lib:/vol1/opt/java/java5/lib:/vol1/opt/nethack/lib:/home/intevation/shared/lib:/usr/java/packages/lib/i386:/lib:/usr/lib"/>
+    <property name="surefire.test.class.path" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/test-classes:/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/classes:/home/tim/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/home/tim/.m2/repository/com/esri/sde/jsde_sdk/9.2.5/jsde_sdk-9.2.5.jar:/home/tim/.m2/repository/com/esri/sde/jpe_sdk/9.2.5/jpe_sdk-9.2.5.jar:/home/tim/.m2/repository/com/ibm/icu4j/3.2/icu4j-3.2.jar:/home/tim/.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar:/home/tim/.m2/repository/commons-pool/commons-pool/1.5.2/commons-pool-1.5.2.jar:"/>
+    <property name="java.specification.name" value="Java Platform API Specification"/>
+    <property name="java.class.version" value="50.0"/>
+    <property name="sun.management.compiler" value="HotSpot Tiered Compilers"/>
+    <property name="os.version" value="2.6.29.4-id1-k8-9"/>
+    <property name="user.home" value="/home/tim"/>
+    <property name="user.timezone" value=""/>
+    <property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/>
+    <property name="file.encoding" value="ISO-8859-15"/>
+    <property name="java.specification.version" value="1.6"/>
+    <property name="user.name" value="tim"/>
+    <property name="java.class.path" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/test-classes:/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/classes:/home/tim/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/home/tim/.m2/repository/com/esri/sde/jsde_sdk/9.2.5/jsde_sdk-9.2.5.jar:/home/tim/.m2/repository/com/esri/sde/jpe_sdk/9.2.5/jpe_sdk-9.2.5.jar:/home/tim/.m2/repository/com/ibm/icu4j/3.2/icu4j-3.2.jar:/home/tim/.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar:/home/tim/.m2/repository/commons-pool/commons-pool/1.5.2/commons-pool-1.5.2.jar:"/>
+    <property name="java.vm.specification.version" value="1.0"/>
+    <property name="sun.arch.data.model" value="32"/>
+    <property name="java.home" value="/vol1/opt/java/jdk1.6.0_16/jre"/>
+    <property name="java.specification.vendor" value="Sun Microsystems Inc."/>
+    <property name="user.language" value="de"/>
+    <property name="java.vm.info" value="mixed mode"/>
+    <property name="java.version" value="1.6.0_16"/>
+    <property name="java.ext.dirs" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/ext:/usr/java/packages/lib/ext"/>
+    <property name="sun.boot.class.path" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/resources.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/rt.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/sunrsasign.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/jsse.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/jce.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/charsets.jar:/vol1/opt/java/jdk1.6.0_16/jre/classes"/>
+    <property name="java.vendor" value="Sun Microsystems Inc."/>
+    <property name="localRepository" value="/home/tim/.m2/repository"/>
+    <property name="file.separator" value="/"/>
+    <property name="java.vendor.url.bug" value="http://java.sun.com/cgi-bin/bugreport.cgi"/>
+    <property name="sun.cpu.endian" value="little"/>
+    <property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
+    <property name="sun.cpu.isalist" value=""/>
+  </properties>
+  <testcase time="1.132" classname="de.intevation.gnv.geobackend.base.query.QueryExecutorTestCase" name="testQueryExecutor"/>
+</testsuite>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/target/surefire-reports/TEST-de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnectionPoolTestCase.xml	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<testsuite failures="0" time="1.706" errors="0" skipped="0" tests="1" name="de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnectionPoolTestCase">
+  <properties>
+    <property name="java.runtime.name" value="Java(TM) SE Runtime Environment"/>
+    <property name="sun.boot.library.path" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/i386"/>
+    <property name="java.vm.version" value="14.2-b01"/>
+    <property name="java.vm.vendor" value="Sun Microsystems Inc."/>
+    <property name="java.vendor.url" value="http://java.sun.com/"/>
+    <property name="path.separator" value=":"/>
+    <property name="java.vm.name" value="Java HotSpot(TM) Server VM"/>
+    <property name="file.encoding.pkg" value="sun.io"/>
+    <property name="user.country" value="DE"/>
+    <property name="sun.java.launcher" value="SUN_STANDARD"/>
+    <property name="sun.os.patch.level" value="unknown"/>
+    <property name="java.vm.specification.name" value="Java Virtual Machine Specification"/>
+    <property name="user.dir" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend"/>
+    <property name="java.runtime.version" value="1.6.0_16-b01"/>
+    <property name="java.awt.graphicsenv" value="sun.awt.X11GraphicsEnvironment"/>
+    <property name="basedir" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend"/>
+    <property name="java.endorsed.dirs" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/endorsed"/>
+    <property name="os.arch" value="i386"/>
+    <property name="surefire.real.class.path" value="/tmp/surefirebooter6153140674202082692.jar"/>
+    <property name="java.io.tmpdir" value="/tmp"/>
+    <property name="line.separator" value="
+"/>
+    <property name="java.vm.specification.vendor" value="Sun Microsystems Inc."/>
+    <property name="os.name" value="Linux"/>
+    <property name="sun.jnu.encoding" value="ISO-8859-15"/>
+    <property name="java.library.path" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/i386/server:/vol1/opt/java/jdk1.6.0_16/jre/lib/i386:/vol1/opt/java/jdk1.6.0_16/jre/../lib/i386:/vol1/opt/java/maven2/current/lib:/vol1/opt/java/java6/lib:/vol1/opt/java/java5/lib:/vol1/opt/nethack/lib:/home/intevation/shared/lib:/usr/java/packages/lib/i386:/lib:/usr/lib"/>
+    <property name="surefire.test.class.path" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/test-classes:/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/classes:/home/tim/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/home/tim/.m2/repository/com/esri/sde/jsde_sdk/9.2.5/jsde_sdk-9.2.5.jar:/home/tim/.m2/repository/com/esri/sde/jpe_sdk/9.2.5/jpe_sdk-9.2.5.jar:/home/tim/.m2/repository/com/ibm/icu4j/3.2/icu4j-3.2.jar:/home/tim/.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar:/home/tim/.m2/repository/commons-pool/commons-pool/1.5.2/commons-pool-1.5.2.jar:"/>
+    <property name="java.specification.name" value="Java Platform API Specification"/>
+    <property name="java.class.version" value="50.0"/>
+    <property name="sun.management.compiler" value="HotSpot Tiered Compilers"/>
+    <property name="os.version" value="2.6.29.4-id1-k8-9"/>
+    <property name="user.home" value="/home/tim"/>
+    <property name="user.timezone" value=""/>
+    <property name="java.awt.printerjob" value="sun.print.PSPrinterJob"/>
+    <property name="file.encoding" value="ISO-8859-15"/>
+    <property name="java.specification.version" value="1.6"/>
+    <property name="user.name" value="tim"/>
+    <property name="java.class.path" value="/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/test-classes:/vol1/home/tim/workspace/gnvdevelop/trunk/geo-backend/target/classes:/home/tim/.m2/repository/junit/junit/3.8.1/junit-3.8.1.jar:/home/tim/.m2/repository/com/esri/sde/jsde_sdk/9.2.5/jsde_sdk-9.2.5.jar:/home/tim/.m2/repository/com/esri/sde/jpe_sdk/9.2.5/jpe_sdk-9.2.5.jar:/home/tim/.m2/repository/com/ibm/icu4j/3.2/icu4j-3.2.jar:/home/tim/.m2/repository/log4j/log4j/1.2.13/log4j-1.2.13.jar:/home/tim/.m2/repository/commons-pool/commons-pool/1.5.2/commons-pool-1.5.2.jar:"/>
+    <property name="java.vm.specification.version" value="1.0"/>
+    <property name="sun.arch.data.model" value="32"/>
+    <property name="java.home" value="/vol1/opt/java/jdk1.6.0_16/jre"/>
+    <property name="java.specification.vendor" value="Sun Microsystems Inc."/>
+    <property name="user.language" value="de"/>
+    <property name="java.vm.info" value="mixed mode"/>
+    <property name="java.version" value="1.6.0_16"/>
+    <property name="java.ext.dirs" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/ext:/usr/java/packages/lib/ext"/>
+    <property name="sun.boot.class.path" value="/vol1/opt/java/jdk1.6.0_16/jre/lib/resources.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/rt.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/sunrsasign.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/jsse.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/jce.jar:/vol1/opt/java/jdk1.6.0_16/jre/lib/charsets.jar:/vol1/opt/java/jdk1.6.0_16/jre/classes"/>
+    <property name="java.vendor" value="Sun Microsystems Inc."/>
+    <property name="localRepository" value="/home/tim/.m2/repository"/>
+    <property name="file.separator" value="/"/>
+    <property name="java.vendor.url.bug" value="http://java.sun.com/cgi-bin/bugreport.cgi"/>
+    <property name="sun.cpu.endian" value="little"/>
+    <property name="sun.io.unicode.encoding" value="UnicodeLittle"/>
+    <property name="sun.cpu.isalist" value=""/>
+  </properties>
+  <testcase time="1.557" classname="de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnectionPoolTestCase" name="testArcSDEConnectionPool"/>
+</testsuite>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/target/surefire-reports/de.intevation.gnv.geobackend.base.query.QueryExecutorTestCase.txt	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,4 @@
+-------------------------------------------------------------------------------
+Test set: de.intevation.gnv.geobackend.base.query.QueryExecutorTestCase
+-------------------------------------------------------------------------------
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.142 sec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/geo-backend/target/surefire-reports/de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnectionPoolTestCase.txt	Fri Sep 28 12:13:42 2012 +0200
@@ -0,0 +1,4 @@
+-------------------------------------------------------------------------------
+Test set: de.intevation.gnv.geobackend.sde.datasources.ArcSDEConnectionPoolTestCase
+-------------------------------------------------------------------------------
+Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.716 sec

http://dive4elements.wald.intevation.org