Revision 11012 branches/v10/extensions/extSDE/src/com/iver/cit/gvsig/sde/gui/sdewizard2/WizardSDE.java
WizardSDE.java | ||
---|---|---|
42 | 42 |
*/ |
43 | 43 |
package com.iver.cit.gvsig.sde.gui.sdewizard2; |
44 | 44 |
|
45 |
import java.awt.BorderLayout; |
|
46 |
import java.awt.event.ActionEvent; |
|
47 |
import java.awt.event.ActionListener; |
|
48 |
import java.awt.geom.Rectangle2D; |
|
49 |
import java.sql.SQLException; |
|
50 |
import java.util.ArrayList; |
|
51 |
import java.util.TreeMap; |
|
52 |
import java.util.Vector; |
|
53 |
|
|
54 |
import javax.swing.DefaultListModel; |
|
55 |
import javax.swing.ImageIcon; |
|
56 |
import javax.swing.JComboBox; |
|
57 |
import javax.swing.JOptionPane; |
|
58 |
import javax.swing.JPanel; |
|
59 |
import javax.swing.JScrollPane; |
|
60 |
import javax.swing.ListSelectionModel; |
|
61 |
import javax.swing.event.ListSelectionEvent; |
|
62 |
import javax.swing.event.ListSelectionListener; |
|
63 |
|
|
64 |
import org.apache.log4j.Logger; |
|
65 |
import org.cresques.cts.IProjection; |
|
66 |
import org.gvsig.gui.beans.swing.JButton; |
|
67 |
|
|
45 | 68 |
import com.esri.sde.sdk.client.SeConnection; |
46 | 69 |
import com.esri.sde.sdk.client.SeException; |
70 |
import com.esri.sde.sdk.client.SeLayer; |
|
47 | 71 |
import com.hardcode.driverManager.DriverLoadException; |
48 |
|
|
49 | 72 |
import com.iver.andami.PluginServices; |
50 | 73 |
import com.iver.andami.messages.NotificationManager; |
51 | 74 |
import com.iver.andami.ui.mdiManager.IWindow; |
52 |
|
|
53 | 75 |
import com.iver.cit.gvsig.fmap.MapContext; |
54 | 76 |
import com.iver.cit.gvsig.fmap.core.ICanReproject; |
55 | 77 |
import com.iver.cit.gvsig.fmap.crs.CRSFactory; |
56 |
import com.iver.cit.gvsig.fmap.drivers.DefaultDBDriver; |
|
57 |
import com.iver.cit.gvsig.fmap.drivers.VectorialDatabaseDriver; |
|
58 |
import com.iver.cit.gvsig.fmap.drivers.VectorialJDBCDriver; |
|
59 |
import com.iver.cit.gvsig.fmap.drivers.VectorialSDEDriver; |
|
60 |
import com.iver.cit.gvsig.fmap.drivers.jdbc.utils.SingleJDBCConnectionManager; |
|
61 | 78 |
import com.iver.cit.gvsig.fmap.drivers.sde.ArcSdeDriver; |
62 |
import com.iver.cit.gvsig.fmap.drivers.sde.SDELayerDefinition; |
|
79 |
import com.iver.cit.gvsig.fmap.drivers.sde.VectorialSDEDriver; |
|
80 |
import com.iver.cit.gvsig.fmap.drivers.sde.utils.SDELayerDefinition; |
|
63 | 81 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
64 | 82 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
65 | 83 |
import com.iver.cit.gvsig.fmap.layers.LayerFactory; |
66 | 84 |
import com.iver.cit.gvsig.gui.WizardPanel; |
67 | 85 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
68 |
|
|
69 | 86 |
import com.iver.utiles.swing.JPasswordDlg; |
70 | 87 |
|
71 |
import org.apache.log4j.Logger; |
|
72 | 88 |
|
73 |
import org.cresques.cts.IProjection; |
|
74 |
|
|
75 |
import org.gvsig.gui.beans.swing.JButton; |
|
76 |
|
|
77 |
import java.awt.BorderLayout; |
|
78 |
import java.awt.event.ActionEvent; |
|
79 |
import java.awt.event.ActionListener; |
|
80 |
import java.awt.geom.Rectangle2D; |
|
81 |
|
|
82 |
import java.sql.Connection; |
|
83 |
import java.sql.SQLException; |
|
84 |
|
|
85 |
import java.util.ArrayList; |
|
86 |
|
|
87 |
import javax.swing.DefaultListModel; |
|
88 |
import javax.swing.ImageIcon; |
|
89 |
import javax.swing.JComboBox; |
|
90 |
import javax.swing.JOptionPane; |
|
91 |
import javax.swing.JPanel; |
|
92 |
import javax.swing.JScrollPane; |
|
93 |
import javax.swing.ListSelectionModel; |
|
94 |
import javax.swing.event.ListSelectionEvent; |
|
95 |
import javax.swing.event.ListSelectionListener; |
|
96 |
|
|
97 |
|
|
98 | 89 |
/** |
99 | 90 |
* Driver-independent GeoBD wizard. Queries the drivers to fill GUI controls. |
100 | 91 |
* Multi-table selection available. |
... | ... | |
176 | 167 |
} |
177 | 168 |
|
178 | 169 |
private String[] getDriverNames() { |
179 |
Class[] classes = new Class[] { VectorialJDBCDriver.class };
|
|
170 |
Class[] classes = new Class[] { VectorialSDEDriver.class };
|
|
180 | 171 |
|
181 | 172 |
ArrayList ret = new ArrayList(); |
182 | 173 |
String[] driverNames = LayerFactory.getDM().getDriverNames(); |
... | ... | |
281 | 272 |
} |
282 | 273 |
|
283 | 274 |
lyrDef.setFieldGeometry(geomField); |
275 |
String[] fieldsAux=null; |
|
276 |
if ((fields != null) && (fields.length != 0)) { |
|
277 |
if (!fields[0].equals(lyrDef.getFieldGeometry())) { |
|
278 |
fieldsAux = new String[fields.length + 1]; |
|
279 |
fieldsAux[0] = lyrDef.getFieldGeometry(); |
|
280 |
|
|
281 |
for (int k = 1; k < fields.length+1; k++) { |
|
282 |
fieldsAux[k] = fields[k - 1]; |
|
283 |
} |
|
284 |
} |
|
285 |
} |
|
286 |
fields=fieldsAux; |
|
287 |
// else { |
|
288 |
// SeSqlConstruct sqlConstruct = new SeSqlConstruct(tableName); |
|
289 |
// sqlTotal = sqlConstruct.getWhere(); |
|
290 |
// |
|
291 |
// SeTable table1 = new SeTable(conn, tableName); |
|
292 |
// |
|
293 |
// /* |
|
294 |
// * Get the table's column definition. |
|
295 |
// */ |
|
296 |
// SeColumnDefinition[] tableDef = table1.describe(); |
|
297 |
// this.fields = new String[tableDef.length]; |
|
298 |
// |
|
299 |
// /* |
|
300 |
// * Store the names of all the table's columns in the |
|
301 |
// * String array cols. This array specifies the columns |
|
302 |
// * to be retrieved from the database. |
|
303 |
// */ |
|
304 |
// int idField = 1; |
|
305 |
// |
|
306 |
// for (int i = 0; i < tableDef.length; i++) { |
|
307 |
// if (tableDef[i].getType() == SeColumnDefinition.TYPE_SHAPE) { |
|
308 |
// this.fields[0] = tableDef[i].getName(); |
|
309 |
// } else { |
|
310 |
// this.fields[idField] = tableDef[i].getName(); |
|
311 |
// idField++; |
|
312 |
// } |
|
313 |
// } |
|
314 |
// |
|
315 |
// } |
|
316 |
|
|
284 | 317 |
lyrDef.setFieldNames(fields); |
285 | 318 |
|
286 | 319 |
lyrDef.setFieldID(fidField); |
... | ... | |
557 | 590 |
String[] tablnames = null; |
558 | 591 |
|
559 | 592 |
try { |
560 |
tablnames = drv.getTableNames(conex, dbName);
|
|
593 |
tablnames = getTableNames(conex, dbName); |
|
561 | 594 |
} catch (SQLException e) { |
562 | 595 |
logger.error("While getting table names: " + e.getMessage(), e); |
563 | 596 |
|
... | ... | |
738 | 771 |
} |
739 | 772 |
} |
740 | 773 |
} |
774 |
|
|
775 |
|
|
776 |
public String[] getTableNames(Object conex, String dbName) throws SQLException { |
|
777 |
Vector theLayers=null; |
|
778 |
try { |
|
779 |
theLayers = ((SeConnection)conex).getLayers(); |
|
780 |
} catch (SeException e) { |
|
781 |
throw new SQLException(e.getMessage()); |
|
782 |
} |
|
783 |
TreeMap ret = new TreeMap(); |
|
784 |
for (int i = 0; i < theLayers.size(); i++) { |
|
785 |
SeLayer layer = (SeLayer) theLayers.elementAt(i); |
|
786 |
ret.put(layer.getTableName(), layer.getTableName()); |
|
787 |
} |
|
788 |
return (String[]) ret.keySet().toArray(new String[0]); |
|
789 |
} |
|
790 |
|
|
791 |
|
|
792 |
|
|
741 | 793 |
} // @jve:decl-index=0:visual-constraint="10,10" |
Also available in: Unified diff