svn-gvsig-desktop / trunk / libraries / libFMap / src / com / iver / cit / gvsig / fmap / drivers / DefaultDBDriver.java @ 3472
History | View | Annotate | Download (20.4 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
18 |
*
|
19 |
* For more information, contact:
|
20 |
*
|
21 |
* Generalitat Valenciana
|
22 |
* Conselleria d'Infraestructures i Transport
|
23 |
* Av. Blasco Ib??ez, 50
|
24 |
* 46010 VALENCIA
|
25 |
* SPAIN
|
26 |
*
|
27 |
* +34 963862235
|
28 |
* gvsig@gva.es
|
29 |
* www.gvsig.gva.es
|
30 |
*
|
31 |
* or
|
32 |
*
|
33 |
* IVER T.I. S.A
|
34 |
* Salamanca 50
|
35 |
* 46005 Valencia
|
36 |
* Spain
|
37 |
*
|
38 |
* +34 963163400
|
39 |
* dac@iver.es
|
40 |
*/
|
41 |
package com.iver.cit.gvsig.fmap.drivers; |
42 |
|
43 |
import java.awt.geom.Rectangle2D; |
44 |
import java.io.IOException; |
45 |
import java.net.NoRouteToHostException; |
46 |
import java.sql.Connection; |
47 |
import java.sql.DatabaseMetaData; |
48 |
import java.sql.Driver; |
49 |
import java.sql.DriverManager; |
50 |
import java.sql.ResultSet; |
51 |
import java.sql.ResultSetMetaData; |
52 |
import java.sql.SQLException; |
53 |
import java.sql.Statement; |
54 |
import java.sql.Types; |
55 |
import java.util.Hashtable; |
56 |
import java.util.StringTokenizer; |
57 |
|
58 |
import javax.swing.JDialog; |
59 |
|
60 |
import org.apache.log4j.Logger; |
61 |
|
62 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
63 |
import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
64 |
import com.hardcode.gdbms.engine.values.IntValue; |
65 |
import com.hardcode.gdbms.engine.values.Value; |
66 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
67 |
import com.iver.cit.gvsig.fmap.DriverException; |
68 |
import com.iver.cit.gvsig.fmap.Messages; |
69 |
import com.iver.cit.gvsig.fmap.core.FShape; |
70 |
import com.iver.cit.gvsig.fmap.core.IFeature; |
71 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
72 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
73 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
74 |
import com.iver.utiles.XMLEntity; |
75 |
import com.iver.utiles.swing.JPasswordDlg; |
76 |
|
77 |
|
78 |
|
79 |
/**
|
80 |
* Clase abstracta qu
|
81 |
*/
|
82 |
public abstract class DefaultDBDriver implements VectorialJDBCDriver, ObjectDriver { |
83 |
private static Logger logger = Logger.getLogger(SelectableDataSource.class.getName()); |
84 |
private static Hashtable poolPassw = new Hashtable(); |
85 |
|
86 |
protected Connection conn; |
87 |
// protected String tableName;
|
88 |
// protected String whereClause;
|
89 |
// protected String fields;
|
90 |
// protected String sqlOrig;
|
91 |
private DBLayerDefinition lyrDef = null; |
92 |
protected ResultSet rs; |
93 |
protected boolean bCursorActivo = false; |
94 |
protected Statement st; |
95 |
protected int numReg=-1; |
96 |
|
97 |
private Rectangle2D fullExtent = null; |
98 |
|
99 |
// protected String strFID_FieldName;
|
100 |
// protected String idFID_FieldName;
|
101 |
|
102 |
protected Hashtable hashRelate; |
103 |
|
104 |
|
105 |
protected ResultSetMetaData metaData = null; |
106 |
protected Rectangle2D workingArea; |
107 |
private String driverClass; |
108 |
private String userName; |
109 |
private String dbUrl; |
110 |
private String className; |
111 |
private String catalogName; |
112 |
private String tableName; |
113 |
private String[] fields; |
114 |
private String FIDfield; |
115 |
private String geometryField; |
116 |
private String whereClause; |
117 |
private String strSRID; |
118 |
|
119 |
abstract public void setData(Connection conn, DBLayerDefinition lyrDef); |
120 |
|
121 |
/**
|
122 |
* @return devuelve la Conexi?n a la base de datos, para que
|
123 |
* el usuario pueda hacer la consulta que quiera, si lo desea.
|
124 |
* Por ejemplo, esto puede ser ?til para abrir un cuadro de dialogo
|
125 |
* avanazado y lanzar peticiones del tipo "Devuelveme un buffer
|
126 |
* a las autopistas", y con el resultset que te venga, escribir
|
127 |
* un shape, o cosas as?.
|
128 |
*/
|
129 |
public Connection getConnection() |
130 |
{ |
131 |
return conn;
|
132 |
} |
133 |
public String[] getFields() |
134 |
{ |
135 |
/* StringTokenizer tokenizer = new StringTokenizer(fields, ",");
|
136 |
String[] arrayFields = new String[tokenizer.countTokens()];
|
137 |
int i=0;
|
138 |
while (tokenizer.hasMoreTokens())
|
139 |
{
|
140 |
arrayFields[i] = tokenizer.nextToken();
|
141 |
i++;
|
142 |
}
|
143 |
return arrayFields; */
|
144 |
return lyrDef.getFieldNames();
|
145 |
|
146 |
} |
147 |
/**
|
148 |
* First, the geometry field. After, the rest of fields
|
149 |
* @return
|
150 |
*/
|
151 |
public String getTotalFields() |
152 |
{ |
153 |
String strAux = getGeometryField(getLyrDef().getFieldGeometry());
|
154 |
String[] fieldNames = getLyrDef().getFieldNames(); |
155 |
for (int i=0; i< fieldNames.length; i++) |
156 |
{ |
157 |
strAux = strAux + ", " + fieldNames[i];
|
158 |
} |
159 |
return strAux;
|
160 |
} |
161 |
|
162 |
public String getWhereClause() |
163 |
{ |
164 |
return lyrDef.getWhereClause();
|
165 |
} |
166 |
public String getTableName() |
167 |
{ |
168 |
return lyrDef.getTableName();
|
169 |
} |
170 |
|
171 |
|
172 |
/**
|
173 |
* @throws DriverIOException
|
174 |
* @throws DriverException
|
175 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShapeCount()
|
176 |
*/
|
177 |
public int getShapeCount() throws IOException { |
178 |
if (numReg == -1) |
179 |
{ |
180 |
try
|
181 |
{ |
182 |
Statement s = conn.createStatement();
|
183 |
ResultSet r = s.executeQuery("SELECT COUNT(*) AS NUMREG FROM " + lyrDef.getTableName() + " " + getCompleteWhere()); |
184 |
r.next(); |
185 |
numReg = r.getInt(1);
|
186 |
System.err.println("numReg = " + numReg); |
187 |
} |
188 |
catch (SQLException e) |
189 |
{ |
190 |
throw new IOException(e.getMessage()); |
191 |
} |
192 |
} |
193 |
|
194 |
return numReg;
|
195 |
} |
196 |
|
197 |
/**
|
198 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getFullExtent()
|
199 |
*/
|
200 |
public Rectangle2D getFullExtent(){ |
201 |
// Por defecto recorremos todas las geometrias.
|
202 |
// Las bases de datos como PostGIS pueden y deben
|
203 |
// sobreescribir este m?todo.
|
204 |
if (fullExtent == null) |
205 |
{ |
206 |
try
|
207 |
{ |
208 |
IFeatureIterator itGeom = getFeatureIterator("SELECT " +
|
209 |
getGeometryField(getLyrDef().getFieldGeometry()) + " FROM " +
|
210 |
getLyrDef().getTableName() + " " + getCompleteWhere());
|
211 |
IGeometry geom; |
212 |
int cont = 0; |
213 |
while (itGeom.hasNext())
|
214 |
{ |
215 |
geom = itGeom.next().getGeometry(); |
216 |
if (cont==0) |
217 |
fullExtent = geom.getBounds2D(); |
218 |
else
|
219 |
fullExtent.add(geom.getBounds2D()); |
220 |
cont++; |
221 |
} |
222 |
} |
223 |
catch (SQLException e) |
224 |
{ |
225 |
System.err.println(e.getMessage());
|
226 |
} catch (DriverException e) {
|
227 |
// TODO Auto-generated catch block
|
228 |
e.printStackTrace(); |
229 |
} |
230 |
|
231 |
} |
232 |
return fullExtent;
|
233 |
} |
234 |
|
235 |
|
236 |
/**
|
237 |
* @see com.iver.cit.gvsig.fmap.layers.ReadableVectorial#getShapeType()
|
238 |
*/
|
239 |
public int getShapeType() { |
240 |
IGeometry geom; |
241 |
int result = FShape.MULTI;
|
242 |
try {
|
243 |
geom = getShape(0);
|
244 |
if (geom != null) |
245 |
result = geom.getGeometryType(); |
246 |
} catch (IOException e) { |
247 |
e.printStackTrace(); |
248 |
} |
249 |
return result;
|
250 |
} |
251 |
|
252 |
public int getFieldType(int idField) throws com.hardcode.gdbms.engine.data.driver.DriverException |
253 |
{ |
254 |
String str = ""; |
255 |
try {
|
256 |
int i = idField + 2; // idField viene basado en 1, y |
257 |
// adem?s nos saltamos el campo de geometry
|
258 |
str = metaData.getColumnClassName(i); |
259 |
if (metaData.getColumnType(i) == Types.VARCHAR) |
260 |
return Types.VARCHAR; |
261 |
if (metaData.getColumnType(i) == Types.FLOAT) |
262 |
return Types.FLOAT; |
263 |
if (metaData.getColumnType(i) == Types.DOUBLE) |
264 |
return Types.DOUBLE; |
265 |
if (metaData.getColumnType(i) == Types.INTEGER) |
266 |
return Types.INTEGER; |
267 |
if (metaData.getColumnType(i) == Types.BIGINT) |
268 |
return Types.BIGINT; |
269 |
if (metaData.getColumnType(i) == Types.BIT) |
270 |
return Types.BIT; |
271 |
if (metaData.getColumnType(i) == Types.DATE) |
272 |
return Types.DATE; |
273 |
if (metaData.getColumnType(i) == Types.DECIMAL) |
274 |
return Types.DOUBLE; |
275 |
if (metaData.getColumnType(i) == Types.NUMERIC) |
276 |
return Types.DOUBLE; |
277 |
|
278 |
} catch (SQLException e) { |
279 |
throw new com.hardcode.gdbms.engine.data.driver.DriverException(e); |
280 |
} |
281 |
throw new com.hardcode.gdbms.engine.data.driver.DriverException("Tipo no soportado: " + str); |
282 |
} |
283 |
/**
|
284 |
* Obtiene el valor que se encuentra en la fila y columna indicada
|
285 |
* Esta es la implementaci?n por defecto. Si lo del absolute
|
286 |
* no va bien, como es el caso del PostGis, el driver lo
|
287 |
* tiene que reimplementar
|
288 |
*
|
289 |
* @param rowIndex fila
|
290 |
* @param fieldId columna
|
291 |
*
|
292 |
* @return subclase de Value con el valor del origen de datos
|
293 |
*
|
294 |
* @throws DriverException Si se produce un error accediendo al DataSource
|
295 |
*/
|
296 |
public Value getFieldValue(long rowIndex, int idField) |
297 |
throws com.hardcode.gdbms.engine.data.driver.DriverException
|
298 |
{ |
299 |
int i = (int) (rowIndex + 1); |
300 |
int fieldId = idField+2; |
301 |
try {
|
302 |
rs.absolute(i); |
303 |
if (metaData.getColumnType(fieldId) == Types.VARCHAR) |
304 |
{ |
305 |
String strAux = rs.getString(fieldId);
|
306 |
if (strAux == null) strAux = ""; |
307 |
return ValueFactory.createValue(strAux);
|
308 |
} |
309 |
if (metaData.getColumnType(fieldId) == Types.FLOAT) |
310 |
return ValueFactory.createValue(rs.getFloat(fieldId));
|
311 |
if (metaData.getColumnType(fieldId) == Types.DOUBLE) |
312 |
return ValueFactory.createValue(rs.getDouble(fieldId));
|
313 |
if (metaData.getColumnType(fieldId) == Types.INTEGER) |
314 |
return ValueFactory.createValue(rs.getInt(fieldId));
|
315 |
if (metaData.getColumnType(fieldId) == Types.BIGINT) |
316 |
return ValueFactory.createValue(rs.getLong(fieldId));
|
317 |
if (metaData.getColumnType(fieldId) == Types.BIT) |
318 |
return ValueFactory.createValue(rs.getBoolean(fieldId));
|
319 |
if (metaData.getColumnType(fieldId) == Types.DATE) |
320 |
return ValueFactory.createValue(rs.getDate(fieldId));
|
321 |
} catch (SQLException e) { |
322 |
throw new com.hardcode.gdbms.engine.data.driver.DriverException("Tipo no soportado: columna " + fieldId ); |
323 |
} |
324 |
return null; |
325 |
|
326 |
|
327 |
} |
328 |
|
329 |
/**
|
330 |
* Obtiene el n?mero de campos del DataSource
|
331 |
*
|
332 |
* @return
|
333 |
*
|
334 |
* @throws DriverException Si se produce alg?n error accediendo al
|
335 |
* DataSource
|
336 |
*/
|
337 |
public int getFieldCount() throws com.hardcode.gdbms.engine.data.driver.DriverException |
338 |
{ |
339 |
try {
|
340 |
// Suponemos que el primer campo es el de las geometries, y no lo
|
341 |
// contamos
|
342 |
return rs.getMetaData().getColumnCount()-1; |
343 |
} catch (SQLException e) { |
344 |
throw new com.hardcode.gdbms.engine.data.driver.DriverException(e); |
345 |
} |
346 |
|
347 |
} |
348 |
|
349 |
/**
|
350 |
* Devuelve el nombre del campo fieldId-?simo
|
351 |
*
|
352 |
* @param fieldId ?ndice del campo cuyo nombre se quiere obtener
|
353 |
*
|
354 |
* @return
|
355 |
* @throws com.hardcode.gdbms.engine.data.driver.DriverException
|
356 |
*
|
357 |
* @throws DriverException Si se produce alg?n error accediendo al
|
358 |
* DataSource
|
359 |
*/
|
360 |
public String getFieldName(int fieldId) throws com.hardcode.gdbms.engine.data.driver.DriverException |
361 |
{ |
362 |
try {
|
363 |
return rs.getMetaData().getColumnName(fieldId+2); |
364 |
} catch (SQLException e) { |
365 |
throw new com.hardcode.gdbms.engine.data.driver.DriverException(e); |
366 |
} |
367 |
} |
368 |
|
369 |
/**
|
370 |
* Obtiene el n?mero de registros del DataSource
|
371 |
*
|
372 |
* @return
|
373 |
*
|
374 |
* @throws DriverException Si se produce alg?n error accediendo al
|
375 |
* DataSource
|
376 |
*/
|
377 |
public long getRowCount() |
378 |
{ |
379 |
try {
|
380 |
return getShapeCount();
|
381 |
} catch (IOException e) { |
382 |
// TODO Auto-generated catch block
|
383 |
e.printStackTrace(); |
384 |
} |
385 |
return -1; |
386 |
} |
387 |
|
388 |
public void close() |
389 |
{ |
390 |
} |
391 |
|
392 |
/**
|
393 |
* Recorre el recordset creando una tabla Hash que usaremos para
|
394 |
* relacionar el n?mero de un registro con su identificador ?nico.
|
395 |
* Debe ser llamado en el setData justo despu?s de crear el recorset
|
396 |
* principal
|
397 |
* @throws SQLException
|
398 |
*/
|
399 |
protected void doRelateID_FID() throws SQLException |
400 |
{ |
401 |
hashRelate = new Hashtable(); |
402 |
|
403 |
|
404 |
String strSQL = "SELECT " + getLyrDef().getFieldID() + " FROM " + getLyrDef().getTableName() |
405 |
+ " " + getCompleteWhere() + " ORDER BY " + getLyrDef().getFieldID(); |
406 |
Statement s = getConnection().createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); |
407 |
ResultSet r = s.executeQuery(strSQL);
|
408 |
int id=0; |
409 |
int gid;
|
410 |
int index = 0; |
411 |
while (r.next())
|
412 |
{ |
413 |
String aux = r.getString(1); |
414 |
Value val = ValueFactory.createValue(aux); |
415 |
hashRelate.put(val, new Integer(index)); |
416 |
// System.out.println("ASOCIANDO CLAVE " + aux + " CON VALOR " + index);
|
417 |
index++; |
418 |
} |
419 |
numReg = index; |
420 |
r.close(); |
421 |
// rs.beforeFirst();
|
422 |
|
423 |
} |
424 |
|
425 |
/* (non-Javadoc)
|
426 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver#getRowIndexByFID(java.lang.Object)
|
427 |
*/
|
428 |
public int getRowIndexByFID(IFeature FID) |
429 |
{ |
430 |
int resul;
|
431 |
// Object obj = FID.getAttribute(lyrDef.getIdFieldID());
|
432 |
String theId = FID.getID();
|
433 |
Value aux = ValueFactory.createValue(theId); |
434 |
// System.err.println("Mirando si existe " + obj.toString());
|
435 |
Integer rowIndex = (Integer) hashRelate.get(aux); |
436 |
resul = rowIndex.intValue(); |
437 |
// System.err.println("Row asociada a " + obj.toString() + ":" + resul);
|
438 |
return resul;
|
439 |
} |
440 |
|
441 |
/* (non-Javadoc)
|
442 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver#setXMLEntity(com.iver.utiles.XMLEntity)
|
443 |
*/
|
444 |
public void setXMLEntity(XMLEntity xml) throws XMLException |
445 |
{ |
446 |
className = xml.getStringProperty("className");
|
447 |
dbUrl = xml.getStringProperty("dbURL");
|
448 |
catalogName = xml.getStringProperty("catalog");
|
449 |
userName =xml.getStringProperty("username");
|
450 |
driverClass =xml.getStringProperty("driverclass");
|
451 |
tableName = xml.getStringProperty("tablename");
|
452 |
fields = xml.getStringArrayProperty("fields");
|
453 |
FIDfield = xml.getStringProperty("FID");
|
454 |
geometryField = xml.getStringProperty("THE_GEOM");
|
455 |
whereClause = xml.getStringProperty("whereclause");
|
456 |
strSRID = xml.getStringProperty("SRID");
|
457 |
if (xml.contains("minXworkArea")) |
458 |
{ |
459 |
double x = xml.getDoubleProperty("minXworkArea"); |
460 |
double y = xml.getDoubleProperty("minYworkArea"); |
461 |
double H = xml.getDoubleProperty("HworkArea"); |
462 |
double W = xml.getDoubleProperty("WworkArea"); |
463 |
workingArea = new Rectangle2D.Double(x,y,W,H); |
464 |
} |
465 |
|
466 |
} |
467 |
public void load() throws DriverException{ |
468 |
try {
|
469 |
Class.forName(driverClass);
|
470 |
|
471 |
String keyPool = dbUrl + "_" + userName; |
472 |
Connection newConn = null; |
473 |
String clave = null; |
474 |
if (!poolPassw.containsKey(keyPool))
|
475 |
{ |
476 |
JPasswordDlg dlg = new JPasswordDlg();
|
477 |
String strMessage = Messages.getString("conectar_jdbc"); |
478 |
String strPassword = Messages.getString("password"); |
479 |
dlg.setMessage(strMessage + " " + dbUrl + ". " + strPassword + "?"); |
480 |
dlg.show(); |
481 |
clave = dlg.getPassword(); |
482 |
if (clave == null) |
483 |
return;
|
484 |
poolPassw.put(keyPool, clave); |
485 |
} |
486 |
else
|
487 |
{ |
488 |
clave = (String) poolPassw.get(keyPool);
|
489 |
} |
490 |
newConn = DriverManager.getConnection(dbUrl, userName, clave);
|
491 |
newConn.setAutoCommit(false);
|
492 |
|
493 |
DBLayerDefinition lyrDef = new DBLayerDefinition();
|
494 |
lyrDef.setCatalogName(catalogName); |
495 |
lyrDef.setTableName(tableName); |
496 |
lyrDef.setFieldNames(fields); |
497 |
lyrDef.setFieldID(FIDfield); |
498 |
lyrDef.setFieldGeometry(geometryField); |
499 |
lyrDef.setWhereClause(whereClause); |
500 |
// lyrDef.setClassToInstantiate(driverClass);
|
501 |
if (workingArea != null) |
502 |
lyrDef.setWorkingArea(workingArea); |
503 |
|
504 |
lyrDef.setSRID_EPSG(strSRID); |
505 |
|
506 |
|
507 |
setData(newConn, lyrDef); |
508 |
} catch (ClassNotFoundException e) { |
509 |
logger.debug(e); |
510 |
throw new DriverException(e); |
511 |
} catch (SQLException e) { |
512 |
logger.debug(e); |
513 |
throw new DriverException(e); |
514 |
} |
515 |
} |
516 |
/* (non-Javadoc)
|
517 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver#getXMLEntity()
|
518 |
*/
|
519 |
public XMLEntity getXMLEntity()
|
520 |
{ |
521 |
XMLEntity xml = new XMLEntity();
|
522 |
xml.putProperty("className",this.getClass().getName()); |
523 |
try {
|
524 |
DatabaseMetaData metadata = getConnection().getMetaData();
|
525 |
xml.putProperty("dbURL", metadata.getURL());
|
526 |
xml.putProperty("catalog", getLyrDef().getCatalogName());
|
527 |
// TODO: NO DEBEMOS GUARDAR EL NOMBRE DE USUARIO Y CONTRASE?A
|
528 |
// AQUI. Hay que utilizar un pool de conexiones
|
529 |
// y pedir al usuario que conecte a la base de datos
|
530 |
// en la primera capa. En el resto, usar la conexi?n
|
531 |
// creada con anterioridad.
|
532 |
String userName = metadata.getUserName();
|
533 |
int aux = userName.indexOf("@"); |
534 |
if (aux != -1) |
535 |
userName = userName.substring(0,aux);
|
536 |
xml.putProperty("username", userName);
|
537 |
|
538 |
Driver drv = DriverManager.getDriver(metadata.getURL()); |
539 |
// System.out.println(drv.getClass().getName());
|
540 |
xml.putProperty("driverclass", drv.getClass().getName());
|
541 |
|
542 |
xml.putProperty("tablename", getTableName());
|
543 |
xml.putProperty("fields", lyrDef.getFieldNames());
|
544 |
xml.putProperty("FID", lyrDef.getFieldID());
|
545 |
xml.putProperty("THE_GEOM", lyrDef.getFieldGeometry());
|
546 |
xml.putProperty("whereclause", getWhereClause());
|
547 |
xml.putProperty("SRID", lyrDef.getSRID_EPSG());
|
548 |
if (getWorkingArea() != null) |
549 |
{ |
550 |
xml.putProperty("minXworkArea", getWorkingArea().getMinX());
|
551 |
xml.putProperty("minYworkArea", getWorkingArea().getMinY());
|
552 |
xml.putProperty("HworkArea", getWorkingArea().getHeight());
|
553 |
xml.putProperty("WworkArea", getWorkingArea().getWidth());
|
554 |
} |
555 |
|
556 |
} catch (SQLException e) { |
557 |
// TODO Auto-generated catch block
|
558 |
e.printStackTrace(); |
559 |
} |
560 |
|
561 |
|
562 |
return xml;
|
563 |
|
564 |
} |
565 |
|
566 |
/**
|
567 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialJDBCDriver#setWorkingArea(java.awt.geom.Rectangle2D)
|
568 |
*/
|
569 |
public void setWorkingArea(Rectangle2D rect) { |
570 |
this.workingArea = rect;
|
571 |
} |
572 |
|
573 |
/**
|
574 |
* @see com.iver.cit.gvsig.fmap.drivers.VectorialJDBCDriver#getWorkingArea()
|
575 |
*/
|
576 |
public Rectangle2D getWorkingArea() { |
577 |
return workingArea;
|
578 |
} |
579 |
|
580 |
/* (non-Javadoc)
|
581 |
* @see com.hardcode.gdbms.engine.data.driver.GDBMSDriver#setDataSourceFactory(com.hardcode.gdbms.engine.data.DataSourceFactory)
|
582 |
*/
|
583 |
public void setDataSourceFactory(DataSourceFactory arg0) { |
584 |
// TODO Auto-generated method stub
|
585 |
|
586 |
} |
587 |
|
588 |
/**
|
589 |
* @return Returns the lyrDef.
|
590 |
*/
|
591 |
public DBLayerDefinition getLyrDef() {
|
592 |
return lyrDef;
|
593 |
} |
594 |
|
595 |
/**
|
596 |
* @param lyrDef The lyrDef to set.
|
597 |
*/
|
598 |
public void setLyrDef(DBLayerDefinition lyrDef) { |
599 |
this.lyrDef = lyrDef;
|
600 |
} |
601 |
|
602 |
abstract public String getSqlTotal(); |
603 |
|
604 |
/**
|
605 |
* @return Returns the completeWhere. WITHOUT order by clause!!
|
606 |
*/
|
607 |
abstract public String getCompleteWhere(); |
608 |
|
609 |
|
610 |
} |