Revision 1774 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/ProjectTable.java
ProjectTable.java | ||
---|---|---|
40 | 40 |
*/ |
41 | 41 |
package com.iver.cit.gvsig.project; |
42 | 42 |
|
43 |
import com.hardcode.driverManager.DriverLoadException; |
|
43 |
import java.text.DateFormat; |
|
44 |
import java.util.Date; |
|
44 | 45 |
|
46 |
import com.hardcode.driverManager.DriverLoadException; |
|
45 | 47 |
import com.hardcode.gdbms.engine.data.DataSource; |
46 | 48 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
47 |
import com.hardcode.gdbms.engine.data.DataSourceFactory.DBDriverInfo; |
|
48 |
import com.hardcode.gdbms.engine.data.DataSourceFactory.DriverInfo; |
|
49 |
import com.hardcode.gdbms.engine.data.DataSourceFactory.FileDriverInfo; |
|
50 |
import com.hardcode.gdbms.engine.data.FileDriver; |
|
51 | 49 |
import com.hardcode.gdbms.engine.data.NoSuchTableException; |
52 |
|
|
50 |
import com.hardcode.gdbms.engine.data.ReadDriver; |
|
51 |
import com.hardcode.gdbms.parser.ParseException; |
|
53 | 52 |
import com.iver.andami.PluginServices; |
54 | 53 |
import com.iver.cit.gvsig.fmap.DriverException; |
55 | 54 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
55 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
|
56 | 56 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
57 | 57 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
58 | 58 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
59 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.SingleLayer; |
|
60 |
|
|
61 | 59 |
import com.iver.utiles.XMLEntity; |
62 | 60 |
|
63 |
import java.text.DateFormat; |
|
64 | 61 |
|
65 |
import java.util.Date; |
|
66 |
|
|
67 |
|
|
68 | 62 |
/** |
69 | 63 |
* Tabla del proyecto |
70 | 64 |
* |
... | ... | |
170 | 164 |
xml.putProperty("numTables", numTables); |
171 | 165 |
xml.addChild(modelo.getXMLEntity()); |
172 | 166 |
|
173 |
DriverInfo di = DataSourceFactory.getDriverInfo(modelo.getName()); |
|
174 |
xml.putProperty("gdbmsname", di.name); |
|
175 |
xml.putProperty("dbms", di.dbms); |
|
167 |
Object di = LayerFactory.getDataSourceFactory().getDriverInfo(modelo.getName()); |
|
176 | 168 |
|
177 | 169 |
if (associatedTable != null) { |
178 | 170 |
xml.putProperty("layerName", ((FLayer) associatedTable).getName()); |
... | ... | |
180 | 172 |
project.getView((FLayer) associatedTable)); |
181 | 173 |
} |
182 | 174 |
|
183 |
if (di instanceof DataSourceFactory.PersistentFileDriverInfo) {
|
|
184 |
DataSourceFactory.PersistentFileDriverInfo pfdi = (DataSourceFactory.PersistentFileDriverInfo) di;
|
|
175 |
if (di instanceof ReadDriver) {
|
|
176 |
ReadDriver driver = (ReadDriver) di;
|
|
185 | 177 |
xml.putProperty("type", "sameDriverFile"); |
186 |
xml.putProperty("file", pfdi.file); |
|
187 |
} else if (di instanceof DataSourceFactory.VolatileFileDriverInfo) { |
|
188 |
DataSourceFactory.VolatileFileDriverInfo vfdi = (DataSourceFactory.VolatileFileDriverInfo) di; |
|
178 |
} else if (di instanceof DataSourceFactory.FileDriverInfo) { |
|
179 |
DataSourceFactory.FileDriverInfo vfdi = (DataSourceFactory.FileDriverInfo) di; |
|
189 | 180 |
xml.putProperty("type", "otherDriverFile"); |
181 |
xml.putProperty("gdbmsname", vfdi.name); |
|
182 |
xml.putProperty("dbms", vfdi.dbms); |
|
190 | 183 |
xml.putProperty("file", vfdi.file); |
191 | 184 |
xml.putProperty("driverName", vfdi.driverName); |
192 | 185 |
} else if (di instanceof DataSourceFactory.DBDriverInfo) { |
193 | 186 |
xml.putProperty("type", "db"); |
194 | 187 |
|
195 |
DBDriverInfo dbdi = (DBDriverInfo) di;
|
|
188 |
DataSourceFactory.DBTableDriverInfo dbdi = (DataSourceFactory.DBTableDriverInfo) di;
|
|
196 | 189 |
|
190 |
xml.putProperty("gdbmsname", dbdi.name); |
|
191 |
xml.putProperty("dbms", dbdi.dbms); |
|
197 | 192 |
xml.putProperty("host", dbdi.host); |
198 | 193 |
xml.putProperty("port", dbdi.port); |
199 | 194 |
xml.putProperty("user", dbdi.user); |
200 | 195 |
xml.putProperty("password", dbdi.password); |
201 | 196 |
xml.putProperty("dbName", dbdi.dbName); |
202 |
xml.putProperty("tableName", dbdi.sqlQuery);
|
|
197 |
xml.putProperty("tableName", dbdi.tableName);
|
|
203 | 198 |
xml.putProperty("driverInfo", dbdi.driverInfo); |
204 | 199 |
} |
205 | 200 |
|
... | ... | |
216 | 211 |
DataSource dataSource; |
217 | 212 |
|
218 | 213 |
try { |
219 |
dataSource = DataSourceFactory.createRandomDataSource(xml.getStringProperty(
|
|
214 |
dataSource = LayerFactory.getDataSourceFactory().createRandomDataSource(xml.getStringProperty(
|
|
220 | 215 |
"gdbmsname")); |
221 | 216 |
} catch (NoSuchTableException e) { |
222 | 217 |
throw new XMLException(e); |
... | ... | |
257 | 252 |
|
258 | 253 |
|
259 | 254 |
if (xml.getStringProperty("type").equals("otherDriverFile")) { |
260 |
DataSourceFactory.addFileDataSource(xml.getStringProperty(
|
|
255 |
LayerFactory.getDataSourceFactory().addFileDataSource(xml.getStringProperty(
|
|
261 | 256 |
"driverName"), xml.getStringProperty("gdbmsname"), |
262 | 257 |
xml.getStringProperty("file"), xml.getStringProperty("dbms")); |
263 | 258 |
|
... | ... | |
272 | 267 |
modelo = ((AlphanumericData) layer).getRecordset(); |
273 | 268 |
associatedTable = (AlphanumericData) layer; |
274 | 269 |
|
275 |
DataSourceFactory.addFileDataSource(xml.getStringProperty("gdbmsname"), |
|
276 |
xml.getStringProperty("file"), xml.getStringProperty("dbms"), (FileDriver) ((SingleLayer)layer).getSource().getDriver()); |
|
270 |
//DataSourceFactory.addFileDataSource(xml.getStringProperty("gdbmsname"),
|
|
271 |
//xml.getStringProperty("file"), xml.getStringProperty("dbms"), (FileDriver) ((SingleLayer)layer).getSource().getDriver());
|
|
277 | 272 |
} else if (xml.getStringProperty("type").equals("db")) { |
278 |
DataSourceFactory.addDBDataSource(xml.getStringProperty("gdbmsname"), |
|
279 |
xml.getStringProperty("host"), xml.getIntProperty("port"), |
|
280 |
xml.getStringProperty("user"), |
|
281 |
xml.getStringProperty("password"), |
|
282 |
xml.getStringProperty("dbName"), |
|
283 |
xml.getStringProperty("tableName"), |
|
284 |
xml.getStringProperty("driverInfo")); |
|
273 |
try { |
|
274 |
LayerFactory.getDataSourceFactory().addDBDataSource(xml.getStringProperty("gdbmsname"), |
|
275 |
xml.getStringProperty("host"), xml.getIntProperty("port"), |
|
276 |
xml.getStringProperty("user"), |
|
277 |
xml.getStringProperty("password"), |
|
278 |
xml.getStringProperty("dbName"), |
|
279 |
xml.getStringProperty("tableName"), null, |
|
280 |
xml.getStringProperty("driverInfo")); |
|
281 |
} catch (ParseException e) { |
|
282 |
throw new XMLException(e); |
|
283 |
} |
|
285 | 284 |
|
286 | 285 |
setSelectableDataSource(xml); |
287 | 286 |
} |
Also available in: Unified diff