Revision 11006
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/SelectableDataSource.java | ||
---|---|---|
90 | 90 |
*/ |
91 | 91 |
public SelectableDataSource(DataSource ds) throws DriverException { |
92 | 92 |
dataSource = ds; |
93 |
dataSource.start(); |
|
93 |
// CHEMA: No deberiamos abrir el dataSource porque si |
|
94 |
// Lo tiene que hacer quien lo va a usar |
|
95 |
//dataSource.start(); |
|
96 |
|
|
94 | 97 |
// Creamos el mapping de campos externos que no muestran el PK. |
95 | 98 |
mapExternalFields(); |
96 | 99 |
|
... | ... | |
102 | 105 |
* @throws DriverException |
103 | 106 |
*/ |
104 | 107 |
public void mapExternalFields() throws DriverException { |
108 |
//CHEMA: Abrimos y cerramos el dataSource para preparar |
|
109 |
// el mapping |
|
110 |
this.dataSource.start(); |
|
105 | 111 |
int numExternalFields = 0; |
106 | 112 |
for (int i=0; i < dataSource.getFieldCount(); i++) |
107 | 113 |
{ |
... | ... | |
118 | 124 |
mapping[j++] = i; |
119 | 125 |
|
120 | 126 |
} |
127 |
this.dataSource.stop(); |
|
121 | 128 |
} |
122 | 129 |
|
123 | 130 |
public static SelectableDataSource createSelectableDataSource(XMLEntity xml) throws NoSuchTableException, ParseException, DriverLoadException, DriverException, SemanticException, IOException, XMLException{ |
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/VectorialFileAdapter.java | ||
---|---|---|
105 | 105 |
try { |
106 | 106 |
if (reference_count == 0) |
107 | 107 |
{ |
108 |
getFileDriver().open(file); |
|
108 |
//System.out.println("====" + hashCode() + " Abrir el fichero: ["+ reference_count + "]"+ file.getAbsolutePath() ); |
|
109 |
getFileDriver().open(file); |
|
109 | 110 |
|
110 | 111 |
if (!driverInitialized) { |
111 | 112 |
getFileDriver().initialize(); |
112 | 113 |
driverInitialized = true; |
113 | 114 |
} |
115 |
getRecordset().start(); |
|
114 | 116 |
} |
115 | 117 |
reference_count++; |
116 | 118 |
|
117 | 119 |
} catch (IOException e) { |
118 | 120 |
throw new DriverIOException(e); |
121 |
} catch (DriverException e) { |
|
122 |
// TODO Auto-generated catch block |
|
123 |
throw new DriverIOException(e); |
|
119 | 124 |
} |
120 | 125 |
} |
121 | 126 |
|
... | ... | |
127 | 132 |
*/ |
128 | 133 |
public synchronized void stop() throws DriverIOException { |
129 | 134 |
try { |
130 |
if (reference_count == 0)
|
|
135 |
if (reference_count == 1)
|
|
131 | 136 |
{ |
137 |
//System.out.println("====" + hashCode() + " Cerrar el fichero: ["+ reference_count + "]"+ file.getAbsolutePath() ); |
|
132 | 138 |
getFileDriver().close(); |
139 |
getRecordset().stop(); |
|
133 | 140 |
} |
134 | 141 |
else |
135 | 142 |
if (reference_count < 0) |
... | ... | |
138 | 145 |
reference_count--; |
139 | 146 |
} catch (IOException e) { |
140 | 147 |
throw new DriverIOException(e); |
148 |
} catch (DriverLoadException e) { |
|
149 |
// TODO Auto-generated catch block |
|
150 |
e.printStackTrace(); |
|
151 |
} catch (DriverException e) { |
|
152 |
// TODO Auto-generated catch block |
|
153 |
e.printStackTrace(); |
|
141 | 154 |
} |
142 | 155 |
} |
143 | 156 |
|
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrVect.java | ||
---|---|---|
1162 | 1162 |
|
1163 | 1163 |
// /vea.setSpatialIndex(getSpatialIndex()); |
1164 | 1164 |
// /vea.setFullExtent(getFullExtent()); |
1165 |
//CHEMA |
|
1166 |
vea.start(); |
|
1167 |
//CHEMA |
|
1165 | 1168 |
vea.startEdition(EditionEvent.GRAPHIC); |
1166 | 1169 |
setSource(vea); |
1167 | 1170 |
getRecordset().setSelectionSupport( |
... | ... | |
1170 | 1173 |
|
1171 | 1174 |
} else { |
1172 | 1175 |
VectorialEditableAdapter vea = (VectorialEditableAdapter) getSource(); |
1176 |
//CHEMA |
|
1177 |
vea.stop(); |
|
1178 |
//CHEMA |
|
1173 | 1179 |
setSource(vea.getOriginalAdapter()); |
1174 | 1180 |
} |
1175 | 1181 |
// Si tenemos una leyenda, hay que pegarle el cambiazo a su |
... | ... | |
1205 | 1211 |
} catch (FieldNotFoundException e) { |
1206 | 1212 |
e.printStackTrace(); |
1207 | 1213 |
throw new EditionException(e); |
1214 |
//CHEMA |
|
1215 |
} catch (DriverIOException e) { |
|
1216 |
e.printStackTrace(); |
|
1217 |
throw new EditionException(e); |
|
1218 |
//CHEMA |
|
1208 | 1219 |
} |
1209 | 1220 |
|
1210 | 1221 |
setSpatialCacheEnabled(b); |
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/VectorialDBAdapter.java | ||
---|---|---|
80 | 80 |
*/ |
81 | 81 |
public void start() { |
82 | 82 |
try { |
83 |
//System.out.println("====" +this.hashCode()+" Abrir tabla: " + ((VectorialDatabaseDriver)driver).getTableName()); |
|
83 | 84 |
((VectorialDatabaseDriver)driver).open(); |
84 | 85 |
} catch (DriverException e) { |
85 | 86 |
// TODO Auto-generated catch block |
... | ... | |
92 | 93 |
* al driver que cierre la conexion con el servidor de base de datos |
93 | 94 |
*/ |
94 | 95 |
public void stop() { |
96 |
//System.out.println("====" +this.hashCode()+" Cerrar tabla: " + ((VectorialDatabaseDriver)driver).getTableName()); |
|
95 | 97 |
((VectorialDatabaseDriver)driver).close(); |
96 | 98 |
} |
97 | 99 |
|
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/FLyrAnnotation.java | ||
---|---|---|
315 | 315 |
try { |
316 | 316 |
ReadableVectorial adapter = getSource(); |
317 | 317 |
adapter.start(); |
318 |
ds.start(); |
|
318 |
if (isJoined()){ |
|
319 |
ds.start(); |
|
320 |
} |
|
319 | 321 |
int sc; |
320 | 322 |
// El mapping[0] es el text |
321 | 323 |
int fieldId = mapping.getColumnText(); |
... | ... | |
449 | 451 |
} |
450 | 452 |
} |
451 | 453 |
|
452 |
ds.stop(); |
|
454 |
if (this.isJoined()){ |
|
455 |
ds.stop(); |
|
456 |
} |
|
453 | 457 |
adapter.stop(); |
454 | 458 |
} catch (DriverIOException e) { |
455 | 459 |
e.printStackTrace(); |
branches/v10/libraries/libFMap/src/com/iver/cit/gvsig/fmap/operations/strategies/ShpStrategy.java | ||
---|---|---|
160 | 160 |
|
161 | 161 |
long t1 = System.currentTimeMillis(); |
162 | 162 |
// logger.debug("getCapa().getRecordset().start()"); |
163 |
((FLyrVect) getCapa()).getRecordset().start(); |
|
163 |
|
|
164 |
//CHEMA |
|
165 |
// En teorioa el al hacer el adapter.start() |
|
166 |
// deja abierta las fuentes de datos |
|
167 |
// geometrica y alfanumerica (cuando no son la misma |
|
168 |
// excepto cuando se ha hecho una operacion de 'join' de la tabla |
|
169 |
// (join de las tablas de gvsig(gdbms) no join de sql), entoces |
|
170 |
// el origen alfanumerico no es el mismo en el source |
|
171 |
// que en la capa. |
|
172 |
// |
|
173 |
//((FLyrVect) getCapa()).getRecordset().start(); |
|
174 |
if (lyr.isJoined()){ |
|
175 |
lyr.getRecordset().start(); |
|
176 |
} |
|
177 |
//CHEMA |
|
164 | 178 |
|
165 | 179 |
// TODO: A revisar si es o no conveniente este sistema |
166 | 180 |
// de comunicaci?n con los drivers. |
... | ... | |
326 | 340 |
} |
327 | 341 |
|
328 | 342 |
// logger.debug("getCapa().getRecordset().stop()"); |
329 |
((FLyrVect) getCapa()).getSource().getRecordset().stop(); |
|
343 |
//CHEMA |
|
344 |
// Cerramos la fuente alfanumerica cuando se ha hecho |
|
345 |
// una operacion de 'join' |
|
346 |
//((FLyrVect) getCapa()).getSource().getRecordset().stop(); |
|
347 |
if (lyr.isJoined()){ |
|
348 |
lyr.getRecordset().stop(); |
|
349 |
} |
|
350 |
//CHEMA |
|
330 | 351 |
|
331 | 352 |
long t2 = System.currentTimeMillis(); |
332 | 353 |
// logger.debug("adapter.stop()"); |
... | ... | |
399 | 420 |
|
400 | 421 |
long t1 = System.currentTimeMillis(); |
401 | 422 |
// logger.debug("getCapa().getRecordset().start()"); |
402 |
((AlphanumericData) getCapa()).getRecordset().start(); |
|
403 |
|
|
423 |
|
|
424 |
//CHEMA |
|
425 |
// En teorioa el al hacer el adapter.start() |
|
426 |
// deja abierta las fuentes de datos |
|
427 |
// geometrica y alfanumerica (cuando no son la misma |
|
428 |
// excepto cuando se ha hecho una operacion de 'join' de la tabla |
|
429 |
// (join de las tablas de gvsig(gdbms) no join de sql), entoces |
|
430 |
// el origen alfanumerico no es el mismo en el source |
|
431 |
// que en la capa. |
|
432 |
// |
|
433 |
//((FLyrVect) getCapa()).getRecordset().start(); |
|
434 |
if (lyr.isJoined()){ |
|
435 |
lyr.getRecordset().start(); |
|
436 |
} |
|
437 |
//CHEMA |
|
438 |
|
|
439 |
|
|
404 | 440 |
// TODO: A revisar si es o no conveniente este sistema |
405 | 441 |
// de comunicaci?n con los drivers. |
406 | 442 |
DriverAttributes attr = adapter.getDriverAttributes(); |
... | ... | |
476 | 512 |
} |
477 | 513 |
|
478 | 514 |
// logger.debug("getCapa().getRecordset().stop()"); |
479 |
((AlphanumericData) getCapa()).getRecordset().stop(); |
|
515 |
//CHEMA |
|
516 |
// Cerramos la fuente alfanumerica cuando se ha hecho |
|
517 |
// una operacion de 'join' |
|
518 |
//((FLyrVect) getCapa()).getSource().getRecordset().stop(); |
|
519 |
if (lyr.isJoined()){ |
|
520 |
lyr.getRecordset().stop(); |
|
521 |
} |
|
522 |
//CHEMA |
|
480 | 523 |
|
481 | 524 |
long t2 = System.currentTimeMillis(); |
482 | 525 |
// logger.debug("adapter.stop()"); |
Also available in: Unified diff