Revision 1774
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/TableOperations.java | ||
---|---|---|
55 | 55 |
import com.iver.cit.gvsig.fmap.DriverException; |
56 | 56 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
57 | 57 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
58 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
|
58 | 59 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
59 | 60 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
60 | 61 |
import com.iver.cit.gvsig.gui.Table; |
... | ... | |
136 | 137 |
*/ |
137 | 138 |
private long[] doSet(String expression) { |
138 | 139 |
try { |
139 |
DataSource ds = DataSourceFactory.executeSQL(expression);
|
|
140 |
DataSource ds = LayerFactory.getDataSourceFactory().executeSQL(expression);
|
|
140 | 141 |
|
141 | 142 |
return ds.getWhereFilter(); |
142 | 143 |
} catch (DriverLoadException e) { |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/toolListeners/LinkListener.java | ||
---|---|---|
159 | 159 |
|
160 | 160 |
boolean exist=false; |
161 | 161 |
int idField; |
162 |
try { |
|
163 |
idField = ds.getFieldIndexByName(field); |
|
164 |
if (idField != -1) |
|
165 |
{ |
|
166 |
for (int j = bitset[i].nextSetBit(0); j >= 0; |
|
167 |
j = bitset[i].nextSetBit(j + 1)) |
|
168 |
{ |
|
169 |
LinkPanel linkpanel = new LinkPanel(field, |
|
170 |
ds.getFieldValue(j, idField).toString(),ext,type); |
|
171 |
PluginServices.getMDIManager().addView(linkpanel); |
|
172 |
|
|
173 |
} |
|
174 |
} |
|
175 |
} catch (FieldNotFoundException e2) { |
|
176 |
logger.debug("Campo sin seleccionar"); |
|
177 |
} |
|
162 |
idField = ds.getFieldIndexByName(field); |
|
163 |
if (idField != -1) |
|
164 |
{ |
|
165 |
for (int j = bitset[i].nextSetBit(0); j >= 0; |
|
166 |
j = bitset[i].nextSetBit(j + 1)) |
|
167 |
{ |
|
168 |
LinkPanel linkpanel = new LinkPanel(field, |
|
169 |
ds.getFieldValue(j, idField).toString(),ext,type); |
|
170 |
PluginServices.getMDIManager().addView(linkpanel); |
|
171 |
|
|
172 |
} |
|
173 |
} |
|
178 | 174 |
|
179 | 175 |
logger.debug("ds.stop()"); |
180 | 176 |
ds.stop(); |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/project/ProjectWindow.java | ||
---|---|---|
63 | 63 |
import com.iver.andami.ui.mdiManager.ViewInfo; |
64 | 64 |
import com.iver.cit.gvsig.ProjectExtension; |
65 | 65 |
import com.iver.cit.gvsig.fmap.drivers.GeorreferencedRasterDriver; |
66 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
|
66 | 67 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
67 | 68 |
import com.iver.cit.gvsig.gui.DataBaseOpenDialog; |
68 | 69 |
import com.iver.cit.gvsig.gui.FOpenDialog; |
... | ... | |
274 | 275 |
String[] driverNames = fod.getDriverNames(); |
275 | 276 |
for (int i = 0; i < files.length; i++) { |
276 | 277 |
String name = files[i].getName(); |
277 |
DataSourceFactory.addFileDataSource(driverNames[i], name, files[i].getAbsolutePath(), files[i].getAbsolutePath());
|
|
278 |
LayerFactory.getDataSourceFactory().addFileDataSource(driverNames[i], name, files[i].getAbsolutePath(), files[i].getAbsolutePath());
|
|
278 | 279 |
|
279 |
DataSource dataSource = DataSourceFactory.createRandomDataSource(name);
|
|
280 |
DataSource dataSource = LayerFactory.getDataSourceFactory().createRandomDataSource(name);
|
|
280 | 281 |
SelectableDataSource sds = new SelectableDataSource(dataSource); |
281 | 282 |
ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
282 | 283 |
ProjectTable projectTable = ProjectFactory.createTable(null, sds); |
... | ... | |
311 | 312 |
password = null; |
312 | 313 |
} |
313 | 314 |
|
314 |
DataSourceFactory.addDBDataSource(name, dbod.getHost(),
|
|
315 |
LayerFactory.getDataSourceFactory().addDBDataSource(name, dbod.getHost(),
|
|
315 | 316 |
port, user, password, dbod.getDataBase(), |
316 |
dbod.getTable(), driverName); |
|
317 |
dbod.getTable(), null, driverName);
|
|
317 | 318 |
|
318 |
DataSource dataSource = DataSourceFactory.createRandomDataSource(name);
|
|
319 |
DataSource dataSource = LayerFactory.getDataSourceFactory().createRandomDataSource(name);
|
|
319 | 320 |
SelectableDataSource sds = new SelectableDataSource(dataSource); |
320 | 321 |
|
321 | 322 |
ProjectExtension ext = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class); |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/gui/legendmanager/panels/FPanelLegendValues.java | ||
---|---|---|
278 | 278 |
e.printStackTrace(); |
279 | 279 |
} catch (com.iver.cit.gvsig.fmap.DriverException e) { |
280 | 280 |
e.printStackTrace(); |
281 |
} catch (FieldNotFoundException e) { |
|
282 |
e.printStackTrace(); |
|
283 | 281 |
} |
284 | 282 |
|
285 | 283 |
quitartodo.setEnabled(true); |
trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/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