Mercurial > dive4elements > gnv-client
annotate geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/SDEQuery.java @ 552:7615ee5d1345
Cleanup imports
geo-backend/trunk@550 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 15 Jan 2010 20:57:13 +0000 |
parents | 210716612c30 |
children |
rev | line source |
---|---|
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 /** |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 * 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 $ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 * Source: $Source: /share/gdi/SDI-Suite/Repository/projekte/BSH-GDI/genericViewer/src/main/java/de/conterra/bsh/gdi/gnviewer/datasources/sde/SDEQuery.java,v $ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 * created by: Stefan Blume (blume) |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 * erstellt am: 21.11.2007 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
6 * Copyright: con terra GmbH, 2005 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
7 * |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
8 * modified by: $Author: blume $ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
9 * modified on: $Date: 2008/01/30 12:38:34 $ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
10 * Version: $Revision: 1.3 $ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
11 * TAG: $Name: $ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
12 * locked from: $Locker: $ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
13 * CVS State: $State: Exp $ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
14 * Project: $ProjectName$ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
15 */ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
16 package de.intevation.gnv.geobackend.sde.datasources; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
17 |
552
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
18 import com.esri.sde.sdk.client.SeColumnDefinition; |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
19 import com.esri.sde.sdk.client.SeConnection; |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
20 import com.esri.sde.sdk.client.SeException; |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
21 import com.esri.sde.sdk.client.SeQuery; |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
22 import com.esri.sde.sdk.client.SeRow; |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
23 import com.esri.sde.sdk.client.SeShapeFilter; |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
24 import com.esri.sde.sdk.client.SeSqlConstruct; |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
25 |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
26 import de.intevation.gnv.geobackend.base.connectionpool.ConnectionPool; |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
27 |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
28 import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
29 |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
30 import de.intevation.gnv.geobackend.sde.datasources.exception.TechnicalException; |
7615ee5d1345
Cleanup imports
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
546
diff
changeset
|
31 |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
32 import java.sql.Connection; |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
33 import java.sql.Statement; |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
34 |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
35 import org.apache.log4j.Logger; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
36 /** |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
37 * // todo: supply a general interface for Query-Objects (Query = read access to datasource implementation) |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
38 * |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
39 * @author blume |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
40 * @version 1.0 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
41 * @serial 1.0 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
42 * @see |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
43 * @since 21.11.2007 11:32:19 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
44 */ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
45 public class SDEQuery { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
46 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
47 /** |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
48 * Default Logging instance |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
49 */ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 private static final Logger sLogger = Logger.getLogger(SDEQuery.class); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
51 private static boolean sDebug = sLogger.isDebugEnabled(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
52 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
54 private ConnectionPool connectionPool = null; |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
55 private String connectionID = "N/N"; |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
56 |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
57 public SDEQuery(ConnectionPool connectionPool) { |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
58 if (sDebug) sLogger.debug("SDEQuery()"); |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
59 this.connectionPool = connectionPool; |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
60 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
61 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
62 /** |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
63 * Execute a query against a sde datasource. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
64 * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
65 * |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
66 * @param pTables |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
67 * @param pCols |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
68 * @param pWhere the where-clause to be executed. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
69 * @return a ResultSet |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
70 * @see SeSqlConstruct |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
71 * @see SeQuery |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
72 */ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
73 public ResultSet executeQuery(String pTables[], String pCols[], String pWhere) throws TechnicalException { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
74 sLogger.debug("executeQuery()"); |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
75 Connection con = null; |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
76 try { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 con = getConnection(); |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
78 // SeSqlConstruct lSeSqlConstruct = new SeSqlConstruct(pTables, pWhere); |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
79 // SeQuery lSeQuery = new SeQuery(con, pCols, lSeSqlConstruct); |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
80 // long lStart = System.currentTimeMillis(); |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
81 // lSeQuery.prepareQuery(); |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
82 ResultSet lSet = null;//handleResultSet(lSeQuery); |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
83 // long lEnd = System.currentTimeMillis(); |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
84 // if (sDebug) |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
85 // sLogger.debug((new StringBuilder()).append("lSeQuery lasts ").append((double) (lEnd - lStart) / 1000D).append(" seconds").toString()); |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
86 return lSet; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 } catch (TechnicalException e) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
88 sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
89 throw e; |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
90 } catch (Exception e) { |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
91 sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
92 throw new TechnicalException("Error during executeQuery", e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
93 } finally { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
94 returnConnection(con); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
95 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
96 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
97 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
98 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
99 /** |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
100 * Execute a query against a sde datasource. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
101 * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
102 * |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
103 * @param pSQLStatement the SQL-Statement to be executed. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
104 * @return a ResultSet |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
105 * @see SeQuery |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
106 */ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
107 public ResultSet executeQuery(String pSQLStatement) throws TechnicalException { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
108 if (sDebug) sLogger.debug("executeQuery():\n" + pSQLStatement); |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
109 Connection con = null; |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
110 try { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
111 con = getConnection(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
112 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
113 |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
114 long lStart = System.currentTimeMillis(); |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
115 |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
116 Statement stmt = con.createStatement(); |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
117 java.sql.ResultSet rs = stmt.executeQuery(pSQLStatement); |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
118 |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
119 long lEnd = System.currentTimeMillis(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
120 if (sDebug) |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
121 sLogger.debug((new StringBuilder()).append("lSeQuery lasts ").append((double) (lEnd - lStart) / 1000D).append(" seconds").toString()); |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
122 return (ResultSet)rs; |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
123 } catch (TechnicalException e) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
124 sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
125 throw e; |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
126 } catch (Exception e) { |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
127 sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
128 throw new TechnicalException("Error during executeQuery", e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
129 } finally { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
130 returnConnection(con); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
131 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
132 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
133 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
134 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
135 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
136 // /** |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
137 // * Execute a query against a sde datasource. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
138 // * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
139 // * |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
140 // * @param pSQLStatement the SQL-Statement to be executed. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
141 // * @return File |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
142 // * @see SeQuery |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
143 // */ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
144 // public TempFile executeQueryDiagram (String pSQLStatement) throws TechnicalException { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
145 // if (sDebug) sLogger.debug("executeQueryDiagram():\n" + pSQLStatement); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
146 // SeConnection con = null; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
147 // TempFile lImageFile = null; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
148 // try { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
149 // con = getConnection(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
150 // |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
151 // SeQuery lSeQuery = new SeQuery(con); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
152 // long lStart = System.currentTimeMillis(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
153 // lSeQuery.prepareSql(pSQLStatement); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
154 // lSeQuery.execute(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
155 // |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
156 // //ResultSet lSet = handleResultSet(lSeQuery); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
157 // lImageFile = handleRowToCSVFile(lSeQuery); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
158 // |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
159 // |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
160 // long lEnd = System.currentTimeMillis(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
161 // if (sDebug) |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
162 // sLogger.debug((new StringBuilder()).append("lSeQuery lasts ").append((double) (lEnd - lStart) / 1000D).append(" seconds").toString()); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
163 // |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
164 // } catch (TechnicalException e) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
165 // sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
166 // throw e; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
167 // } catch (SeException e) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
168 // sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
169 // throw new TechnicalException("Error during executeQuery", e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
170 // } finally { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
171 // returnConnection(con); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
172 // } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
173 // return lImageFile; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
174 // |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
175 // } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
176 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
177 /** |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
178 * Execute a spatial query against a sde datasource. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
179 * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
180 * // todo: there is work needed to fully implement the wanted functionality. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
181 * |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
182 * @param pLayername |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
183 * @param pSpatialColumnName |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
184 * @param pPoints |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
185 * @param pReturnFields |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
186 * @return a ResultSet |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
187 * @see SeShapeFilter |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
188 * @see SeQuery |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
189 */ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
190 public ResultSet executeQuery(String pLayername, String pSpatialColumnName, double[][] pPoints, String[] pReturnFields) throws TechnicalException { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
191 sLogger.debug("executeQuery()"); |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
192 Connection con = null; |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
193 try { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
194 con = getConnection(); |
546
210716612c30
Removed Encodingerrors from listed Files. All Files are now UTF-8 compliant.
Tim Englich <tim.englich@intevation.de>
parents:
143
diff
changeset
|
195 return null; |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
196 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
197 } catch (TechnicalException e) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
198 sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
199 throw e; |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
200 } catch (Exception e) { |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
201 sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
202 throw new TechnicalException("Error accessing Spatial Database: " + e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
203 } finally { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
204 returnConnection(con); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
205 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
206 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
207 /** |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
208 * Execute a spatial query against a sde datasource. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
209 * This Query method is responsible for getting and returning a valid {@link SeConnection}-Object. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
210 * // todo: there is work needed to fully implement the wanted functionality. |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
211 * |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
212 * @param pLayername |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
213 * @param pSpatialColumnName |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
214 * @param pPoints |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
215 * @param pReturnFields |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
216 * @return a ResultSet |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
217 * @see SeShapeFilter |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
218 * @see SeQuery |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
219 */ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
220 public ResultSet executeQuery(String pLayername, String pSpatialColumnName, String pWhere, double[][] pPoints, String[] pReturnFields) throws TechnicalException { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
221 sLogger.debug("executeQuery()"); |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
222 Connection con = null; |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
223 try { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
224 con = getConnection(); |
546
210716612c30
Removed Encodingerrors from listed Files. All Files are now UTF-8 compliant.
Tim Englich <tim.englich@intevation.de>
parents:
143
diff
changeset
|
225 return null; |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
226 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
227 } catch (TechnicalException e) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
228 sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
229 throw e; |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
230 } catch (Exception e) { |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
231 sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
232 throw new TechnicalException("Error accessing Spatial Database: " + e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
233 } finally { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
234 returnConnection(con); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
235 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
236 } |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
237 private Connection getConnection() throws TechnicalException { |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
238 Connection connection = connectionPool.getConnection(connectionID); |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
239 return connection; |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
240 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
241 |
130
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
242 private void returnConnection(Connection connection) { |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
243 try { |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
244 this.connectionPool.closeConnection(connection); |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
245 } catch (ConnectionException e) { |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
246 sLogger.error(e,e); |
e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
Tim Englich <tim.englich@intevation.de>
parents:
129
diff
changeset
|
247 } |
129
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
248 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
249 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
250 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
251 private ResultSet handleResultSet(SeQuery pSeQuery) throws SeException { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
252 sLogger.debug("handleResultSet()"); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
253 SDEResultSet lSet = new SDEResultSet(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
254 SeRow row; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
255 int lCount; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
256 for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
257 // one time execution |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
258 if (lCount == 0) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
259 // analyze cols of result set |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
260 SeColumnDefinition[] lCols = row.getColumns(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
261 for (SeColumnDefinition lCol : lCols) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
262 lSet.addCol(new ColDefinition(lCol.getName(), lCol.getType()));// notice: esri-types have been copied into colDefinition class! |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
263 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
264 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
265 short lNumCols = row.getNumColumns(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
266 Row lBackingRow = new Row(lNumCols); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
267 for (int i = 0; i < lNumCols; i++) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
268 lBackingRow.addObject(row.getObject(i), i); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
269 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
270 lSet.addRow(lBackingRow); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
271 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
272 pSeQuery.close(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
273 return lSet; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
274 } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
275 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
276 // private TempFile handleRowToCSVFile(SeQuery pSeQuery) throws SeException { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
277 // sLogger.debug("handleRowToTempFile()"); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
278 // TempFile lImageFile = TemporaryFileDirectory.getInstance().createFile(".csv"); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
279 // sLogger.debug("handleRowToTempFile() erstellen " + lImageFile.getFile().getName()); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
280 // CSVWriter writer = null; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
281 // ColDefinition[] lColDefinitions = null; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
282 // |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
283 // SeRow row; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
284 // int lCount; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
285 // try { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
286 // writer = new CSVWriter(new FileWriter(lImageFile.getFile()), ';'); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
287 // for (lCount = 0; (row = pSeQuery.fetch()) != null; lCount++) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
288 // // one time execution |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
289 // if (lCount == 0) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
290 // lColDefinitions = new ColDefinition[row.getNumColumns()]; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
291 // // analyze cols of result set |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
292 // SeColumnDefinition[] lCols = row.getColumns(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
293 // int j = 0; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
294 // for (SeColumnDefinition lCol : lCols) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
295 // lColDefinitions[j] = new ColDefinition(lCol.getName(), lCol.getType()); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
296 // j = j + 1; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
297 // } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
298 // } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
299 // short lNumCols = row.getNumColumns(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
300 // Row lBackingRow = new Row(lNumCols); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
301 // for (int i = 0; i < lNumCols; i++) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
302 // lBackingRow.addObject(row.getObject(i), i); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
303 // } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
304 // |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
305 // writer.writeRow(lBackingRow,lColDefinitions, false); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
306 // } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
307 // } catch (IOException e) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
308 // sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
309 // } catch (TechnicalException e) { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
310 // sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
311 // } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
312 // finally { |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
313 // pSeQuery.close(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
314 // try{ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
315 // writer.close(); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
316 // } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
317 // catch (Exception e){ |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
318 // sLogger.error(e.getMessage(), e); |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
319 // } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
320 // } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
321 // |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
322 // return lImageFile; |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
323 // } |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
324 |
110e3ac1b7d2
Library Dependencies Added to pom.xml-File
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
325 } |