Mercurial > dive4elements > gnv-client
comparison geo-backend/src/main/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnection.java @ 130:e4eacd613356
Implementierung Datenzugriff auf die ArcSDE über java.sql. Methodiken
ChangeLog wird nachgereicht da SubversionClientincompatiblitäten vorhanden sind.
geo-backend/trunk@7 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Wed, 02 Sep 2009 15:15:52 +0000 |
parents | |
children | ff1b7967e6b9 |
comparison
equal
deleted
inserted
replaced
129:110e3ac1b7d2 | 130:e4eacd613356 |
---|---|
1 /** | |
2 * | |
3 */ | |
4 package de.intevation.gnv.geobackend.sde.datasources; | |
5 | |
6 import java.sql.CallableStatement; | |
7 import java.sql.Connection; | |
8 import java.sql.DatabaseMetaData; | |
9 import java.sql.PreparedStatement; | |
10 import java.sql.SQLException; | |
11 import java.sql.SQLWarning; | |
12 import java.sql.Savepoint; | |
13 import java.sql.Statement; | |
14 import java.util.Map; | |
15 | |
16 import org.apache.log4j.Logger; | |
17 | |
18 import com.esri.sde.sdk.client.SeConnection; | |
19 import com.esri.sde.sdk.client.SeException; | |
20 | |
21 import de.intevation.gnv.geobackend.base.connectionpool.exception.ConnectionException; | |
22 import de.intevation.gnv.geobackend.sde.connectionpool.ArcSDEPoolableObjectFactory; | |
23 | |
24 /** | |
25 * @author Tim Englich <tim.englich@intevation.de> | |
26 * | |
27 */ | |
28 public class ArcSDEConnection implements Connection { | |
29 | |
30 /** | |
31 * the logger, used to log exceptions and additonaly information | |
32 */ | |
33 private static Logger log = Logger.getLogger(ArcSDEPoolableObjectFactory.class); | |
34 | |
35 private SeConnection seConnection = null; | |
36 | |
37 | |
38 | |
39 /** | |
40 * Constructor | |
41 */ | |
42 public ArcSDEConnection(String server,String port,String database,String username,String credentials) throws ConnectionException { | |
43 try { | |
44 seConnection = new SeConnection(server,port,database,username,credentials); | |
45 } catch (SeException e) { | |
46 log.error(e,e); | |
47 throw new ConnectionException(e); | |
48 } | |
49 } | |
50 | |
51 /** | |
52 * @see java.sql.Connection#clearWarnings() | |
53 */ | |
54 public void clearWarnings() throws SQLException { | |
55 } | |
56 | |
57 /** | |
58 * @see java.sql.Connection#close() | |
59 */ | |
60 public void close() throws SQLException { | |
61 try { | |
62 this.seConnection.close(); | |
63 } catch (SeException e) { | |
64 log.error(e,e); | |
65 throw new SQLException(e.getMessage()); | |
66 } | |
67 } | |
68 | |
69 /** | |
70 * @see java.sql.Connection#commit() | |
71 */ | |
72 public void commit() throws SQLException { | |
73 try{ | |
74 this.seConnection.commitTransaction(); | |
75 } catch (SeException e) { | |
76 log.error(e,e); | |
77 throw new SQLException(e.getMessage()); | |
78 } | |
79 } | |
80 | |
81 /** | |
82 * @see java.sql.Connection#createStatement() | |
83 */ | |
84 public Statement createStatement() throws SQLException { | |
85 | |
86 return new ArcSDEStatement(this); | |
87 } | |
88 | |
89 /** | |
90 * @see java.sql.Connection#createStatement(int, int) | |
91 */ | |
92 public Statement createStatement(int resultSetType, int resultSetConcurrency) | |
93 throws SQLException { | |
94 // TODO: Übergabeparameter beachten | |
95 return new ArcSDEStatement(this); | |
96 } | |
97 | |
98 /** | |
99 * @see java.sql.Connection#createStatement(int, int, int) | |
100 */ | |
101 public Statement createStatement(int resultSetType, | |
102 int resultSetConcurrency, int resultSetHoldability) | |
103 throws SQLException { | |
104 // TODO: Übergabeparameter beachtenbb | |
105 return new ArcSDEStatement(this); | |
106 } | |
107 | |
108 /** | |
109 * @see java.sql.Connection#getAutoCommit() | |
110 */ | |
111 public boolean getAutoCommit() throws SQLException { | |
112 return false; | |
113 } | |
114 | |
115 /** | |
116 * @see java.sql.Connection#getCatalog() | |
117 */ | |
118 public String getCatalog() throws SQLException { | |
119 | |
120 return null; | |
121 } | |
122 | |
123 /** | |
124 * @see java.sql.Connection#getHoldability() | |
125 */ | |
126 public int getHoldability() throws SQLException { | |
127 | |
128 return 0; | |
129 } | |
130 | |
131 /** | |
132 * @see java.sql.Connection#getMetaData() | |
133 */ | |
134 public DatabaseMetaData getMetaData() throws SQLException { | |
135 | |
136 return null; | |
137 } | |
138 | |
139 /** | |
140 * @see java.sql.Connection#getTransactionIsolation() | |
141 */ | |
142 public int getTransactionIsolation() throws SQLException { | |
143 | |
144 return 0; | |
145 } | |
146 | |
147 /** | |
148 * @see java.sql.Connection#getTypeMap() | |
149 */ | |
150 public Map<String, Class<?>> getTypeMap() throws SQLException { | |
151 | |
152 return null; | |
153 } | |
154 | |
155 /** | |
156 * @see java.sql.Connection#getWarnings() | |
157 */ | |
158 public SQLWarning getWarnings() throws SQLException { | |
159 | |
160 return null; | |
161 } | |
162 | |
163 /** | |
164 * @see java.sql.Connection#isClosed() | |
165 */ | |
166 public boolean isClosed() throws SQLException { | |
167 try{ | |
168 return this.seConnection.isClosed(); | |
169 } catch (Exception e) { | |
170 log.error(e,e); | |
171 throw new SQLException(e.getMessage()); | |
172 } | |
173 } | |
174 | |
175 /** | |
176 * @see java.sql.Connection#isReadOnly() | |
177 */ | |
178 public boolean isReadOnly() throws SQLException { | |
179 return false; | |
180 } | |
181 | |
182 /** | |
183 * @see java.sql.Connection#nativeSQL(java.lang.String) | |
184 */ | |
185 public String nativeSQL(String sql) throws SQLException { | |
186 return null; | |
187 } | |
188 | |
189 /** | |
190 * @see java.sql.Connection#prepareCall(java.lang.String) | |
191 */ | |
192 public CallableStatement prepareCall(String sql) throws SQLException { | |
193 return null; | |
194 } | |
195 | |
196 /** | |
197 * @see java.sql.Connection#prepareCall(java.lang.String, int, int) | |
198 */ | |
199 public CallableStatement prepareCall(String sql, int resultSetType, | |
200 int resultSetConcurrency) throws SQLException { | |
201 return null; | |
202 } | |
203 | |
204 /** | |
205 * @see java.sql.Connection#prepareCall(java.lang.String, int, int, int) | |
206 */ | |
207 public CallableStatement prepareCall(String sql, int resultSetType, | |
208 int resultSetConcurrency, int resultSetHoldability) | |
209 throws SQLException { | |
210 | |
211 return null; | |
212 } | |
213 | |
214 /** | |
215 * @see java.sql.Connection#prepareStatement(java.lang.String) | |
216 */ | |
217 public PreparedStatement prepareStatement(String sql) throws SQLException { | |
218 | |
219 return null; | |
220 } | |
221 | |
222 /** | |
223 * @see java.sql.Connection#prepareStatement(java.lang.String, int) | |
224 */ | |
225 public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) | |
226 throws SQLException { | |
227 | |
228 return null; | |
229 } | |
230 | |
231 /** | |
232 * @see java.sql.Connection#prepareStatement(java.lang.String, int[]) | |
233 */ | |
234 public PreparedStatement prepareStatement(String sql, int[] columnIndexes) | |
235 throws SQLException { | |
236 | |
237 return null; | |
238 } | |
239 | |
240 /** | |
241 * @see java.sql.Connection#prepareStatement(java.lang.String, java.lang.String[]) | |
242 */ | |
243 public PreparedStatement prepareStatement(String sql, String[] columnNames) | |
244 throws SQLException { | |
245 | |
246 return null; | |
247 } | |
248 | |
249 /** | |
250 * @see java.sql.Connection#prepareStatement(java.lang.String, int, int) | |
251 */ | |
252 public PreparedStatement prepareStatement(String sql, int resultSetType, | |
253 int resultSetConcurrency) throws SQLException { | |
254 | |
255 return null; | |
256 } | |
257 | |
258 /** | |
259 * @see java.sql.Connection#prepareStatement(java.lang.String, int, int, int) | |
260 */ | |
261 public PreparedStatement prepareStatement(String sql, int resultSetType, | |
262 int resultSetConcurrency, int resultSetHoldability) | |
263 throws SQLException { | |
264 | |
265 return null; | |
266 } | |
267 | |
268 /** | |
269 * @see java.sql.Connection#releaseSavepoint(java.sql.Savepoint) | |
270 */ | |
271 public void releaseSavepoint(Savepoint savepoint) throws SQLException { | |
272 } | |
273 | |
274 /** | |
275 * @see java.sql.Connection#rollback() | |
276 */ | |
277 public void rollback() throws SQLException { | |
278 try { | |
279 this.seConnection.rollbackTransaction(); | |
280 } catch (SeException e) { | |
281 log.error(e,e); | |
282 throw new SQLException(e.getMessage()); | |
283 } | |
284 } | |
285 | |
286 /** | |
287 * @see java.sql.Connection#rollback(java.sql.Savepoint) | |
288 */ | |
289 public void rollback(Savepoint savepoint) throws SQLException { | |
290 this.rollback(); | |
291 } | |
292 | |
293 /** | |
294 * @see java.sql.Connection#setAutoCommit(boolean) | |
295 */ | |
296 public void setAutoCommit(boolean autoCommit) throws SQLException { | |
297 } | |
298 | |
299 /** | |
300 * @see java.sql.Connection#setCatalog(java.lang.String) | |
301 */ | |
302 public void setCatalog(String catalog) throws SQLException { | |
303 } | |
304 | |
305 /** | |
306 * @see java.sql.Connection#setHoldability(int) | |
307 */ | |
308 public void setHoldability(int holdability) throws SQLException { | |
309 } | |
310 | |
311 /** | |
312 * @see java.sql.Connection#setReadOnly(boolean) | |
313 */ | |
314 public void setReadOnly(boolean readOnly) throws SQLException { | |
315 } | |
316 | |
317 /** | |
318 * @see java.sql.Connection#setSavepoint() | |
319 */ | |
320 public Savepoint setSavepoint() throws SQLException { | |
321 | |
322 return null; | |
323 } | |
324 | |
325 /** | |
326 * @see java.sql.Connection#setSavepoint(java.lang.String) | |
327 */ | |
328 public Savepoint setSavepoint(String name) throws SQLException { | |
329 | |
330 return null; | |
331 } | |
332 | |
333 /** | |
334 * @see java.sql.Connection#setTransactionIsolation(int) | |
335 */ | |
336 public void setTransactionIsolation(int level) throws SQLException { | |
337 } | |
338 | |
339 /** | |
340 * @see java.sql.Connection#setTypeMap(java.util.Map) | |
341 */ | |
342 public void setTypeMap(Map<String, Class<?>> map) throws SQLException { | |
343 } | |
344 | |
345 /** | |
346 * @return the seConnection | |
347 */ | |
348 public SeConnection getSeConnection() { | |
349 return seConnection; | |
350 } | |
351 | |
352 } |