Revision 1848 branches/Fmap_GisPlanet/libraries/libFMap/src/com/iver/cit/gvsig/fmap/layers/VectorialFileAdapter.java
VectorialFileAdapter.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.fmap.layers; |
42 | 42 |
|
43 |
import com.hardcode.driverManager.DriverLoadException; |
|
43 |
import java.awt.geom.Rectangle2D; |
|
44 |
import java.io.File; |
|
45 |
import java.io.IOException; |
|
44 | 46 |
|
47 |
import com.hardcode.driverManager.DriverLoadException; |
|
45 | 48 |
import com.hardcode.gdbms.engine.data.DataSource; |
46 | 49 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
47 |
import com.hardcode.gdbms.engine.data.FileDriver; |
|
48 | 50 |
import com.hardcode.gdbms.engine.data.NoSuchTableException; |
49 |
import com.hardcode.gdbms.engine.data.ReadDriver; |
|
50 |
|
|
51 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
51 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
52 |
import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
|
52 | 53 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
53 | 54 |
import com.iver.cit.gvsig.fmap.drivers.DriverIOException; |
54 | 55 |
import com.iver.cit.gvsig.fmap.drivers.ExternalData; |
... | ... | |
57 | 58 |
import com.iver.cit.gvsig.fmap.rendering.indexes.IndexNotExistsException; |
58 | 59 |
import com.iver.cit.gvsig.fmap.write.FileWriterDriver; |
59 | 60 |
|
60 |
import java.awt.geom.Rectangle2D; |
|
61 | 61 |
|
62 |
import java.io.File; |
|
63 |
import java.io.IOException; |
|
64 |
|
|
65 |
|
|
66 | 62 |
/** |
67 | 63 |
* Adapta un driver de fichero vectorial a la interfaz vectorial, manteniendo |
68 | 64 |
* adem?s el estado necesario por una capa vectorial de fichero (el nombre del |
... | ... | |
199 | 195 |
/** |
200 | 196 |
* @see com.iver.cit.gvsig.fmap.layers.VectorialAdapter#getRecordset() |
201 | 197 |
*/ |
202 |
public DataSource getRecordset(String name) throws DriverLoadException {
|
|
198 |
public DataSource getRecordset() throws DriverLoadException { |
|
203 | 199 |
try { |
204 | 200 |
if (ds == null) { |
205 | 201 |
VectorialFileDriver driver = (VectorialFileDriver) getDriver(); |
... | ... | |
209 | 205 |
File dataFile = ed.getDataFile(file); |
210 | 206 |
String driverName = ed.getDataDriverName(); |
211 | 207 |
|
212 |
DataSourceFactory.addFileDataSource(driverName, name,
|
|
213 |
dataFile.getAbsolutePath(), file.getAbsolutePath()); |
|
214 |
ds = DataSourceFactory.createRandomDataSource(name);
|
|
215 |
} else if (driver instanceof ReadDriver) {
|
|
216 |
DataSourceFactory.addDataSource((ReadDriver)driver, name);
|
|
217 |
ds = DataSourceFactory.createRandomDataSource(name);
|
|
208 |
String name = LayerFactory.getDataSourceFactory().addFileDataSource(driverName,
|
|
209 |
dataFile.getAbsolutePath(), file.getAbsolutePath(), null);
|
|
210 |
ds = LayerFactory.getDataSourceFactory().createRandomDataSource(name, DataSourceFactory.AUTOMATIC_MODE);
|
|
211 |
} else if (driver instanceof ObjectDriver) {
|
|
212 |
String name = LayerFactory.getDataSourceFactory().addDataSource((ObjectDriver)driver, null);
|
|
213 |
ds = LayerFactory.getDataSourceFactory().createRandomDataSource(name, DataSourceFactory.AUTOMATIC_MODE);
|
|
218 | 214 |
} else { |
219 | 215 |
return null; |
220 | 216 |
} |
... | ... | |
222 | 218 |
} catch (NoSuchTableException e) { |
223 | 219 |
throw new RuntimeException( |
224 | 220 |
"Error de implementaci?n, se ha a?adido una tabla y luego esa tabla no ha podido ser cargada"); |
221 |
} catch (DriverException e) { |
|
222 |
throw new RuntimeException(e); |
|
225 | 223 |
} |
226 | 224 |
|
227 | 225 |
return ds; |
Also available in: Unified diff