Revision 9035
tags/BN73/extensions/extArcims/Cliente-ArcIMS.number | ||
---|---|---|
1 |
#Build Number for ANT. Do not edit! |
|
2 |
#Tue Nov 28 10:22:44 CET 2006 |
|
3 |
build.number=73 |
|
0 | 4 |
tags/BN73/extensions/extArcims/javadoc.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<project default="javadoc"> |
|
3 |
<target name="javadoc"> |
|
4 |
<javadoc destdir="doc" access="private" source="1.4" use="true" notree="false" nonavbar="false" noindex="false" splitindex="true" author="true" version="true" nodeprecatedlist="false" nodeprecated="false" packagenames="es.prodevelop.cit.gvsig.arcims.fmap.datasource,es.prodevelop.cit.gvsig.arcims.gui.toc,es.prodevelop.cit.gvsig.arcims.gui.panels,es.prodevelop.cit.gvsig.arcims.gui.panels.utils,es.prodevelop.cit.gvsig.arcims.gui.dialogs,es.prodevelop.cit.gvsig.arcims.gui.wizards,es.prodevelop.cit.gvsig.arcims.extension,es.prodevelop.cit.gvsig.arcims.fmap.drivers,es.prodevelop.cit.gvsig.arcims.fmap.layers" sourcepath="src" classpath="../libFMap/lib/jmrsid-0.0.2.jar;../libFMap/lib/mysql-connector-java-3.1.7-bin.jar;../libFMap/lib/geojava.jar;../appgvSIG/lib/batik-xml.jar;../libFMap/lib/gt2-legacy.jar;../libFMap/lib/gt2-postgis.jar;../libFMap/lib/tar.jar;../extWMS/lib/remote-clients.jar;../libFMap/lib/driver-manager-1.0.jar;../fwAndami/lib/javaws.jar;../libFMap/lib/tempFileManager.jar;../appgvSIG/lib/batik-css.jar;../appgvSIG/lib/batik-util.jar;../libFMap/lib/jts-1.6.jar;../libFMap/lib/jmgeoraster.jar;../appgvSIG/lib/JimiProClasses.zip;../libFMap/lib/hsqldb.jar;../libRemoteServices/lib/kxml2.jar;../fwAndami/lib/iver-utiles.jar;../libFMap/lib/postgresql-74.213.jar;../fwAndami/lib/castor-0.9.5.3-xml.jar;../libFMap/lib/jogr.jar;../appgvSIG/lib/batik-bridge.jar;../appgvSIG/lib/batik-script.jar;../libFMap/lib/geoapi-2.0.jar;../libFMap/lib/units-0.01.jar;../appgvSIG/lib/itext-1.3.jar;../appgvSIG/lib/batik-svg-dom.jar;../appgvSIG/lib/batik-ext.jar;../libRemoteServices/bin;../fwAndami/lib/log4j-1.2.8.jar;../fwAndami/lib/xerces_2_5_0.jar;../appgvSIG/lib/batik-parser.jar;../appgvSIG/lib/batik-gvt.jar;../fwAndami/lib/xml-apis.jar;../appgvSIG/lib/batik-svggen.jar;../libFMap/lib/jgdal-0.1.0.jar;../libFMap/lib/gt2-main.jar;../fwAndami/bin;../libFMap/lib/batik-awt-util.jar;../appgvSIG/bin;../libFMap/lib/gdbms-0.8-SNAPSHOT.jar;../libFMap/bin;../appgvSIG/lib/pdf-transcoder.jar;../libFMap/lib/geotiff-jai.jar;../libFMap/lib/cms.jar;../libFMap/lib/jecwcompress-0.0.0.jar;../fwAndami/lib/crimson.jar;../appgvSIG/lib/jep-2.24.jar;../appgvSIG/lib/batik-awt-util.jar;../appgvSIG/lib/js.jar;../appgvSIG/lib/batik-swing.jar;../libFMap/lib/wkb4j-1.0-RC1.jar;../libArcIMS/bin;../appgvSIG/lib/batik-transcoder.jar;../fwAndami/lib/JUF-1.0.jar;../appgvSIG/lib/batik-gui-util.jar;../appgvSIG/lib/batik-dom.jar;../libFMap/lib/jecw-0.0.1.jar;../libFMap/lib/vecmath-1.3.jar;../libFMap/lib/postgis-jdbc-driver.jar;../appgvSIG/lib/batik-extension.jar;../fwAndami/lib/tempFileManager.jar"/> |
|
5 |
</target> |
|
6 |
</project> |
|
0 | 7 |
tags/BN73/extensions/extArcims/src/es/prodevelop/cit/gvsig/arcims/extension/ArcimsClientModule.java | ||
---|---|---|
1 |
package es.prodevelop.cit.gvsig.arcims.extension; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.net.MalformedURLException; |
|
5 |
import java.net.URL; |
|
6 |
|
|
7 |
import com.iver.andami.PluginServices; |
|
8 |
import com.iver.andami.plugins.Extension; |
|
9 |
import com.iver.cit.gvsig.About; |
|
10 |
import com.iver.cit.gvsig.AddLayer; |
|
11 |
import com.iver.cit.gvsig.project.documents.view.toc.gui.FPopupMenu; |
|
12 |
import com.iver.utiles.extensionPoints.ExtensionPoints; |
|
13 |
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton; |
|
14 |
|
|
15 |
import es.prodevelop.cit.gvsig.arcims.fmap.layers.FFeatureLyrArcIMS; |
|
16 |
import es.prodevelop.cit.gvsig.arcims.fmap.layers.FFeatureLyrArcIMSCollection; |
|
17 |
import es.prodevelop.cit.gvsig.arcims.fmap.layers.FRasterLyrArcIMS; |
|
18 |
import es.prodevelop.cit.gvsig.arcims.gui.toc.ArcImsLayerScaleTocMenuEntry; |
|
19 |
import es.prodevelop.cit.gvsig.arcims.gui.toc.ArcImsPropsTocMenuEntry; |
|
20 |
import es.prodevelop.cit.gvsig.arcims.gui.toc.ArcImsRasterPropsTocMenuEntry; |
|
21 |
import es.prodevelop.cit.gvsig.arcims.gui.wizards.ArcImsWizard; |
|
22 |
|
|
23 |
/** |
|
24 |
* This class implements the extension to access ArcIMS servers. |
|
25 |
* |
|
26 |
* @author jldominguez |
|
27 |
* |
|
28 |
*/ |
|
29 |
public class ArcimsClientModule extends Extension { |
|
30 |
|
|
31 |
/** |
|
32 |
* This method initializes the extension. Adds the ArcIMS wizard |
|
33 |
* and the right-click popup menus to the gvSIG resources. |
|
34 |
*/ |
|
35 |
public void initialize() { |
|
36 |
// must add menus and a new tab to the wizard |
|
37 |
// to create an arcims layer |
|
38 |
FPopupMenu.addEntry(new ArcImsPropsTocMenuEntry()); |
|
39 |
FPopupMenu.addEntry(new ArcImsRasterPropsTocMenuEntry()); |
|
40 |
FPopupMenu.addEntry(new ArcImsLayerScaleTocMenuEntry()); |
|
41 |
AddLayer.addWizard(ArcImsWizard.class); |
|
42 |
|
|
43 |
// about |
|
44 |
java.net.URL newurl = createResourceUrl("about/extarcims-about.html"); |
|
45 |
About claseAbout = (About) PluginServices.getExtension(com.iver.cit.gvsig.About.class); |
|
46 |
claseAbout.getAboutPanel().addAboutUrl("ArcIMS", newurl); |
|
47 |
|
|
48 |
// catalog |
|
49 |
ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance(); |
|
50 |
extensionPoints.add("CatalogLayers", "arcims_raster", FRasterLyrArcIMS.class); |
|
51 |
extensionPoints.add("CatalogLayers", "arcims_vectorial", FFeatureLyrArcIMSCollection.class); |
|
52 |
} |
|
53 |
|
|
54 |
/** |
|
55 |
* This method is called when the extension's controls are used. |
|
56 |
* So far, the ArcIMS plugin does <i>not</i> add any controls. |
|
57 |
* |
|
58 |
* @param actionCommand the control's string action commmad. |
|
59 |
* |
|
60 |
*/ |
|
61 |
public void execute(String actionCommand) { |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* This method is called to find out if the plugin's controls are |
|
66 |
* enabled or not. So far, the ArcIMS plugin does <i>not</i> |
|
67 |
* add any controls. |
|
68 |
* |
|
69 |
* @return <b>true</b> if controls must be enabled, <b>false</b> if not. |
|
70 |
*/ |
|
71 |
public boolean isEnabled() { |
|
72 |
return false; |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* This method is called to find out if the plugin's controls are |
|
77 |
* visible or not. So far, the ArcIMS plugin does <i>not</i> |
|
78 |
* add any controls. |
|
79 |
* |
|
80 |
* @return <b>true</b> if controls must be visible, <b>false</b> if not. |
|
81 |
*/ |
|
82 |
public boolean isVisible() { |
|
83 |
return false; |
|
84 |
} |
|
85 |
|
|
86 |
private java.net.URL createResourceUrl(String path) { |
|
87 |
return getClass().getClassLoader().getResource(path); |
|
88 |
} |
|
89 |
|
|
90 |
|
|
91 |
} |
|
0 | 92 |
tags/BN73/extensions/extArcims/src/es/prodevelop/cit/gvsig/arcims/fmap/listeners/FRasterLyrArcIMSListener.java | ||
---|---|---|
1 |
package es.prodevelop.cit.gvsig.arcims.fmap.listeners; |
|
2 |
|
|
3 |
public interface FRasterLyrArcIMSListener { |
|
4 |
|
|
5 |
public void thingsHaveChanged(String query, String name); |
|
6 |
|
|
7 |
} |
|
0 | 8 |
tags/BN73/extensions/extArcims/src/es/prodevelop/cit/gvsig/arcims/fmap/datasource/ArcImsWizardData.java | ||
---|---|---|
1 |
package es.prodevelop.cit.gvsig.arcims.fmap.datasource; |
|
2 |
|
|
3 |
import java.awt.geom.Rectangle2D; |
|
4 |
import java.net.URL; |
|
5 |
import java.util.TreeMap; |
|
6 |
import java.util.Vector; |
|
7 |
|
|
8 |
import com.iver.cit.gvsig.fmap.DriverException; |
|
9 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
10 |
import com.iver.cit.gvsig.fmap.edition.VectorialEditableAdapter; |
|
11 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
12 |
import com.iver.utiles.swing.threads.DefaultCancellableMonitorable; |
|
13 |
|
|
14 |
import es.prodevelop.cit.gvsig.arcims.fmap.drivers.ArcImsDriver; |
|
15 |
import es.prodevelop.cit.gvsig.arcims.fmap.drivers.ArcImsVectorialAdapter; |
|
16 |
import es.prodevelop.cit.gvsig.arcims.fmap.drivers.FMapRasterArcImsDriver; |
|
17 |
import es.prodevelop.cit.gvsig.arcims.fmap.drivers.FMapFeatureArcImsDriver; |
|
18 |
import es.prodevelop.cit.gvsig.arcims.fmap.layers.FFeatureLyrArcIMS; |
|
19 |
import es.prodevelop.cit.gvsig.arcims.fmap.layers.FFeatureLyrArcIMSCollection; |
|
20 |
import es.prodevelop.cit.gvsig.arcims.fmap.layers.FRasterLyrArcIMS; |
|
21 |
import es.prodevelop.cit.gvsig.arcims.fmap.layers.LayerScaleData; |
|
22 |
|
|
23 |
import org.gvsig.remoteClient.arcims.*; |
|
24 |
import org.gvsig.remoteClient.arcims.utils.MyCancellable; |
|
25 |
import org.gvsig.remoteClient.arcims.utils.ServiceInfoTags; |
|
26 |
import org.gvsig.remoteClient.arcims.utils.ServiceInformation; |
|
27 |
import org.gvsig.remoteClient.arcims.utils.ServiceInformationLayerFeatures; |
|
28 |
import org.apache.log4j.Logger; |
|
29 |
import org.cresques.cts.IProjection; |
|
30 |
|
|
31 |
/** |
|
32 |
* This class implements a data source object, owned by the ArcImsWizard |
|
33 |
* object. It will create the ArcIMS layer and load some basic data. |
|
34 |
* |
|
35 |
* @author jldominguez |
|
36 |
* |
|
37 |
*/ |
|
38 |
public class ArcImsWizardData { |
|
39 |
|
|
40 |
private static Logger logger = Logger.getLogger(ArcImsWizardData.class.getName()); |
|
41 |
|
|
42 |
/** |
|
43 |
* The graphic context in which a request is performed |
|
44 |
* (ccord. system, view's dimension etc.) |
|
45 |
*/ |
|
46 |
private ArcImsStatus status; |
|
47 |
private String testInfo; |
|
48 |
private String serviceType; |
|
49 |
private FMapRasterArcImsDriver arcImsImageDriver = null; |
|
50 |
private FMapFeatureArcImsDriver arcImsFeatureDriver = null; |
|
51 |
private boolean missingSrs = false; |
|
52 |
private MapControl mapControl; |
|
53 |
|
|
54 |
private MyCancellable myCanc; |
|
55 |
|
|
56 |
|
|
57 |
public ArcImsWizardData() { |
|
58 |
myCanc = new MyCancellable(new DefaultCancellableMonitorable()); |
|
59 |
} |
|
60 |
|
|
61 |
public void setHostService(URL host, String service, String svcType) throws DriverException { |
|
62 |
|
|
63 |
serviceType = svcType; |
|
64 |
boolean nogood = true; |
|
65 |
|
|
66 |
if (serviceType.compareToIgnoreCase(ServiceInfoTags.vIMAGESERVICE) == 0) { |
|
67 |
nogood = false; |
|
68 |
arcImsImageDriver = new FMapRasterArcImsDriver(host.toString(), service, svcType); |
|
69 |
// Send a getCapabilities request; |
|
70 |
if (! arcImsImageDriver.connect(myCanc)) { |
|
71 |
DriverException de = new DriverException("cant_connect"); |
|
72 |
logger.error("While trying to connect ", de); |
|
73 |
throw de; |
|
74 |
} |
|
75 |
testInfo = "Connected successfully."; |
|
76 |
} |
|
77 |
if (serviceType.compareToIgnoreCase(ServiceInfoTags.vFEATURESERVICE) == 0) { |
|
78 |
nogood = false; |
|
79 |
arcImsFeatureDriver = new FMapFeatureArcImsDriver(host.toString(), service, svcType); |
|
80 |
// Send a getCapabilities request; |
|
81 |
if (! arcImsFeatureDriver.connect(myCanc)) { |
|
82 |
DriverException de = new DriverException("cant_connect"); |
|
83 |
logger.error("While trying to connect ", de); |
|
84 |
throw de; |
|
85 |
} |
|
86 |
testInfo = "Connected successfully."; |
|
87 |
} |
|
88 |
if (nogood) { |
|
89 |
logger.error("Nothing done. Unable to find out serviceType "); |
|
90 |
} |
|
91 |
} |
|
92 |
|
|
93 |
public void setHostService(URL host, String service, String svcType, FLayer lyr) throws DriverException { |
|
94 |
|
|
95 |
serviceType = svcType; |
|
96 |
boolean nogood = true; |
|
97 |
|
|
98 |
if (serviceType.compareToIgnoreCase(ServiceInfoTags.vIMAGESERVICE) == 0) { |
|
99 |
nogood = false; |
|
100 |
|
|
101 |
arcImsImageDriver = |
|
102 |
(FMapRasterArcImsDriver) ((FRasterLyrArcIMS) lyr).getDriver(); |
|
103 |
|
|
104 |
// arcImsImageDriver = new FMapRasterArcImsDriver(host.toString(), service, svcType); |
|
105 |
// Send a getCapabilities request; |
|
106 |
if (! arcImsImageDriver.connect(myCanc)) { |
|
107 |
DriverException de = new DriverException("cant_connect"); |
|
108 |
logger.error("While trying to connect ", de); |
|
109 |
throw de; |
|
110 |
} |
|
111 |
testInfo = "Connected successfully."; |
|
112 |
} |
|
113 |
if (serviceType.compareToIgnoreCase(ServiceInfoTags.vFEATURESERVICE) == 0) { |
|
114 |
nogood = false; |
|
115 |
|
|
116 |
// arcImsFeatureDriver = new FMapFeatureArcImsDriver(host.toString(), service, svcType); |
|
117 |
arcImsFeatureDriver = |
|
118 |
(FMapFeatureArcImsDriver) ((FFeatureLyrArcIMS) lyr).getSource().getDriver(); |
|
119 |
|
|
120 |
// Send a getCapabilities request; |
|
121 |
if (! arcImsFeatureDriver.connect(myCanc)) { |
|
122 |
DriverException de = new DriverException("cant_connect"); |
|
123 |
logger.error("While trying to connect ", de); |
|
124 |
throw de; |
|
125 |
} |
|
126 |
testInfo = "Connected successfully."; |
|
127 |
} |
|
128 |
if (nogood) { |
|
129 |
logger.error("Nothing done. Unable to find out serviceType "); |
|
130 |
} |
|
131 |
} |
|
132 |
|
|
133 |
|
|
134 |
|
|
135 |
public String getServiceType() { return serviceType; } |
|
136 |
public void setServiceType(String t) { serviceType = t; } |
|
137 |
|
|
138 |
public ArcImsDriver getDriver() { |
|
139 |
if (serviceType.compareToIgnoreCase(ServiceInfoTags.vFEATURESERVICE) == 0) { |
|
140 |
return arcImsFeatureDriver; |
|
141 |
} |
|
142 |
if (serviceType.compareToIgnoreCase(ServiceInfoTags.vIMAGESERVICE) == 0) { |
|
143 |
return arcImsImageDriver; |
|
144 |
} |
|
145 |
logger.error("Null value returned. Unable to find out serviceType "); |
|
146 |
return null; |
|
147 |
} |
|
148 |
|
|
149 |
public void setDriver(ArcImsDriver d) { |
|
150 |
boolean nogood = true; |
|
151 |
if (d instanceof FMapRasterArcImsDriver) { |
|
152 |
arcImsImageDriver = (FMapRasterArcImsDriver) d; |
|
153 |
nogood = false; |
|
154 |
} |
|
155 |
if (d instanceof FMapFeatureArcImsDriver) { |
|
156 |
arcImsFeatureDriver = (FMapFeatureArcImsDriver) d; |
|
157 |
nogood = false; |
|
158 |
} |
|
159 |
if (nogood) { |
|
160 |
logger.error("Nothing done. Unable to find out serviceType "); |
|
161 |
} |
|
162 |
} |
|
163 |
|
|
164 |
public ArcImsStatus getStatus() { return status; } |
|
165 |
public void setStatus (ArcImsStatus s) { status = s; } |
|
166 |
|
|
167 |
/** |
|
168 |
* Gets available layers from the current server and service |
|
169 |
* |
|
170 |
* @return a TreeMap with available layers |
|
171 |
*/ |
|
172 |
public TreeMap getLayers() { |
|
173 |
if (serviceType.compareToIgnoreCase(ServiceInfoTags.vFEATURESERVICE) == 0) { |
|
174 |
return arcImsFeatureDriver.getLayers(); |
|
175 |
} |
|
176 |
if (serviceType.compareToIgnoreCase(ServiceInfoTags.vIMAGESERVICE) == 0) { |
|
177 |
return arcImsImageDriver.getLayers(); |
|
178 |
} |
|
179 |
logger.error("Null value returned. Unable to find out serviceType in method " + |
|
180 |
"TreeMap getLayers()" + ", class: "+ this.getClass().toString()); |
|
181 |
return null; |
|
182 |
} |
|
183 |
|
|
184 |
/** |
|
185 |
* This method is invoqued by the wizard's <tt>getLayer()</tt> method |
|
186 |
* to create an ArcIMS raster layer. |
|
187 |
* |
|
188 |
* @param host server's URL |
|
189 |
* @param service service name |
|
190 |
* @param sLayer comma-separated list of selected layers |
|
191 |
* @param name new gvSIG layer's name |
|
192 |
* @param srs project's coordinate system |
|
193 |
* @return the new layer (of class FRasterLyrArcIMS, which is a |
|
194 |
* subclass of _FLyrArcIMS which is a subclass of FLayer) |
|
195 |
*/ |
|
196 |
public FRasterLyrArcIMS createArcImsRasterLayer(String host, String service, String sLayer, |
|
197 |
String name, IProjection srs, String imgFormat) |
|
198 |
throws Exception { |
|
199 |
|
|
200 |
FMapRasterArcImsDriver drv = new FMapRasterArcImsDriver(host, service, this.serviceType); |
|
201 |
|
|
202 |
if (!drv.connect(myCanc)) |
|
203 |
throw new Exception(); |
|
204 |
|
|
205 |
FRasterLyrArcIMS flyr = new FRasterLyrArcIMS(); |
|
206 |
flyr.setDriver(drv); |
|
207 |
flyr.setHost(new URL(host)); |
|
208 |
flyr.setService(service); |
|
209 |
flyr.setServiceType(this.serviceType); |
|
210 |
flyr.setServiceInformationInStatus(drv.getClient().getServiceInformation()); |
|
211 |
|
|
212 |
ServiceInformation si = flyr.getArcimsStatus().getServiceInfo(); |
|
213 |
if ((si.getFeaturecoordsys() == null) || (si.getFeaturecoordsys().equals(""))) { |
|
214 |
missingSrs = true; |
|
215 |
si.setFeaturecoordsys(srs.getAbrev().substring(ServiceInfoTags.vINI_SRS.length()).trim()); |
|
216 |
logger.warn("Server provides no SRS. "); |
|
217 |
} else { |
|
218 |
missingSrs = false; |
|
219 |
} |
|
220 |
|
|
221 |
flyr.setFullExtent(((ArcImsProtImageHandler) drv.getClient().getHandler()).getServiceExtent(srs, flyr.getArcimsStatus())); |
|
222 |
|
|
223 |
// we *dont* use PNG always |
|
224 |
// flyr.setFormat("image/png"); |
|
225 |
flyr.setFormat(imgFormat); |
|
226 |
flyr.setTransparency(0); |
|
227 |
flyr.setLayerQuery(sLayer); |
|
228 |
flyr.setProjection(srs); |
|
229 |
flyr.setName(name); |
|
230 |
// ----------- service info --------------- |
|
231 |
|
|
232 |
// flyr.getSource().getDriver(); |
|
233 |
// ----------------- 1.0 |
|
234 |
|
|
235 |
return flyr; |
|
236 |
} |
|
237 |
|
|
238 |
public String getTestInfo() { |
|
239 |
return testInfo; |
|
240 |
} |
|
241 |
|
|
242 |
/** |
|
243 |
* This method is invoqued by the wizard's <tt>getLayer()</tt> method |
|
244 |
* to create an ArcIMS feature layer. |
|
245 |
* |
|
246 |
* @param host server's URL |
|
247 |
* @param service service name |
|
248 |
* @param sLayer comma-separated list of selected layers |
|
249 |
* @param name new gvSIG layer's name |
|
250 |
* @param srs project's coordinate system |
|
251 |
* @param sep whether it'a grouped set of layers (false) or not (true) |
|
252 |
* @return the new layer (of class FRasterLyrArcIMS, which is a |
|
253 |
* subclass of FRasterLyrArcIMS, which is a subclass of FLayer) |
|
254 |
*/ |
|
255 |
public FFeatureLyrArcIMSCollection createArcImsFeatureLayer(String host, String service, String sLayer, String name, IProjection srs, boolean sep) |
|
256 |
throws Exception { |
|
257 |
|
|
258 |
String[] selectedLayerIds = sLayer.split(","); |
|
259 |
int count = selectedLayerIds.length; |
|
260 |
|
|
261 |
FFeatureLyrArcIMS[] individualLayers = new FFeatureLyrArcIMS[count]; |
|
262 |
|
|
263 |
String item; |
|
264 |
|
|
265 |
for (int i=0; i<count; i++) { |
|
266 |
|
|
267 |
item = selectedLayerIds[i]; |
|
268 |
FMapFeatureArcImsDriver drv = new FMapFeatureArcImsDriver(host, service, item); |
|
269 |
if (!(drv.connect(myCanc))) throw new Exception(); |
|
270 |
|
|
271 |
ArcImsVectorialAdapter oldadapter = new ArcImsVectorialAdapter(drv); |
|
272 |
VectorialEditableAdapter adapter = new VectorialEditableAdapter(); |
|
273 |
|
|
274 |
/* 1 */ individualLayers[i] = new FFeatureLyrArcIMS(adapter); |
|
275 |
/* 2 */ drv.setLayer(individualLayers[i]); |
|
276 |
|
|
277 |
ServiceInformation si = drv.getClient().getServiceInformation(); |
|
278 |
ServiceInformationLayerFeatures silf = (ServiceInformationLayerFeatures) si.getLayerById(item); |
|
279 |
String lyrname = silf.getName(); |
|
280 |
|
|
281 |
individualLayers[i].setProjectionInStatus(srs.getAbrev()); |
|
282 |
individualLayers[i].setHostInStatus(new URL(host)); |
|
283 |
individualLayers[i].setServiceInStatus(service); |
|
284 |
|
|
285 |
String units = si.getMapunits(); |
|
286 |
int theDpi = si.getScreen_dpi(); |
|
287 |
long scale; |
|
288 |
if (silf.getMaxscale()!=-1){ |
|
289 |
scale = LayerScaleData.getTrueScaleFromRelativeScaleAndMapUnits(silf.getMaxscale(), units, theDpi); |
|
290 |
individualLayers[i].setMaxScale((double) scale); |
|
291 |
} |
|
292 |
if (silf.getMinscale()!=-1){ |
|
293 |
scale = LayerScaleData.getTrueScaleFromRelativeScaleAndMapUnits(silf.getMinscale(), units, theDpi); |
|
294 |
individualLayers[i].setMinScale((double) scale); |
|
295 |
} |
|
296 |
|
|
297 |
individualLayers[i].setServiceInformationInStatus(si); |
|
298 |
Vector ids = new Vector(); ids.add(item); |
|
299 |
individualLayers[i].setLayerIdsInStatus((Vector) ids.clone()); |
|
300 |
individualLayers[i].setSubfieldsInStatus(); |
|
301 |
|
|
302 |
|
|
303 |
/* 3 */ |
|
304 |
// individualLayers[i].setLegend(new VectorialUniqueValueLegend()); |
|
305 |
|
|
306 |
|
|
307 |
individualLayers[i].setHost(new URL(host)); |
|
308 |
individualLayers[i].setService(service); |
|
309 |
individualLayers[i].setServiceType(ServiceInfoTags.vFEATURESERVICE); |
|
310 |
individualLayers[i].setTransparency(0); |
|
311 |
individualLayers[i].setLayerQuery(item); |
|
312 |
individualLayers[i].setProjection(srs); |
|
313 |
individualLayers[i].setName(lyrname); |
|
314 |
|
|
315 |
Rectangle2D fext = ((ArcImsFeatureClient) drv.getClient()).getLayerExtent(individualLayers[i].getArcimsStatus()); |
|
316 |
drv.setFullExtent(fext); |
|
317 |
// individualLayers[i].setF. setFullExtent(((ArcImsProtImageHandler) drv.getClient().getHandler()).getServiceExtent(srs, individualLayers[i].getArcimsStatus())); |
|
318 |
|
|
319 |
// ------ ------------- |
|
320 |
drv.setAdapter(adapter); |
|
321 |
// adapter.setRecordSet(drv.getRecordSet()); |
|
322 |
adapter.setOriginalDataSource(drv.getRecordSet()); |
|
323 |
adapter.setOriginalVectorialAdapter(oldadapter); |
|
324 |
drv.declareTable(); |
|
325 |
individualLayers[i].setInitialLegend(); |
|
326 |
individualLayers[i].setShapeType(adapter.getShapeType()); |
|
327 |
individualLayers[i].setRecordset(drv.getRecordSet()); |
|
328 |
// ------ ------------- |
|
329 |
|
|
330 |
if ((si.getFeaturecoordsys() == null) || (si.getFeaturecoordsys().equals(""))) { |
|
331 |
missingSrs = true; |
|
332 |
si.setFeaturecoordsys(srs.getAbrev().substring(ServiceInfoTags.vINI_SRS.length()).trim()); |
|
333 |
logger.warn("Server provides no SRS. "); |
|
334 |
} else { |
|
335 |
missingSrs = false; |
|
336 |
} |
|
337 |
|
|
338 |
} |
|
339 |
|
|
340 |
FFeatureLyrArcIMSCollection collection = new FFeatureLyrArcIMSCollection(mapControl.getMapContext(), null, sep); |
|
341 |
collection.setName(name); |
|
342 |
collection.setProjection(srs); |
|
343 |
for (int i=0; i<count; i++) { |
|
344 |
collection.addLayer(individualLayers[i]); |
|
345 |
} |
|
346 |
return collection; |
|
347 |
} |
|
348 |
|
|
349 |
/** |
|
350 |
* Tells whether the SRS was missing on the server. |
|
351 |
* |
|
352 |
* @return <tt>true</tt> if and only if the Srs was not provided by the server. |
|
353 |
*/ |
|
354 |
public boolean isMissingSrs() { |
|
355 |
return missingSrs; |
|
356 |
} |
|
357 |
|
|
358 |
public void setMissingSrs(boolean missingSrs) { |
|
359 |
this.missingSrs = missingSrs; |
|
360 |
} |
|
361 |
|
|
362 |
public void setMapControl(MapControl mapControl) { |
|
363 |
this.mapControl = mapControl; |
|
364 |
} |
|
365 |
|
|
366 |
} |
|
0 | 367 |
tags/BN73/extensions/extArcims/src/es/prodevelop/cit/gvsig/arcims/fmap/drivers/ArcImsInMemoryAttsTableDriver.java | ||
---|---|---|
1 |
package es.prodevelop.cit.gvsig.arcims.fmap.drivers; |
|
2 |
|
|
3 |
|
|
4 |
import java.awt.Dimension; |
|
5 |
import java.io.IOException; |
|
6 |
import java.sql.Connection; |
|
7 |
import java.sql.DriverManager; |
|
8 |
import java.sql.SQLException; |
|
9 |
import java.sql.Types; |
|
10 |
import java.util.ArrayList; |
|
11 |
import java.util.HashMap; |
|
12 |
|
|
13 |
import org.apache.log4j.Logger; |
|
14 |
import org.gvsig.remoteClient.arcims.utils.FieldInformation; |
|
15 |
|
|
16 |
import com.hardcode.driverManager.DriverLoadException; |
|
17 |
import com.hardcode.gdbms.engine.data.DataSource; |
|
18 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
|
19 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
20 |
import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
|
21 |
import com.hardcode.gdbms.engine.instruction.EvaluationException; |
|
22 |
import com.hardcode.gdbms.engine.instruction.SemanticException; |
|
23 |
import com.hardcode.gdbms.engine.values.*; |
|
24 |
import com.hardcode.gdbms.parser.ParseException; |
|
25 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
|
26 |
|
|
27 |
public class ArcImsInMemoryAttsTableDriver { |
|
28 |
|
|
29 |
|
|
30 |
private String tableName = ""; |
|
31 |
// private String dataBName = ""; |
|
32 |
private String idOriginalFieldName = ""; |
|
33 |
private String idSqlFieldName = ""; |
|
34 |
|
|
35 |
// private String rowIndexFieldName = "INMEMORYROWNUMBER"; |
|
36 |
private int idFieldInd = -1; |
|
37 |
private FBitSet requested; |
|
38 |
|
|
39 |
private ArrayList sqlColumnNames = new ArrayList(); |
|
40 |
private ArrayList originalColumnNames = new ArrayList(); |
|
41 |
|
|
42 |
// private ArrayList originalColumnNames = new ArrayList(); |
|
43 |
private ArrayList columnTypes = new ArrayList(); |
|
44 |
// private int theRowCount = 0; |
|
45 |
private int theFieldCount = 0; |
|
46 |
private HashMap idToIndex; |
|
47 |
private static Logger logger = Logger.getLogger(FMapFeatureArcImsDriver.class.getName()); |
|
48 |
|
|
49 |
private Dimension lastRequest = new Dimension(-1, -1); |
|
50 |
|
|
51 |
// ------------------------------------------------ |
|
52 |
private ArrayList data = new ArrayList(); |
|
53 |
private ArrayList id = new ArrayList(); |
|
54 |
// ------------------------------------------------ |
|
55 |
// private ArcImsAttributesTableCachee attsCache; |
|
56 |
// private static Logger logger = Logger.getLogger(FMapFeatureArcImsDriver.class.getName()); |
|
57 |
|
|
58 |
public ArcImsInMemoryAttsTableDriver(String tb_name, ArrayList colnames, ArrayList coltypes) { |
|
59 |
// super(); |
|
60 |
tableName = tb_name; |
|
61 |
// dataBName = dbName; |
|
62 |
idFieldInd = getIdColumnInd(coltypes); |
|
63 |
|
|
64 |
idOriginalFieldName = (String) colnames.get(idFieldInd); |
|
65 |
idSqlFieldName = replaceUnwantedCharacters((String) colnames.get(idFieldInd)); |
|
66 |
|
|
67 |
requested = new FBitSet(); |
|
68 |
for (int i=0; i<colnames.size(); i++) { |
|
69 |
sqlColumnNames.add(replaceUnwantedCharacters((String) colnames.get(i) )); |
|
70 |
originalColumnNames.add(colnames.get(i)); |
|
71 |
columnTypes.add(coltypes.get(i)); |
|
72 |
theFieldCount++; |
|
73 |
} |
|
74 |
|
|
75 |
idToIndex = new HashMap(); |
|
76 |
} |
|
77 |
/** |
|
78 |
* user = "as", password = "", dbName = ? |
|
79 |
* |
|
80 |
* @see com.hardcode.gdbms.engine.data.driver.DBDriver#getConnection(java.lang.String, |
|
81 |
* int, java.lang.String, java.lang.String, java.lang.String) |
|
82 |
*/ |
|
83 |
// public Connection getConnection(String host, int port, String _dbName, |
|
84 |
// String _user, String _password) throws SQLException { |
|
85 |
// |
|
86 |
//// if (driverException != null) { |
|
87 |
//// throw new RuntimeException(driverException); |
|
88 |
//// } |
|
89 |
// String connectionString = "jdbc:hsqldb:mem:" + dataBName; |
|
90 |
// Connection c = DriverManager.getConnection(connectionString, "sa", ""); |
|
91 |
// return c; |
|
92 |
// } |
|
93 |
|
|
94 |
// public Connection getConnection() throws SQLException { |
|
95 |
// return getConnection("", 0, "", "", ""); |
|
96 |
// } |
|
97 |
|
|
98 |
/** |
|
99 |
* @see com.hardcode.driverManager.Driver#getName() |
|
100 |
*/ |
|
101 |
public String getName() { |
|
102 |
return "ArcIMS in-memory attributes data driver"; |
|
103 |
} |
|
104 |
|
|
105 |
public void open(String sql) throws SQLException { |
|
106 |
// open(getConnection(), sql); |
|
107 |
} |
|
108 |
|
|
109 |
public void execute(String sql) throws SQLException { |
|
110 |
// execute(getConnection(), sql); |
|
111 |
} |
|
112 |
|
|
113 |
public String getDbName() { |
|
114 |
return "No database"; |
|
115 |
} |
|
116 |
|
|
117 |
public int getIdFieldInd() { |
|
118 |
return idFieldInd; |
|
119 |
} |
|
120 |
|
|
121 |
public String getIdFieldName() { |
|
122 |
return idSqlFieldName; |
|
123 |
} |
|
124 |
|
|
125 |
// public void addRow(DataSourceFactory dsf, Value[] values) throws DriverException { |
|
126 |
public void addRow(Value[] values, boolean filled) throws DriverException { |
|
127 |
|
|
128 |
if (values.length < theFieldCount) { |
|
129 |
logger.error("Cannot add row with length < field count. "); |
|
130 |
return; |
|
131 |
} |
|
132 |
|
|
133 |
if (values[idFieldInd].toString().compareTo("") != 0) { |
|
134 |
// not null value |
|
135 |
int theid = ((IntValue) values[idFieldInd]).intValue(); |
|
136 |
idToIndex.put(new Integer(theid), new Integer(data.size())); |
|
137 |
} |
|
138 |
|
|
139 |
requested.set(data.size(), filled); |
|
140 |
data.add(values); |
|
141 |
|
|
142 |
// String fieldNames = ""; |
|
143 |
// for (int i=0; i < (values.length + 1); i++) { |
|
144 |
// fieldNames = fieldNames + ((String) columnNames.get(i)) + ", "; |
|
145 |
// } |
|
146 |
// fieldNames = fieldNames.substring(0, fieldNames.length() - 2); |
|
147 |
// // + ArcImsSqlUtils.rowIndexFieldName; |
|
148 |
// |
|
149 |
// String fieldValues = ""; |
|
150 |
// for (int i=0; i<values.length; i++) { |
|
151 |
// fieldValues = fieldValues + getValueInSqlFormat(values[i]) + ", "; |
|
152 |
// } |
|
153 |
// fieldValues = fieldValues + getRowCount(); |
|
154 |
// |
|
155 |
// String sqlStr = "insert into " + tableName + " ("; |
|
156 |
// sqlStr = sqlStr + fieldNames + ") values ("; |
|
157 |
// sqlStr = sqlStr + fieldValues + ")"; |
|
158 |
// /* |
|
159 |
// * INSERT INTO Table1 (Column1, Column2, Column3?) |
|
160 |
// * VALUES (Value1, Value2, Value3?) |
|
161 |
// */ |
|
162 |
// try { |
|
163 |
// // dsf.executeSQL(sqlStr, DataSourceFactory.AUTOMATIC_OPENING); |
|
164 |
// execute(sqlStr); |
|
165 |
// theRowCount++; |
|
166 |
// } catch (Exception e) { |
|
167 |
// DriverException de = new DriverException(e.getMessage()); |
|
168 |
// throw de; |
|
169 |
// } |
|
170 |
} |
|
171 |
|
|
172 |
// public void deleteRow(DataSourceFactory dsf, int i) throws DriverException { |
|
173 |
public void deleteRow(int i) throws DriverException { |
|
174 |
/* |
|
175 |
DELETE FROM Table1 WHERE Some_Column = Some_Value |
|
176 |
*/ |
|
177 |
logger.warn("deleteRow was invoqued, i = " + i); |
|
178 |
|
|
179 |
int theid = getRowId(i); |
|
180 |
idToIndex.remove(new Integer(theid)); |
|
181 |
|
|
182 |
requested.set(i, false); |
|
183 |
data.set(i, null); |
|
184 |
|
|
185 |
// String sqlStr = "delete from " + tableName + " where "; |
|
186 |
// sqlStr = sqlStr + rowIndexFieldName + " = "; |
|
187 |
// sqlStr = sqlStr + i; |
|
188 |
// /* |
|
189 |
// * INSERT INTO Table1 (Column1, Column2, Column3?) |
|
190 |
// * VALUES (Value1, Value2, Value3?) |
|
191 |
// */ |
|
192 |
// try { |
|
193 |
// // dsf.executeSQL(sqlStr, DataSourceFactory.AUTOMATIC_OPENING); |
|
194 |
// execute(sqlStr); |
|
195 |
// theRowCount--; |
|
196 |
// } catch (Exception e) { |
|
197 |
// DriverException de = new DriverException(e.getMessage()); |
|
198 |
// throw de; |
|
199 |
// } |
|
200 |
} |
|
201 |
|
|
202 |
// private String getValueInSqlFormat(Value v) { |
|
203 |
// String tmp = v.getStringValue(internalValueWriter); |
|
204 |
//// if (v instanceof StringValue) { |
|
205 |
//// tmp = "'" + tmp + "'"; |
|
206 |
//// } |
|
207 |
// return tmp; |
|
208 |
// } |
|
209 |
|
|
210 |
private boolean isEmptyRow(int n) { |
|
211 |
return (data.get(n) == null); |
|
212 |
} |
|
213 |
|
|
214 |
public int getRowId(int row) throws DriverException { |
|
215 |
Integer rowid = (Integer) id.get(row); |
|
216 |
return rowid.intValue(); |
|
217 |
// Value[] therow = (Value []) data.get(row); |
|
218 |
// return ((IntValue) therow[idFieldInd]).intValue(); |
|
219 |
// return ((Integer) indexToId.get(new Integer(row))).intValue(); |
|
220 |
} |
|
221 |
|
|
222 |
public int getRowIndex(int id) throws DriverException { |
|
223 |
// logger.debug("Searching for id: " + id); |
|
224 |
return ((Integer) idToIndex.get(new Integer(id))).intValue(); |
|
225 |
} |
|
226 |
|
|
227 |
// public int getRowId(DataSourceFactory dsf, int row) throws DriverException { |
|
228 |
// /* |
|
229 |
// SELECT * FROM Customers WHERE LastName = 'Smith' |
|
230 |
// */ |
|
231 |
// String sqlStr = "select " + idFieldName + " from " + tableName + " where "; |
|
232 |
// sqlStr = sqlStr + rowIndexFieldName + " = "; |
|
233 |
// sqlStr = sqlStr + row + ";"; |
|
234 |
// /* |
|
235 |
// * INSERT INTO Table1 (Column1, Column2, Column3?) |
|
236 |
// * VALUES (Value1, Value2, Value3?) |
|
237 |
// */ |
|
238 |
// DataSource ds = null; |
|
239 |
// try { |
|
240 |
// |
|
241 |
// ds = dsf.executeSQL(sqlStr, DataSourceFactory.AUTOMATIC_OPENING); |
|
242 |
// // int respind = ds.getFieldIndexByName(idFieldName); |
|
243 |
// IntValue resp = (IntValue) ds.getFieldValue(0, 0); |
|
244 |
// return resp.intValue(); |
|
245 |
// } catch (Exception e) { |
|
246 |
// DriverException de = new DriverException(e.getMessage()); |
|
247 |
// throw de; |
|
248 |
// } |
|
249 |
// } |
|
250 |
// |
|
251 |
// public int getRowIndex(DataSourceFactory dsf, int id) throws DriverException { |
|
252 |
// String sqlStr = "select " + rowIndexFieldName + " from " + tableName + " where "; |
|
253 |
// sqlStr = sqlStr + idFieldName + " = "; |
|
254 |
// sqlStr = sqlStr + id + ";"; |
|
255 |
// /* |
|
256 |
// * INSERT INTO Table1 (Column1, Column2, Column3?) |
|
257 |
// * VALUES (Value1, Value2, Value3?) |
|
258 |
// */ |
|
259 |
// DataSource ds = null; |
|
260 |
// try { |
|
261 |
// ds = dsf.executeSQL(sqlStr, DataSourceFactory.AUTOMATIC_OPENING); |
|
262 |
// |
|
263 |
// System.err.println("getRowIndex of id = " + id); |
|
264 |
// System.err.println(ds.getAsString()); |
|
265 |
// System.err.println("------------------------------"); |
|
266 |
// // int respind = ds.getFieldIndexByName(idFieldName); |
|
267 |
// IntValue resp = (IntValue) ds.getFieldValue(0, 0); |
|
268 |
// return resp.intValue(); |
|
269 |
// } catch (Exception e) { |
|
270 |
// DriverException de = new DriverException(e.getMessage()); |
|
271 |
// throw de; |
|
272 |
// } |
|
273 |
// } |
|
274 |
|
|
275 |
public boolean isNonRequestedRow(int rowind) { |
|
276 |
// TODO Auto-generated method stub |
|
277 |
return (! requested.get(rowind)); |
|
278 |
} |
|
279 |
|
|
280 |
// public void updateRow(DataSourceFactory dsf, Value[] new_row, String[] fld_q) throws DriverException { |
|
281 |
// TODO so far, this method is called with |
|
282 |
// a full field query (except rowindex) |
|
283 |
public void updateRow(Value[] upd_row, String[] fld_q, int rowind) throws DriverException { |
|
284 |
|
|
285 |
if (! isEmptyRow(rowind)) { |
|
286 |
int newid = 0; |
|
287 |
int oldid = getRowId(rowind); |
|
288 |
boolean done = false; |
|
289 |
|
|
290 |
for (int i = 0; i < fld_q.length; i++) { |
|
291 |
if (fld_q[i].compareTo(idSqlFieldName) == 0) { |
|
292 |
newid = ((IntValue) upd_row[i]).intValue(); |
|
293 |
done = true; |
|
294 |
} |
|
295 |
} |
|
296 |
if (done) { |
|
297 |
idToIndex.remove(new Integer(oldid)); |
|
298 |
idToIndex.put(new Integer(newid), new Integer(rowind)); |
|
299 |
} |
|
300 |
} |
|
301 |
|
|
302 |
Value[] newrow = new Value[theFieldCount]; |
|
303 |
|
|
304 |
if (data.get(rowind) == null) { |
|
305 |
data.set(rowind, newrow); |
|
306 |
} else { |
|
307 |
newrow = (Value []) data.get(rowind); |
|
308 |
} |
|
309 |
|
|
310 |
if (fld_q[0].compareTo("#ALL#") == 0) { |
|
311 |
for (int i=0; i<upd_row.length; i++) { |
|
312 |
newrow[i] = upd_row[i]; |
|
313 |
} |
|
314 |
} else { |
|
315 |
int fldind = 0; |
|
316 |
for (int i=0; i<fld_q.length; i++) { |
|
317 |
String sqlname = replaceUnwantedCharacters(fld_q[i]); |
|
318 |
fldind = getFieldIndexByName(sqlname); |
|
319 |
newrow[fldind] = upd_row[i]; |
|
320 |
} |
|
321 |
} |
|
322 |
|
|
323 |
// data.set() |
|
324 |
// String[] fld_query = null; |
|
325 |
// if (fld_q[0].compareTo("#ALL#") == 0) { |
|
326 |
// |
|
327 |
// int count = getFieldCount() - 1; |
|
328 |
// fld_query = new String[count]; |
|
329 |
// for (int i=0; i<count; i++) { |
|
330 |
// fld_query[i] = getFieldName(i); |
|
331 |
// } |
|
332 |
// |
|
333 |
// |
|
334 |
// } else { |
|
335 |
// fld_query = new String[fld_q.length]; |
|
336 |
// for (int i=0; i<fld_q.length; i++) { |
|
337 |
// fld_query[i] = ArcImsSqlUtils.getSqlCompliantFieldName(fld_q[i]); |
|
338 |
// } |
|
339 |
// } |
|
340 |
// |
|
341 |
// IntValue id = null; |
|
342 |
// for (int i=0; i<fld_query.length; i++) { |
|
343 |
// if (fld_query[i].compareTo(idFieldName) == 0) { |
|
344 |
// id = (IntValue) new_row[i]; |
|
345 |
// } |
|
346 |
// } |
|
347 |
// if (id == null) { |
|
348 |
// DriverException de = new DriverException("id_not_found"); |
|
349 |
// throw de; |
|
350 |
// } |
|
351 |
// int intid = id.intValue(); |
|
352 |
// |
|
353 |
// String sqlStr = "update " + tableName + " set "; |
|
354 |
// String nthFieldName, nthFieldValue; |
|
355 |
// for (int i=0; i<fld_query.length; i++) { |
|
356 |
// nthFieldName = fld_query[i]; |
|
357 |
// nthFieldValue = this.getValueInSqlFormat(new_row[i]); |
|
358 |
// sqlStr = sqlStr + nthFieldName + " = "; |
|
359 |
// sqlStr = sqlStr + nthFieldValue + ", "; |
|
360 |
// } |
|
361 |
// sqlStr = sqlStr.substring(0, sqlStr.length() - 2); |
|
362 |
// sqlStr = sqlStr + " where " + idFieldName + " = " + intid + ";"; |
|
363 |
// try { |
|
364 |
// // dsf.executeSQL(sqlStr, DataSourceFactory.AUTOMATIC_OPENING); |
|
365 |
// execute(sqlStr); |
|
366 |
// } catch (Exception e) { |
|
367 |
// DriverException de = new DriverException(e.getMessage()); |
|
368 |
// throw de; |
|
369 |
// } |
|
370 |
} |
|
371 |
|
|
372 |
public int getFieldIndexByName(String arg0) throws DriverException { |
|
373 |
// String arg00 = ArcImsSqlUtils.getSqlCompliantFieldName(arg0); |
|
374 |
if (arg0 == null) { |
|
375 |
logger.error("Somebody asked for the index of a null field "); |
|
376 |
return -1; |
|
377 |
} |
|
378 |
for (int i=0; i<sqlColumnNames.size(); i++) { |
|
379 |
if (((String) sqlColumnNames.get(i)).compareTo(arg0) == 0) { |
|
380 |
return i; |
|
381 |
} |
|
382 |
} |
|
383 |
logger.error("Field not found "); |
|
384 |
return -1; |
|
385 |
} |
|
386 |
|
|
387 |
public Value[] getRow(DataSourceFactory dsf, int n) throws DriverException { |
|
388 |
return (Value []) data.get(n); |
|
389 |
// String sqlStr = "select * from " + tableName + " where "; |
|
390 |
// sqlStr = sqlStr + rowIndexFieldName + " = " + n + ";"; |
|
391 |
// |
|
392 |
// try { |
|
393 |
// DataSource ds = |
|
394 |
// dsf.executeSQL(sqlStr, DataSourceFactory.AUTOMATIC_OPENING); |
|
395 |
// // int respind = ds.getFieldIndexByName(idFieldName); |
|
396 |
// int count = ds.getFieldCount(); |
|
397 |
// Value[] resp = new Value[count]; |
|
398 |
// for (int i=0; i<count; i++) { |
|
399 |
// resp[i] = ds.getFieldValue(0, i); |
|
400 |
// } |
|
401 |
// return resp; |
|
402 |
// } catch (Exception e) { |
|
403 |
// DriverException de = new DriverException(e.getMessage()); |
|
404 |
// throw de; |
|
405 |
// } |
|
406 |
} |
|
407 |
|
|
408 |
// public String getRowIndexFieldName() { |
|
409 |
// return rowIndexFieldName; |
|
410 |
// } |
|
411 |
|
|
412 |
public void setRequested(int n, boolean req) { |
|
413 |
requested.set(n, req); |
|
414 |
} |
|
415 |
|
|
416 |
public void addTheseAsRequested(FBitSet fbs) { |
|
417 |
requested.or(fbs); |
|
418 |
} |
|
419 |
|
|
420 |
public long getRowCount() { |
|
421 |
return (long) data.size(); |
|
422 |
} |
|
423 |
|
|
424 |
public int getFieldCount() { |
|
425 |
return theFieldCount; |
|
426 |
} |
|
427 |
|
|
428 |
public String getFieldName(int i) { |
|
429 |
return (String) sqlColumnNames.get(i); |
|
430 |
} |
|
431 |
|
|
432 |
public int getFieldType(int i) { |
|
433 |
return ((Integer) columnTypes.get(i)).intValue(); |
|
434 |
} |
|
435 |
|
|
436 |
// public void addInIndexToIdHashMap(int rwcount, int i) { |
|
437 |
// indexToId.put(new Integer(rwcount), new Integer (i)); |
|
438 |
// } |
|
439 |
|
|
440 |
public void addInIdToIndexHashMap(int i, int rwcount) { |
|
441 |
idToIndex.put(new Integer (i), new Integer(rwcount)); |
|
442 |
} |
|
443 |
|
|
444 |
// public String getColumnName(int i) { |
|
445 |
// return (String) columnNames.get(i); |
|
446 |
// } |
|
447 |
|
|
448 |
// public void increaseRowCount(boolean req) { |
|
449 |
// requested.set(data.size(), req); |
|
450 |
// theRowCount++; |
|
451 |
// } |
|
452 |
|
|
453 |
public void addAsRequested(FBitSet fbs) { |
|
454 |
requested.or(fbs); |
|
455 |
} |
|
456 |
|
|
457 |
public FBitSet getThisAndNonRequestedUpTo(int _thisone, int total) { |
|
458 |
|
|
459 |
int thisone = _thisone; |
|
460 |
int rowcount = (int) getRowCount(); |
|
461 |
|
|
462 |
if (_thisone >= rowcount) { |
|
463 |
thisone = _thisone % rowcount; |
|
464 |
} |
|
465 |
|
|
466 |
FBitSet fbs = new FBitSet(); |
|
467 |
fbs.set(thisone); |
|
468 |
if (total < 2) return fbs; |
|
469 |
|
|
470 |
int othersMustBeSet = total - 1; |
|
471 |
int checkind; |
|
472 |
|
|
473 |
for (int j=1; j<rowcount; j++) { |
|
474 |
// checkind = (i + j) % noOfRows; |
|
475 |
checkind = (thisone + j) % rowcount; |
|
476 |
if (isNonRequestedRow(checkind)) { |
|
477 |
fbs.set(checkind); |
|
478 |
othersMustBeSet--; |
|
479 |
} |
|
480 |
if (othersMustBeSet == 0) break; |
|
481 |
} |
|
482 |
return fbs; |
|
483 |
} |
|
484 |
|
|
485 |
public void addEmptyRowWithId(Value idval, String idcolname) { |
|
486 |
data.add(null); |
|
487 |
id.add(new Integer( ((IntValue) idval).intValue() )); |
|
488 |
} |
|
489 |
|
|
490 |
public Value getFieldValue(long row, int colind) { |
|
491 |
|
|
492 |
// printLastAndUpdate(row, colind); |
|
493 |
|
|
494 |
if (row >= getRowCount() || (row < 0)) { |
|
495 |
logger.error("Row index out of limits "); |
|
496 |
return null; |
|
497 |
} |
|
498 |
|
|
499 |
Value[] therow = (Value []) data.get((int) row); |
|
500 |
|
|
501 |
if (therow == null) { |
|
502 |
logger.error("Tried to get non available value (?) "); |
|
503 |
return null; |
|
504 |
} |
|
505 |
if ((colind >= therow.length) || (colind < 0)) { |
|
506 |
logger.error("Field index out of limits "); |
|
507 |
return null; |
|
508 |
} |
|
509 |
if (therow[colind] == null) { |
|
510 |
logger.warn("In order to avoid returning element [ " + row + ", " + colind + " ] (which is null), returned ValueFactory.createNullValue()"); |
|
511 |
return ValueFactory.createNullValue(); |
|
512 |
} else { |
|
513 |
return therow[colind]; |
|
514 |
} |
|
515 |
} |
|
516 |
|
|
517 |
private void printLastAndUpdate(long row, int colind) { |
|
518 |
logger.debug("Last request: [ " + lastRequest.height + " , " + lastRequest.width + " ]"); |
|
519 |
lastRequest.height = (int) row; |
|
520 |
lastRequest.width = colind; |
|
521 |
logger.debug("Current request: [ " + lastRequest.height + " , " + lastRequest.width + " ]"); |
|
522 |
} |
|
523 |
// public Value getCachedValue(int row, int attind) { |
|
524 |
// return attsCache.getAttribute(row, attind); |
|
525 |
// } |
|
526 |
// |
|
527 |
// public void setCachedValue(int row, int attind, Value v) { |
|
528 |
// attsCache.addToCache(row, attind, v); |
|
529 |
// } |
|
530 |
public int getIdColumnInd(ArrayList col_Types) { |
|
531 |
|
|
532 |
int coltype, idindex = -1; |
|
533 |
for (int i=0; i<col_Types.size(); i++) { |
|
534 |
coltype = ((Integer) col_Types.get(i)).intValue(); |
|
535 |
if (coltype == FieldInformation.ID) { |
|
536 |
idindex = i; |
|
537 |
break; |
|
538 |
} |
|
539 |
} |
|
540 |
if (idindex == -1) { |
|
541 |
logger.error("ID not found "); |
|
542 |
} |
|
543 |
return idindex; |
|
544 |
} |
|
545 |
|
|
546 |
public String getTableName() { |
|
547 |
return tableName; |
|
548 |
} |
|
549 |
|
|
550 |
public static String replaceUnwantedCharacters(String str) { |
|
551 |
String resp = str; |
|
552 |
resp = resp.replace('.', '_'); |
|
553 |
resp = resp.replace('#', 'z'); |
|
554 |
|
|
555 |
return resp; |
|
556 |
} |
|
557 |
|
|
558 |
public String getOriginalFieldName(int idcolindex) { |
|
559 |
return (String) originalColumnNames.get(idcolindex); |
|
560 |
} |
|
561 |
|
|
562 |
public String getSqlFieldName(int idcolindex) { |
|
563 |
return (String) sqlColumnNames.get(idcolindex); |
|
564 |
} |
|
565 |
|
|
566 |
|
|
567 |
} |
|
0 | 568 |
tags/BN73/extensions/extArcims/src/es/prodevelop/cit/gvsig/arcims/fmap/drivers/FMapRasterArcImsDriver.java | ||
---|---|---|
1 |
package es.prodevelop.cit.gvsig.arcims.fmap.drivers; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.net.URL; |
|
5 |
import java.util.TreeMap; |
|
6 |
|
|
7 |
import org.apache.log4j.Logger; |
|
8 |
import org.gvsig.remoteClient.arcims.*; |
|
9 |
import org.gvsig.remoteClient.arcims.exceptions.ArcImsException; |
|
10 |
import org.gvsig.remoteClient.exceptions.ServerErrorException; |
|
11 |
import org.gvsig.remoteClient.wms.ICancellable; |
|
12 |
|
|
13 |
import es.prodevelop.cit.gvsig.arcims.fmap.layers.ArcImsLayerNode; |
|
14 |
|
|
15 |
/** |
|
16 |
* ArcIMS driver implementation. Requests are passed to the <tt>ArcImsClientP</tt> object. |
|
17 |
* |
|
18 |
* @see org.gvsig.remoteClient.arcims.ArcImsImageClient ArcImsImageClient |
|
19 |
* @author jldominguez |
|
20 |
*/ |
|
21 |
public class FMapRasterArcImsDriver implements ArcImsDriver { |
|
22 |
|
|
23 |
private static Logger logger = Logger.getLogger(FMapRasterArcImsDriver.class.getName()); |
|
24 |
|
|
25 |
|
|
26 |
private ArcImsImageClient client; |
|
27 |
private String server; |
|
28 |
private String service; |
|
29 |
private String serviceType; |
|
30 |
|
|
31 |
private boolean connectionDone = false; |
|
32 |
|
|
33 |
public FMapRasterArcImsDriver() { |
|
34 |
} |
|
35 |
|
|
36 |
/** |
|
37 |
* The constructor needs the server's URL and the name of the service to be used. |
|
38 |
* |
|
39 |
* @param host server's URL |
|
40 |
* @param service name of the service, chosen among the ones retrieved after a |
|
41 |
* request with the parameter <tt>ServiceName=Catalog</tt> |
|
42 |
*/ |
|
43 |
public FMapRasterArcImsDriver(String host, String service, String svcType) { |
|
44 |
serviceType = svcType; |
|
45 |
init(host, service); |
|
46 |
} |
|
47 |
|
|
48 |
/** |
|
49 |
* This method is called by the constructor and creates the |
|
50 |
* <tt>client</tt> oject. |
|
51 |
* @param host |
|
52 |
* @param service |
|
53 |
*/ |
|
54 |
public void init(String host, String service) { |
|
55 |
server = host; |
|
56 |
this.service = service; |
|
57 |
client = new ArcImsImageClient(host, service, this.serviceType); |
|
58 |
} |
|
59 |
|
|
60 |
/** |
|
61 |
* Gets available layers from the current server and service |
|
62 |
* |
|
63 |
* @return a TreeMap with available layers |
|
64 |
*/ |
|
65 |
public TreeMap getLayers() { |
|
66 |
return client.getLayers(); |
|
67 |
} |
|
68 |
|
|
69 |
/** |
|
70 |
* Gets the layers available on the server (the class that implements |
|
71 |
* this interface will get the service name from the user) |
|
72 |
* |
|
73 |
* @param server ArcIMS server's URL |
|
74 |
*/ |
|
75 |
public void getCapabilities(URL server, ICancellable cancel) throws ArcImsException { |
|
76 |
|
|
77 |
if (connectionDone) { |
|
78 |
return; |
|
79 |
} else { |
|
80 |
connectionDone = getClient().connect(server, cancel); |
|
81 |
} |
|
82 |
|
|
83 |
if (! connectionDone) { |
|
84 |
throw new ArcImsException("connect_error"); |
|
85 |
} |
|
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* Gets the visual information from the layers of |
|
90 |
* the required service (that is, the map itself) depending |
|
91 |
* on the graphic context (coord. system, view's size, etc) |
|
92 |
* |
|
93 |
* @param status the graphic context in which the request is performed |
|
94 |
* @return the graphic data to be viewed, that is, the map. For the imageservice, |
|
95 |
* it will be a <tt>File</tt> object. |
|
96 |
*/ |
|
97 |
public Object getMap(ArcImsStatus status) throws ArcImsException { |
|
98 |
try { |
|
99 |
return client.getMap(status); |
|
100 |
} catch (ServerErrorException e) { |
|
101 |
logger.error("While getting map ", e); |
|
102 |
throw new ArcImsException("ArcIMS Unexpected server error." |
|
103 |
+ e.getMessage()); |
|
104 |
} |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* Gets the layer's available information on a particular xy coordinates |
|
109 |
* (usually derived from a mouse click). If it's a raster layer, |
|
110 |
* a request will be sent to the server asking for the data associated |
|
111 |
* to the elements (polygon, line or point) which cover the clicked |
|
112 |
* pixel. |
|
113 |
* |
|
114 |
* @param status the graphic context in which the request is performed |
|
115 |
* (ccord. system, view's dimension etc.) |
|
116 |
* @param i x coordinate of the queried pixel |
|
117 |
* @param j y coordinate of the queried pixel |
|
118 |
* @param max_value maximun number of vector elements whose information |
|
119 |
* will be retrieved. |
|
120 |
* @return the available information at the given coordinates |
|
121 |
*/ |
|
122 |
public String getFeatureInfo(ArcImsStatus status, int i, int j, int max_value) throws ArcImsException { |
|
123 |
String r = "No info available."; |
|
124 |
try { |
|
125 |
r = client.getFeatureInfo(status, i, j, max_value); |
|
126 |
} catch (ArcImsException e) { |
|
127 |
logger.error("ArcImsException. ", e); |
|
128 |
throw e; |
|
129 |
} |
|
130 |
return r; |
|
131 |
} |
|
132 |
|
|
133 |
/** |
|
134 |
* Given a layer name, gets a node that contains relevant information |
|
135 |
* about the layer. |
|
136 |
* |
|
137 |
* @param layerName the name of the layer |
|
138 |
* @return a node with layer's information |
|
139 |
*/ |
|
140 |
public ArcImsLayerNode getLayer(String layerName) { |
|
141 |
ArcImsLayerNode node = new ArcImsLayerNode(); |
|
142 |
node.setName(layerName); |
|
143 |
return node; |
|
144 |
} |
|
145 |
|
|
146 |
/** |
|
147 |
* This method starts a connection with the server and sends |
|
148 |
* a <tt>getCapabilities</tt> request. |
|
149 |
* @return <b>true</b> if the connection was successful, <b>false</b> |
|
150 |
* otherwise (bad or no server URL, for example) |
|
151 |
*/ |
|
152 |
public boolean connect(ICancellable cancel) { |
|
153 |
if (connectionDone) { |
|
154 |
return true; |
|
155 |
} else { |
|
156 |
connectionDone = client.connect(cancel);; |
|
157 |
return connectionDone; |
|
158 |
} |
|
159 |
} |
|
160 |
|
|
161 |
/** |
|
162 |
* Gets the <tt>ArcImsClientP</tt> object, onto which requests |
|
163 |
* are passed. |
|
164 |
* |
|
165 |
* @return the object that actually performs requests. |
|
166 |
*/ |
|
167 |
public ArcImsClientP getClient() { |
|
168 |
if (client == null) { |
|
169 |
init(server, service); |
|
170 |
} |
|
171 |
return client; |
|
172 |
} |
|
173 |
|
|
174 |
/** |
|
175 |
* This method tells whether this layer is queriable with a call to |
|
176 |
* <tt>getFeatureInfo(...)</tt> |
|
177 |
* |
|
178 |
* @return <b>true</b> if method <tt>getFeatureInfo(...)</tt> can be invoqued, |
|
179 |
* <b>false</b> otherwise |
|
180 |
*/ |
|
181 |
public boolean isQueryable() { |
|
182 |
return client.isQueryable(); |
|
183 |
} |
|
184 |
|
|
185 |
public boolean testFormat(ArcImsStatus status, String imgFormat) { |
|
186 |
|
|
187 |
try { |
|
188 |
return client.testFromat(status, imgFormat); |
|
189 |
} catch (ArcImsException e) { |
|
190 |
logger.error("While testing omage format ", e); |
|
191 |
} |
|
192 |
return false; |
|
193 |
} |
|
194 |
} |
|
0 | 195 |
tags/BN73/extensions/extArcims/src/es/prodevelop/cit/gvsig/arcims/fmap/drivers/ArcImsRasterAdapter.java | ||
---|---|---|
1 |
package es.prodevelop.cit.gvsig.arcims.fmap.drivers; |
|
2 |
|
|
3 |
import com.iver.cit.gvsig.fmap.layers.RasterAdapter; |
|
4 |
|
|
5 |
public class ArcImsRasterAdapter extends RasterAdapter { |
|
6 |
|
|
7 |
public ArcImsRasterAdapter(ArcImsRasterDriver drv) { |
|
8 |
setDriver(drv); |
|
9 |
} |
|
10 |
|
|
11 |
} |
|
0 | 12 |
tags/BN73/extensions/extArcims/src/es/prodevelop/cit/gvsig/arcims/fmap/drivers/ArcImsAttributesDataSourceAdapter.java | ||
---|---|---|
1 |
package es.prodevelop.cit.gvsig.arcims.fmap.drivers; |
|
2 |
|
|
3 |
import java.io.File; |
|
4 |
import java.io.IOException; |
|
5 |
import java.sql.SQLException; |
|
6 |
import java.sql.Types; |
|
7 |
import java.util.ArrayList; |
|
8 |
import java.util.BitSet; |
|
9 |
import java.util.HashMap; |
|
10 |
|
|
11 |
import org.apache.log4j.Logger; |
|
12 |
import org.gvsig.remoteClient.arcims.exceptions.ArcImsException; |
|
13 |
import org.gvsig.remoteClient.arcims.utils.FieldInformation; |
|
14 |
import org.gvsig.remoteClient.arcims.utils.GetFeaturesTags; |
|
15 |
|
|
16 |
import com.hardcode.driverManager.Driver; |
|
17 |
import com.hardcode.driverManager.DriverLoadException; |
|
18 |
import com.hardcode.gdbms.engine.data.DataSource; |
|
19 |
import com.hardcode.gdbms.engine.data.DataSourceFactory; |
|
20 |
import com.hardcode.gdbms.engine.data.IDataSourceListener; |
|
21 |
import com.hardcode.gdbms.engine.data.SourceInfo; |
|
22 |
import com.hardcode.gdbms.engine.data.driver.DriverException; |
|
23 |
import com.hardcode.gdbms.engine.data.driver.ObjectDriver; |
|
24 |
import com.hardcode.gdbms.engine.data.edition.DataWare; |
|
25 |
import com.hardcode.gdbms.engine.data.object.ObjectSourceInfo; |
|
26 |
import com.hardcode.gdbms.engine.data.persistence.DataSourceLayerMemento; |
|
27 |
import com.hardcode.gdbms.engine.data.persistence.Memento; |
|
28 |
import com.hardcode.gdbms.engine.data.persistence.MementoException; |
|
29 |
import com.hardcode.gdbms.engine.instruction.EvaluationException; |
|
30 |
import com.hardcode.gdbms.engine.instruction.SemanticException; |
|
31 |
import com.hardcode.gdbms.engine.values.IntValue; |
|
32 |
import com.hardcode.gdbms.engine.values.Value; |
|
33 |
import com.hardcode.gdbms.engine.values.ValueCollection; |
|
34 |
import com.hardcode.gdbms.engine.values.ValueFactory; |
|
35 |
import com.hardcode.gdbms.parser.ParseException; |
|
36 |
import com.iver.cit.gvsig.fmap.layers.FBitSet; |
|
37 |
|
|
38 |
import es.prodevelop.cit.gvsig.arcims.gui.wizards.ArcImsWizard; |
|
39 |
|
|
40 |
public class ArcImsAttributesDataSourceAdapter implements ArcImsAlphanumericDataSource, ObjectDriver { |
|
41 |
|
|
42 |
private static Logger logger = Logger.getLogger(ArcImsAttributesDataSourceAdapter.class.getName()); |
|
43 |
|
|
44 |
private ArcImsInMemoryAttsTableDriver dataDriver; |
|
45 |
// private File csvFile; |
|
46 |
private String tableName; |
|
47 |
private DataSourceFactory dsFactory = null; |
|
48 |
private ObjectSourceInfo sourceInfo; |
|
49 |
private FMapFeatureArcImsDriver parentDriver; |
|
50 |
private int rowsPerRequest = 10; |
|
51 |
// private int privateKeyIndex = 0; |
|
52 |
|
|
53 |
// array of Value[] |
|
54 |
// private AttributesDataa attsData; |
|
55 |
|
|
56 |
public ArcImsAttributesDataSourceAdapter(ArrayList col_Names, ArrayList col_Types, |
|
57 |
Value[] ids, DataSourceFactory dsf, FMapFeatureArcImsDriver drv, String forcedName) { |
|
58 |
|
|
59 |
// attsData = new AttributesDataa(col_Names, col_Types, ids, drv); |
|
60 |
|
|
61 |
parentDriver = drv; |
|
62 |
dsFactory = dsf; |
|
63 |
|
|
64 |
if (forcedName == null) { |
|
65 |
long timeid = System.currentTimeMillis(); |
|
66 |
tableName = "table_" + timeid; |
|
67 |
} else { |
|
68 |
tableName = forcedName; |
|
69 |
} |
|
70 |
|
|
71 |
dataDriver = new ArcImsInMemoryAttsTableDriver(tableName, col_Names, col_Types); |
|
72 |
|
|
73 |
sourceInfo = new ObjectSourceInfo(); |
|
74 |
sourceInfo.driver = this; |
|
75 |
sourceInfo.name = tableName; |
|
76 |
sourceInfo.driverName = dataDriver.getName(); |
|
77 |
|
|
78 |
// dsFactory = new DataSourceFactory(); |
|
79 |
// dsFactory.initialize(); |
|
80 |
// dsFactory.addDataSource(this, tableName); |
|
81 |
|
|
82 |
// dsFactory.crea |
|
83 |
|
|
84 |
try { |
|
85 |
// dataDriver.open(dataDriver.getConnection(), tableName); |
|
86 |
|
|
87 |
// String sqlStr = ArcImsSqlUtils.getSqlSentenceCreateTableWithFieldsAndTypes(tableName, col_Names, col_Types, dataDriver.getRowIndexFieldName()); |
|
88 |
// dataDriver.open(sqlStr); |
|
89 |
|
|
90 |
// sqlStr = ArcImsSqlUtils.getSqlSentenceCreateIndex(tableName); |
|
91 |
// dataDriver.execute(sqlStr); |
|
92 |
// dsFactory.executeSQL(sqlStr, DataSourceFactory.DATA_WARE_COHERENT_ROW_ORDER); |
|
93 |
|
|
94 |
String idcolname = getIdColumnName(col_Names, col_Types); |
|
95 |
for (int i=0; i<ids.length; i++) { |
|
96 |
Value id = ids[i]; |
|
97 |
int rwcount = (int) dataDriver.getRowCount(); |
|
98 |
// sqlStr = ArcImsSqlUtils.getSqlSentenceSetEmptyRowWithId( |
|
99 |
// tableName, id, idcolname, |
|
100 |
// rwcount, |
|
101 |
// dataDriver.getRowIndexFieldName()); |
|
102 |
dataDriver.addEmptyRowWithId(id, idcolname); |
|
103 |
// dataDriver.addInIndexToIdHashMap(rwcount, ((IntValue) id).intValue()); |
|
104 |
// logger.debug("Adding id = " + ((IntValue) id).intValue() + " in row = " + rwcount); |
|
105 |
dataDriver.addInIdToIndexHashMap(((IntValue) id).intValue(), rwcount); |
|
106 |
// dsFactory.executeSQL(sqlStr, DataSourceFactory.DATA_WARE_DIRECT_MODE); |
|
107 |
// dataDriver.execute(sqlStr); |
|
108 |
// dataDriver.increaseRowCount(false); |
|
109 |
} |
|
110 |
logger.info("Stored " + ids.length + " IDs"); |
|
111 |
setRowsPerRequest(); |
|
112 |
// String idcolname = dataDriver.executeCreateTableWithFieldsAndTypes(tableName, col_Names, col_Types); |
|
113 |
// dataDriver.executeSetEmptyRowsWithIds(tableName, ids, idcolname); |
|
114 |
// System.err.println("dataDriver.getFieldValue(0, 0) = " + dataDriver.getFieldValue(0, 0).getStringValue(dataDriver.internalValueWriter)); |
|
115 |
// getRowId(5); |
|
116 |
// stop(); |
|
117 |
// logger.debug("Done: dataDriver.close();"); |
|
118 |
|
|
119 |
} catch (Exception e) { |
|
120 |
logger.error("While creating in-memory database ", e); |
|
121 |
} |
|
122 |
|
|
123 |
} |
|
124 |
|
|
125 |
public void deleteRow(long rowInd) throws DriverException { |
|
126 |
// DriverException de = new DriverException("cannot_delete"); |
|
127 |
logger.warn("So far, you cannot delete "); |
|
128 |
// throw de; |
|
129 |
// // dataDriver.setRequested((int) rowInd, false); |
|
130 |
// start(); |
|
131 |
// dataDriver.deleteRow(dsFactory, (int) rowInd); |
|
132 |
// stop(); |
|
133 |
// // dataDriver.deleteRow(dsFactory, (int) rowInd); |
|
134 |
} |
|
135 |
|
|
136 |
public void insertFilledRowAt(long index, Value[] values) throws DriverException { |
|
137 |
insertFilledRowAt(index, values, true); |
|
138 |
} |
|
139 |
|
|
140 |
public void insertFilledRowAt(long index, Value[] values, boolean req) throws DriverException { |
|
141 |
// dataDriver.setRequested((int) dataDriver.getRowCount(), req); |
|
142 |
// start(); |
|
143 |
dataDriver.addRow(values, req); |
|
144 |
// stop(); |
|
145 |
logger.warn("Row was added at the end (not inserted at position " + index + ")"); |
|
146 |
// this. |
|
147 |
// dataDriver.addRow(dsFactory, values); |
Also available in: Unified diff