Revision 42058
tags/org.gvsig.desktop-2.0.88/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/test/java/org/gvsig/fmap/mapcontext/persistence/MapContextPersistenceTest.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.fmap.mapcontext.persistence; |
|
25 |
|
|
26 |
import java.awt.Color; |
|
27 |
import java.awt.Dimension; |
|
28 |
import java.awt.geom.Rectangle2D; |
|
29 |
import java.io.File; |
|
30 |
import java.io.FileInputStream; |
|
31 |
import java.io.FileOutputStream; |
|
32 |
|
|
33 |
import org.gvsig.fmap.crs.CRSFactory; |
|
34 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
35 |
import org.gvsig.fmap.geom.Geometry; |
|
36 |
import org.gvsig.fmap.geom.Geometry.TYPES; |
|
37 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
38 |
import org.gvsig.fmap.geom.exception.CreateEnvelopeException; |
|
39 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
40 |
import org.gvsig.fmap.mapcontext.MapContext; |
|
41 |
import org.gvsig.fmap.mapcontext.MapContextLocator; |
|
42 |
import org.gvsig.fmap.mapcontext.ViewPort; |
|
43 |
import org.gvsig.fmap.mapcontext.exceptions.LegendLayerException; |
|
44 |
import org.gvsig.fmap.mapcontext.layers.FLayer; |
|
45 |
import org.gvsig.fmap.mapcontext.layers.FLayers; |
|
46 |
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect; |
|
47 |
import org.gvsig.fmap.mapcontext.rendering.legend.ILegend; |
|
48 |
import org.gvsig.fmap.mapcontext.rendering.legend.IVectorLegend; |
|
49 |
import org.gvsig.fmap.mapcontext.rendering.symbol.DummyVectorLegend; |
|
50 |
import org.gvsig.tools.ToolsLocator; |
|
51 |
import org.gvsig.tools.junit.AbstractLibraryAutoInitTestCase; |
|
52 |
import org.gvsig.tools.locator.LocatorException; |
|
53 |
import org.gvsig.tools.persistence.Persistent; |
|
54 |
import org.gvsig.tools.persistence.PersistentState; |
|
55 |
import org.slf4j.Logger; |
|
56 |
import org.slf4j.LoggerFactory; |
|
57 |
|
|
58 |
public class MapContextPersistenceTest extends AbstractLibraryAutoInitTestCase { |
|
59 |
|
|
60 |
final static private Logger logger = |
|
61 |
LoggerFactory.getLogger(MapContextPersistenceTest.class); |
|
62 |
|
|
63 |
protected void doSetUp() throws Exception { |
|
64 |
DummyVectorLegend.registerPersistent(); |
|
65 |
DummyDBFeatureStore.registerPersistent(); |
|
66 |
DummyFileFeatureStore.registerPersistent(); |
|
67 |
|
|
68 |
MapContextLocator.getMapContextManager().registerLegend("DummyLegend", |
|
69 |
DummyVectorLegend.class); |
|
70 |
MapContextLocator.getMapContextManager().setDefaultVectorLegend( |
|
71 |
"DummyLegend"); |
|
72 |
} |
|
73 |
|
|
74 |
private File getTempFile() throws Exception { |
|
75 |
|
|
76 |
File tempFile = File.createTempFile("persisted_mapcontext", ".xml"); |
|
77 |
if (tempFile.exists()) |
|
78 |
tempFile.delete(); |
|
79 |
tempFile.createNewFile(); |
|
80 |
|
|
81 |
System.out.println("TEMP FILE: " + tempFile.getAbsolutePath()); |
|
82 |
return tempFile; |
|
83 |
} |
|
84 |
|
|
85 |
public void testMapContext() throws Exception { |
|
86 |
ViewPort vp = getViewPort(); |
|
87 |
logger.debug("Creating mapcontext..."); |
|
88 |
MapContext mc = new MapContext(vp); |
|
89 |
addDummyLayers(mc); |
|
90 |
doTestPersist(mc); |
|
91 |
} |
|
92 |
|
|
93 |
public void noTestFLyrs() throws Exception { |
|
94 |
|
|
95 |
int lyr_count = 3; |
|
96 |
// testPersist(mc); |
|
97 |
FLyrVect[] lyr = new FLyrVect[lyr_count]; |
|
98 |
FeatureStore[] fs = new FeatureStore[lyr_count]; |
|
99 |
FLayers lyrs = new FLayers(); |
|
100 |
|
|
101 |
for (int i=0; i<lyr_count; i++) { |
|
102 |
fs[i] = new DummyFileFeatureStore("" + System.currentTimeMillis()); |
|
103 |
lyr[i] = createLayer(fs[i]); |
|
104 |
lyr[i].setName("Layer " + (i+System.currentTimeMillis())); |
|
105 |
lyr[i].setIsLabeled(false); |
|
106 |
try { lyr[i].setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { |
|
107 |
assertTrue("Error while creating legend: " + e.getMessage(), false); |
|
108 |
} |
|
109 |
lyrs.addLayer(lyr[i]); |
|
110 |
lyr[i].dispose(); |
|
111 |
} |
|
112 |
|
|
113 |
for (int i=0; i<lyr_count; i++) { |
|
114 |
fs[i] = new DummyDBFeatureStore("" + System.currentTimeMillis()); |
|
115 |
lyr[i] = createLayer(fs[i]); |
|
116 |
lyr[i].setName("Layer " + (10000 + i + System.currentTimeMillis())); |
|
117 |
lyr[i].setIsLabeled(false); |
|
118 |
try { lyr[i].setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { |
|
119 |
assertTrue("Error while creating legend: " + e.getMessage(), false); |
|
120 |
} |
|
121 |
lyrs.addLayer(lyr[i]); |
|
122 |
lyr[i].dispose(); |
|
123 |
} |
|
124 |
|
|
125 |
doTestPersist(lyrs); |
|
126 |
} |
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
private ViewPort getViewPort() throws LocatorException, CreateEnvelopeException { |
|
131 |
|
|
132 |
ViewPort vp = new ViewPort(CRSFactory.getCRS("EPSG:4326")); |
|
133 |
vp.setImageSize(new Dimension(640, 480)); |
|
134 |
Envelope env = createEnvelope2D(0, 0, 1000000, 1000000); |
|
135 |
vp.setEnvelope(env); |
|
136 |
env = createEnvelope2D(200000, 200000, 500000, 500000); |
|
137 |
vp.setEnvelope(env); |
|
138 |
env = createEnvelope2D(300000, 300000, 300000, 300000); |
|
139 |
vp.setEnvelope(env); |
|
140 |
env = createEnvelope2D(400000, 400000, 200000, 200000); |
|
141 |
vp.setEnvelope(env); |
|
142 |
env = createEnvelope2D(440000, 440000, 100000, 100000); |
|
143 |
vp.setEnvelope(env); |
|
144 |
env = createEnvelope2D(480000, 480000, 30000, 30000); |
|
145 |
vp.setEnvelope(env); |
|
146 |
vp.setBackColor(Color.YELLOW); |
|
147 |
vp.setClipRect(new Rectangle2D.Double(0, 0, 10, 10)); |
|
148 |
return vp; |
|
149 |
} |
|
150 |
|
|
151 |
private Envelope createEnvelope2D(double minX,double minY,double maxX, double maxY) throws LocatorException, CreateEnvelopeException { |
|
152 |
return GeometryLocator.getGeometryManager().createEnvelope(minX, minY, maxX, maxY, Geometry.SUBTYPES.GEOM2D); |
|
153 |
} |
|
154 |
|
|
155 |
private void addDummyLayers(MapContext mcon) throws Exception { |
|
156 |
|
|
157 |
FLayers resp = new FLayers(); |
|
158 |
resp.setMapContext(mcon); |
|
159 |
resp.setName("root layer"); |
|
160 |
|
|
161 |
FLayers aux = new FLayers(); |
|
162 |
aux.setMapContext(mcon); |
|
163 |
aux.setName("Group"); |
|
164 |
|
|
165 |
FLyrVect lyr = null; |
|
166 |
IVectorLegend lgn = null; |
|
167 |
FeatureStore fs = null; |
|
168 |
|
|
169 |
logger.debug("Adding dummy layers..."); |
|
170 |
|
|
171 |
fs = new DummyFileFeatureStore("1"); |
|
172 |
lyr = createLayer(fs); |
|
173 |
lyr.setName("Layer 1"); |
|
174 |
try { lyr.setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { } |
|
175 |
|
|
176 |
aux.addLayer(lyr); |
|
177 |
lyr.dispose(); |
|
178 |
|
|
179 |
fs = new DummyDBFeatureStore("A"); |
|
180 |
lyr = createLayer(fs); |
|
181 |
lyr.setName("Layer A"); |
|
182 |
try { lyr.setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { } |
|
183 |
|
|
184 |
aux.addLayer(lyr); |
|
185 |
lyr.dispose(); |
|
186 |
|
|
187 |
fs = new DummyFileFeatureStore("2"); |
|
188 |
lyr = createLayer(fs); |
|
189 |
lyr.setName("Layer 2"); |
|
190 |
try { lyr.setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { } |
|
191 |
|
|
192 |
aux.addLayer(lyr); |
|
193 |
lyr.dispose(); |
|
194 |
|
|
195 |
fs = new DummyDBFeatureStore("B"); |
|
196 |
lyr = createLayer(fs); |
|
197 |
lyr.setName("Layer 1"); |
|
198 |
try { lyr.setLegend(new DummyVectorLegend(TYPES.SOLID)); } catch (LegendLayerException e) { } |
|
199 |
|
|
200 |
resp.addLayer(lyr); |
|
201 |
resp.addLayer(aux); |
|
202 |
lyr.dispose(); |
|
203 |
aux.dispose(); |
|
204 |
|
|
205 |
mcon.getLayers().addLayer(resp); |
|
206 |
resp.dispose(); |
|
207 |
} |
|
208 |
|
|
209 |
private FLyrVect createLayer(FeatureStore fs) throws Exception { |
|
210 |
|
|
211 |
FLyrVect resp = new FLyrVect(); |
|
212 |
resp.setDataStore(fs); |
|
213 |
resp.wakeUp(); |
|
214 |
resp.load(); |
|
215 |
return resp; |
|
216 |
} |
|
217 |
|
|
218 |
private void doTestPersist(Persistent p) throws Exception { |
|
219 |
|
|
220 |
System.out.println("Starting persistence test for class: " + p.getClass().getName()); |
|
221 |
|
|
222 |
File perfile = getTempFile(); |
|
223 |
FileOutputStream fos = new FileOutputStream(perfile); |
|
224 |
System.out.println("Getting state for class: " + p.getClass().getName()); |
|
225 |
PersistentState pst = ToolsLocator.getPersistenceManager().getState(p); |
|
226 |
System.out.println("Saving state..."); |
|
227 |
|
|
228 |
System.out.println("Saving state..."); |
|
229 |
ToolsLocator.getPersistenceManager().saveState(pst, fos); |
|
230 |
System.out.println("Saving state... done."); |
|
231 |
|
|
232 |
fos.close(); |
|
233 |
|
|
234 |
// ============================================== |
|
235 |
// ============================================== |
|
236 |
System.out.println("Is now persisted: " + p.getClass().getName()); |
|
237 |
// ============================================== |
|
238 |
|
|
239 |
// if (true) return; |
|
240 |
|
|
241 |
System.out.println("Opening persistence file..."); |
|
242 |
FileInputStream fis = new FileInputStream(perfile); |
|
243 |
|
|
244 |
System.out.println("Loading state from file..."); |
|
245 |
pst = ToolsLocator.getPersistenceManager().loadState(fis); |
|
246 |
|
|
247 |
System.out.println("Instantiating " + p.getClass().getName() |
|
248 |
+ " from state, pst = " + pst); |
|
249 |
Object p2 = ToolsLocator.getPersistenceManager().create(pst); |
|
250 |
|
|
251 |
System.out.println("Comparing original and current..."); |
|
252 |
comparePersistent(p, p2); |
|
253 |
|
|
254 |
System.out.println("Successful mapcontext persistence test!"); |
|
255 |
|
|
256 |
} |
|
257 |
|
|
258 |
|
|
259 |
// FeatureStore, ILegend, ViewPort |
|
260 |
private void comparePersistent(Persistent p, Object p2) { |
|
261 |
|
|
262 |
if (p2.getClass().getName().compareTo(p.getClass().getName()) == 0) { |
|
263 |
|
|
264 |
if (p instanceof MapContext) { |
|
265 |
compareMapContexts((MapContext) p, (MapContext) p2); |
|
266 |
} else { |
|
267 |
if (p instanceof FLayer) { |
|
268 |
compareLayers((FLayer) p, (FLayer) p2); |
|
269 |
} else { |
|
270 |
if (p instanceof FeatureStore) { |
|
271 |
compareStore((FeatureStore) p, (FeatureStore) p2); |
|
272 |
} else { |
|
273 |
if (p instanceof ILegend) { |
|
274 |
compareLegend((ILegend) p, (ILegend) p2); |
|
275 |
} else { |
|
276 |
if (p instanceof ViewPort) { |
|
277 |
compareViewPorts((ViewPort) p, (ViewPort) p2); |
|
278 |
} else { |
|
279 |
fail("Did not compare: " + p.getClass().getName()); |
|
280 |
} |
|
281 |
} |
|
282 |
} |
|
283 |
} |
|
284 |
} |
|
285 |
} else { |
|
286 |
fail("Comparing different classes (?)"); |
|
287 |
} |
|
288 |
|
|
289 |
} |
|
290 |
|
|
291 |
private void compareMapContexts(MapContext m1, MapContext m2) { |
|
292 |
|
|
293 |
logger.debug("Getting viewports to compare..."); |
|
294 |
ViewPort vp1 = m1.getViewPort(); |
|
295 |
ViewPort vp2 = m2.getViewPort(); |
|
296 |
|
|
297 |
compareViewPorts(vp1, vp2); |
|
298 |
|
|
299 |
logger.debug("Getting root flayers to compare..."); |
|
300 |
FLayers lyr1 = m1.getLayers(); |
|
301 |
FLayers lyr2 = m2.getLayers(); |
|
302 |
compareLayers(lyr1, lyr2); |
|
303 |
} |
|
304 |
|
|
305 |
private void compareLayers(FLayer l1, FLayer l2) { |
|
306 |
|
|
307 |
logger.debug("Comparing layers..."); |
|
308 |
|
|
309 |
assertTrue("Layers of diff type!", l1.getClass().getName().compareTo(l2.getClass().getName()) == 0); |
|
310 |
if (l1 instanceof FLayers) { |
|
311 |
|
|
312 |
logger.debug("(type FLayers)..."); |
|
313 |
FLayers ls1 = (FLayers) l1; |
|
314 |
FLayers ls2 = (FLayers) l2; |
|
315 |
assertEquals(ls1.getLayersCount(), ls2.getLayersCount()); |
|
316 |
int sz = ls2.getLayersCount(); |
|
317 |
for (int i=0; i<sz; i++) { |
|
318 |
compareLayers(ls1.getLayer(i), ls2.getLayer(i)); |
|
319 |
} |
|
320 |
|
|
321 |
} else { |
|
322 |
if (l1 instanceof FLyrVect) { |
|
323 |
|
|
324 |
logger.debug("(type FLyrVect)..."); |
|
325 |
FLyrVect ls1 = (FLyrVect) l1; |
|
326 |
FLyrVect ls2 = (FLyrVect) l2; |
|
327 |
compareVectLayers(ls1, ls2); |
|
328 |
|
|
329 |
} else { |
|
330 |
|
|
331 |
} |
|
332 |
} |
|
333 |
|
|
334 |
} |
|
335 |
|
|
336 |
private void compareVectLayers(FLyrVect l1, FLyrVect l2) { |
|
337 |
compareLegend(l1.getLegend(), l2.getLegend()); |
|
338 |
compareStore(l1.getFeatureStore(), l2.getFeatureStore()); |
|
339 |
} |
|
340 |
|
|
341 |
private void compareStore(FeatureStore fs1, |
|
342 |
FeatureStore fs2) { |
|
343 |
|
|
344 |
logger.debug("Comparing stores..."); |
|
345 |
assertTrue("Diff stores!", fs1.getName().compareTo(fs2.getName()) == 0); |
|
346 |
} |
|
347 |
|
|
348 |
private void compareLegend(ILegend l1, ILegend l2) { |
|
349 |
|
|
350 |
logger.debug("Comparing legends..."); |
|
351 |
IVectorLegend vl1 = (IVectorLegend) l1; |
|
352 |
IVectorLegend vl2 = (IVectorLegend) l2; |
|
353 |
assertTrue("Diff legends!", vl1.getShapeType() == vl2.getShapeType()); |
|
354 |
|
|
355 |
} |
|
356 |
|
|
357 |
private void compareViewPorts(ViewPort vp1, ViewPort vp2) { |
|
358 |
|
|
359 |
|
|
360 |
logger.debug("Comparing viewports..."); |
|
361 |
|
|
362 |
assertEquals( |
|
363 |
vp1.getAdjustedEnvelope().getMinimum(0), |
|
364 |
vp2.getAdjustedEnvelope().getMinimum(0), |
|
365 |
0.00000000000001); |
|
366 |
assertEquals( |
|
367 |
vp1.getAdjustedEnvelope().getMinimum(1), |
|
368 |
vp2.getAdjustedEnvelope().getMinimum(1), |
|
369 |
0.00000000000001); |
|
370 |
assertEquals( |
|
371 |
vp1.getAdjustedEnvelope().getMaximum(0), |
|
372 |
vp2.getAdjustedEnvelope().getMaximum(0), |
|
373 |
0.00000000000001); |
|
374 |
assertEquals( |
|
375 |
vp1.getAdjustedEnvelope().getMaximum(1), |
|
376 |
vp2.getAdjustedEnvelope().getMaximum(1), |
|
377 |
0.00000000000001); |
|
378 |
} |
|
379 |
|
|
380 |
} |
|
0 | 381 |
tags/org.gvsig.desktop-2.0.88/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/test/java/org/gvsig/fmap/mapcontext/persistence/DummyDBFeatureStore.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.fmap.mapcontext.persistence; |
|
25 |
|
|
26 |
import java.util.Collection; |
|
27 |
import java.util.Iterator; |
|
28 |
import java.util.List; |
|
29 |
import java.util.Set; |
|
30 |
|
|
31 |
import org.cresques.cts.IProjection; |
|
32 |
import org.gvsig.fmap.dal.DataQuery; |
|
33 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
34 |
import org.gvsig.fmap.dal.DataSet; |
|
35 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
36 |
import org.gvsig.fmap.dal.exception.DataException; |
|
37 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
38 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
39 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
40 |
import org.gvsig.fmap.dal.feature.Feature; |
|
41 |
import org.gvsig.fmap.dal.feature.FeatureCache; |
|
42 |
import org.gvsig.fmap.dal.feature.FeatureIndex; |
|
43 |
import org.gvsig.fmap.dal.feature.FeatureIndexes; |
|
44 |
import org.gvsig.fmap.dal.feature.FeatureLocks; |
|
45 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
|
46 |
import org.gvsig.fmap.dal.feature.FeatureReference; |
|
47 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
|
48 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
49 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
50 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms; |
|
51 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
52 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
53 |
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException; |
|
54 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
55 |
import org.gvsig.timesupport.Interval; |
|
56 |
import org.gvsig.tools.ToolsLocator; |
|
57 |
import org.gvsig.tools.dynobject.DynClass; |
|
58 |
import org.gvsig.tools.dynobject.DynObject; |
|
59 |
import org.gvsig.tools.dynobject.DynStruct; |
|
60 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
|
61 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
62 |
import org.gvsig.tools.exception.BaseException; |
|
63 |
import org.gvsig.tools.observer.Observer; |
|
64 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
65 |
import org.gvsig.tools.persistence.PersistentState; |
|
66 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
67 |
import org.gvsig.tools.undo.RedoException; |
|
68 |
import org.gvsig.tools.undo.UndoException; |
|
69 |
import org.gvsig.tools.visitor.Visitor; |
|
70 |
|
|
71 |
public class DummyDBFeatureStore implements FeatureStore { |
|
72 |
|
|
73 |
private String name = "[empty]"; |
|
74 |
|
|
75 |
public DummyDBFeatureStore() { |
|
76 |
|
|
77 |
} |
|
78 |
|
|
79 |
public DummyDBFeatureStore(String id) { |
|
80 |
name = "[DATABASE FEATURE STORE - " + id + "]"; |
|
81 |
} |
|
82 |
|
|
83 |
public boolean allowWrite() { |
|
84 |
// TODO Auto-generated method stub |
|
85 |
return false; |
|
86 |
} |
|
87 |
|
|
88 |
public void beginEditingGroup(String description) |
|
89 |
throws NeedEditingModeException { |
|
90 |
// TODO Auto-generated method stub |
|
91 |
|
|
92 |
} |
|
93 |
|
|
94 |
public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException { |
|
95 |
// TODO Auto-generated method stub |
|
96 |
return false; |
|
97 |
} |
|
98 |
|
|
99 |
public void cancelEditing() throws DataException { |
|
100 |
// TODO Auto-generated method stub |
|
101 |
|
|
102 |
} |
|
103 |
|
|
104 |
public FeatureQuery createFeatureQuery() { |
|
105 |
// TODO Auto-generated method stub |
|
106 |
return null; |
|
107 |
} |
|
108 |
|
|
109 |
public FeatureSelection createFeatureSelection() throws DataException { |
|
110 |
// TODO Auto-generated method stub |
|
111 |
return null; |
|
112 |
} |
|
113 |
|
|
114 |
public FeatureIndex createIndex(FeatureType featureType, |
|
115 |
String attributeName, String indexName) throws DataException { |
|
116 |
// TODO Auto-generated method stub |
|
117 |
return null; |
|
118 |
} |
|
119 |
|
|
120 |
public FeatureIndex createIndex(FeatureType featureType, |
|
121 |
String attributeName, String indexName, Observer observer) |
|
122 |
throws DataException { |
|
123 |
// TODO Auto-generated method stub |
|
124 |
return null; |
|
125 |
} |
|
126 |
|
|
127 |
public EditableFeature createNewFeature() throws DataException { |
|
128 |
// TODO Auto-generated method stub |
|
129 |
return null; |
|
130 |
} |
|
131 |
|
|
132 |
public EditableFeature createNewFeature(FeatureType type, |
|
133 |
Feature defaultValues) throws DataException { |
|
134 |
// TODO Auto-generated method stub |
|
135 |
return null; |
|
136 |
} |
|
137 |
|
|
138 |
public EditableFeature createNewFeature(FeatureType type, |
|
139 |
boolean defaultValues) throws DataException { |
|
140 |
// TODO Auto-generated method stub |
|
141 |
return null; |
|
142 |
} |
|
143 |
|
|
144 |
public EditableFeature createNewFeature(boolean defaultValues) |
|
145 |
throws DataException { |
|
146 |
// TODO Auto-generated method stub |
|
147 |
return null; |
|
148 |
} |
|
149 |
|
|
150 |
public void delete(Feature feature) throws DataException { |
|
151 |
// TODO Auto-generated method stub |
|
152 |
|
|
153 |
} |
|
154 |
|
|
155 |
public void edit() throws DataException { |
|
156 |
// TODO Auto-generated method stub |
|
157 |
|
|
158 |
} |
|
159 |
|
|
160 |
public void edit(int mode) throws DataException { |
|
161 |
// TODO Auto-generated method stub |
|
162 |
|
|
163 |
} |
|
164 |
|
|
165 |
public void endEditingGroup() throws NeedEditingModeException { |
|
166 |
// TODO Auto-generated method stub |
|
167 |
|
|
168 |
} |
|
169 |
|
|
170 |
public void export(DataServerExplorer explorer, |
|
171 |
String providerName, |
|
172 |
NewFeatureStoreParameters params) throws DataException { |
|
173 |
// TODO Auto-generated method stub |
|
174 |
|
|
175 |
} |
|
176 |
|
|
177 |
public void finishEditing() throws DataException { |
|
178 |
// TODO Auto-generated method stub |
|
179 |
|
|
180 |
} |
|
181 |
|
|
182 |
public FeatureType getDefaultFeatureType() throws DataException { |
|
183 |
return new DummyFileFeatureStore.DummyFeatureType(); |
|
184 |
} |
|
185 |
|
|
186 |
public Envelope getEnvelope() throws DataException { |
|
187 |
// TODO Auto-generated method stub |
|
188 |
return null; |
|
189 |
} |
|
190 |
|
|
191 |
public Feature getFeatureByReference(FeatureReference reference) |
|
192 |
throws DataException { |
|
193 |
// TODO Auto-generated method stub |
|
194 |
return null; |
|
195 |
} |
|
196 |
|
|
197 |
public Feature getFeatureByReference(FeatureReference reference, |
|
198 |
FeatureType featureType) throws DataException { |
|
199 |
// TODO Auto-generated method stub |
|
200 |
return null; |
|
201 |
} |
|
202 |
|
|
203 |
public long getFeatureCount() throws DataException { |
|
204 |
// TODO Auto-generated method stub |
|
205 |
return 0; |
|
206 |
} |
|
207 |
|
|
208 |
public FeatureSelection getFeatureSelection() throws DataException { |
|
209 |
// TODO Auto-generated method stub |
|
210 |
return null; |
|
211 |
} |
|
212 |
|
|
213 |
public FeatureSet getFeatureSet() throws DataException { |
|
214 |
// TODO Auto-generated method stub |
|
215 |
return null; |
|
216 |
} |
|
217 |
|
|
218 |
public FeatureSet getFeatureSet(FeatureQuery featureQuery) |
|
219 |
throws DataException { |
|
220 |
// TODO Auto-generated method stub |
|
221 |
return null; |
|
222 |
} |
|
223 |
|
|
224 |
public void getFeatureSet(FeatureQuery featureQuery, Observer observer) |
|
225 |
throws DataException { |
|
226 |
// TODO Auto-generated method stub |
|
227 |
|
|
228 |
} |
|
229 |
|
|
230 |
public void getFeatureSet(Observer observer) throws DataException { |
|
231 |
// TODO Auto-generated method stub |
|
232 |
|
|
233 |
} |
|
234 |
|
|
235 |
public FeatureType getFeatureType(String featureTypeId) |
|
236 |
throws DataException { |
|
237 |
// TODO Auto-generated method stub |
|
238 |
return null; |
|
239 |
} |
|
240 |
|
|
241 |
public List getFeatureTypes() throws DataException { |
|
242 |
// TODO Auto-generated method stub |
|
243 |
return null; |
|
244 |
} |
|
245 |
|
|
246 |
public FeatureIndexes getIndexes() { |
|
247 |
// TODO Auto-generated method stub |
|
248 |
return null; |
|
249 |
} |
|
250 |
|
|
251 |
public FeatureLocks getLocks() throws DataException { |
|
252 |
// TODO Auto-generated method stub |
|
253 |
return null; |
|
254 |
} |
|
255 |
|
|
256 |
public DataStoreParameters getParameters() { |
|
257 |
// TODO Auto-generated method stub |
|
258 |
return null; |
|
259 |
} |
|
260 |
|
|
261 |
public IProjection getSRSDefaultGeometry() throws DataException { |
|
262 |
// TODO Auto-generated method stub |
|
263 |
return null; |
|
264 |
} |
|
265 |
|
|
266 |
public FeatureStoreTransforms getTransforms() { |
|
267 |
// TODO Auto-generated method stub |
|
268 |
return null; |
|
269 |
} |
|
270 |
|
|
271 |
public void insert(EditableFeature feature) throws DataException { |
|
272 |
// TODO Auto-generated method stub |
|
273 |
|
|
274 |
} |
|
275 |
|
|
276 |
public boolean isAppendModeSupported() { |
|
277 |
// TODO Auto-generated method stub |
|
278 |
return false; |
|
279 |
} |
|
280 |
|
|
281 |
public boolean isAppending() { |
|
282 |
// TODO Auto-generated method stub |
|
283 |
return false; |
|
284 |
} |
|
285 |
|
|
286 |
public boolean isEditing() { |
|
287 |
// TODO Auto-generated method stub |
|
288 |
return false; |
|
289 |
} |
|
290 |
|
|
291 |
public boolean isLocksSupported() { |
|
292 |
// TODO Auto-generated method stub |
|
293 |
return false; |
|
294 |
} |
|
295 |
|
|
296 |
public void setSelection(FeatureSet selection) throws DataException { |
|
297 |
// TODO Auto-generated method stub |
|
298 |
|
|
299 |
} |
|
300 |
|
|
301 |
public void update(EditableFeatureType featureType) throws DataException { |
|
302 |
// TODO Auto-generated method stub |
|
303 |
|
|
304 |
} |
|
305 |
|
|
306 |
public void update(EditableFeature feature) throws DataException { |
|
307 |
// TODO Auto-generated method stub |
|
308 |
|
|
309 |
} |
|
310 |
|
|
311 |
public void validateFeatures(int mode) throws DataException { |
|
312 |
// TODO Auto-generated method stub |
|
313 |
|
|
314 |
} |
|
315 |
|
|
316 |
public DataQuery createQuery() { |
|
317 |
// TODO Auto-generated method stub |
|
318 |
return null; |
|
319 |
} |
|
320 |
|
|
321 |
public DataSet createSelection() throws DataException { |
|
322 |
// TODO Auto-generated method stub |
|
323 |
return null; |
|
324 |
} |
|
325 |
|
|
326 |
public void dispose() { |
|
327 |
// TODO Auto-generated method stub |
|
328 |
|
|
329 |
} |
|
330 |
|
|
331 |
public Iterator getChildren() { |
|
332 |
// TODO Auto-generated method stub |
|
333 |
return null; |
|
334 |
} |
|
335 |
|
|
336 |
public DataSet getDataSet() throws DataException { |
|
337 |
// TODO Auto-generated method stub |
|
338 |
return null; |
|
339 |
} |
|
340 |
|
|
341 |
public DataSet getDataSet(DataQuery dataQuery) throws DataException { |
|
342 |
// TODO Auto-generated method stub |
|
343 |
return null; |
|
344 |
} |
|
345 |
|
|
346 |
public void getDataSet(Observer observer) throws DataException { |
|
347 |
// TODO Auto-generated method stub |
|
348 |
|
|
349 |
} |
|
350 |
|
|
351 |
public void getDataSet(DataQuery dataQuery, Observer observer) |
|
352 |
throws DataException { |
|
353 |
// TODO Auto-generated method stub |
|
354 |
|
|
355 |
} |
|
356 |
|
|
357 |
public DataServerExplorer getExplorer() throws DataException, |
|
358 |
ValidateDataParametersException { |
|
359 |
// TODO Auto-generated method stub |
|
360 |
return null; |
|
361 |
} |
|
362 |
|
|
363 |
public String getName() { |
|
364 |
// TODO Auto-generated method stub |
|
365 |
return name; |
|
366 |
} |
|
367 |
|
|
368 |
public DataSet getSelection() throws DataException { |
|
369 |
// TODO Auto-generated method stub |
|
370 |
return null; |
|
371 |
} |
|
372 |
|
|
373 |
public void refresh() throws DataException { |
|
374 |
// TODO Auto-generated method stub |
|
375 |
|
|
376 |
} |
|
377 |
|
|
378 |
public void setSelection(DataSet selection) throws DataException { |
|
379 |
// TODO Auto-generated method stub |
|
380 |
|
|
381 |
} |
|
382 |
|
|
383 |
public void beginComplexNotification() { |
|
384 |
// TODO Auto-generated method stub |
|
385 |
|
|
386 |
} |
|
387 |
|
|
388 |
public void disableNotifications() { |
|
389 |
// TODO Auto-generated method stub |
|
390 |
|
|
391 |
} |
|
392 |
|
|
393 |
public void enableNotifications() { |
|
394 |
// TODO Auto-generated method stub |
|
395 |
|
|
396 |
} |
|
397 |
|
|
398 |
public void endComplexNotification() { |
|
399 |
// TODO Auto-generated method stub |
|
400 |
|
|
401 |
} |
|
402 |
|
|
403 |
public void addObserver(Observer o) { |
|
404 |
// TODO Auto-generated method stub |
|
405 |
|
|
406 |
} |
|
407 |
|
|
408 |
public void deleteObserver(Observer o) { |
|
409 |
// TODO Auto-generated method stub |
|
410 |
|
|
411 |
} |
|
412 |
|
|
413 |
public void deleteObservers() { |
|
414 |
// TODO Auto-generated method stub |
|
415 |
|
|
416 |
} |
|
417 |
|
|
418 |
public void loadFromState(PersistentState state) throws PersistenceException { |
|
419 |
name = state.getString("name"); |
|
420 |
} |
|
421 |
|
|
422 |
public void saveToState(PersistentState state) throws PersistenceException { |
|
423 |
state.set("name", name); |
|
424 |
} |
|
425 |
|
|
426 |
public Set getMetadataChildren() { |
|
427 |
// TODO Auto-generated method stub |
|
428 |
return null; |
|
429 |
} |
|
430 |
|
|
431 |
public Object getMetadataID() { |
|
432 |
// TODO Auto-generated method stub |
|
433 |
return null; |
|
434 |
} |
|
435 |
|
|
436 |
public String getMetadataName() { |
|
437 |
// TODO Auto-generated method stub |
|
438 |
return null; |
|
439 |
} |
|
440 |
|
|
441 |
public void delegate(DynObject dynObject) { |
|
442 |
// TODO Auto-generated method stub |
|
443 |
|
|
444 |
} |
|
445 |
|
|
446 |
public DynClass getDynClass() { |
|
447 |
// TODO Auto-generated method stub |
|
448 |
return null; |
|
449 |
} |
|
450 |
|
|
451 |
public Object getDynValue(String name) throws DynFieldNotFoundException { |
|
452 |
// TODO Auto-generated method stub |
|
453 |
return null; |
|
454 |
} |
|
455 |
|
|
456 |
public boolean hasDynValue(String name) { |
|
457 |
// TODO Auto-generated method stub |
|
458 |
return false; |
|
459 |
} |
|
460 |
|
|
461 |
public void implement(DynClass dynClass) { |
|
462 |
// TODO Auto-generated method stub |
|
463 |
|
|
464 |
} |
|
465 |
|
|
466 |
public Object invokeDynMethod(String name, DynObject context) |
|
467 |
throws DynMethodException { |
|
468 |
// TODO Auto-generated method stub |
|
469 |
return null; |
|
470 |
} |
|
471 |
|
|
472 |
public Object invokeDynMethod(int code, DynObject context) |
|
473 |
throws DynMethodException { |
|
474 |
// TODO Auto-generated method stub |
|
475 |
return null; |
|
476 |
} |
|
477 |
|
|
478 |
public void setDynValue(String name, Object value) |
|
479 |
throws DynFieldNotFoundException { |
|
480 |
// TODO Auto-generated method stub |
|
481 |
|
|
482 |
} |
|
483 |
|
|
484 |
public boolean canRedo() { |
|
485 |
// TODO Auto-generated method stub |
|
486 |
return false; |
|
487 |
} |
|
488 |
|
|
489 |
public boolean canUndo() { |
|
490 |
// TODO Auto-generated method stub |
|
491 |
return false; |
|
492 |
} |
|
493 |
|
|
494 |
public List getRedoInfos() { |
|
495 |
// TODO Auto-generated method stub |
|
496 |
return null; |
|
497 |
} |
|
498 |
|
|
499 |
public List getUndoInfos() { |
|
500 |
// TODO Auto-generated method stub |
|
501 |
return null; |
|
502 |
} |
|
503 |
|
|
504 |
public void redo() throws RedoException { |
|
505 |
// TODO Auto-generated method stub |
|
506 |
|
|
507 |
} |
|
508 |
|
|
509 |
public void redo(int num) throws RedoException { |
|
510 |
// TODO Auto-generated method stub |
|
511 |
|
|
512 |
} |
|
513 |
|
|
514 |
public void undo() throws UndoException { |
|
515 |
// TODO Auto-generated method stub |
|
516 |
|
|
517 |
} |
|
518 |
|
|
519 |
public void undo(int num) throws UndoException { |
|
520 |
// TODO Auto-generated method stub |
|
521 |
|
|
522 |
} |
|
523 |
|
|
524 |
|
|
525 |
public static void registerPersistent() { |
|
526 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
|
527 |
DynStruct definition = manager.addDefinition( |
|
528 |
DummyDBFeatureStore.class, |
|
529 |
"DummyDBFeatureStore", |
|
530 |
"DummyDBFeatureStore Persistence definition", |
|
531 |
null, |
|
532 |
null |
|
533 |
); |
|
534 |
definition.addDynFieldString("name"); |
|
535 |
} |
|
536 |
|
|
537 |
public void accept(Visitor visitor) throws BaseException { |
|
538 |
// TODO Auto-generated method stub |
|
539 |
|
|
540 |
} |
|
541 |
|
|
542 |
public void accept(Visitor visitor, DataQuery dataQuery) |
|
543 |
throws BaseException { |
|
544 |
// TODO Auto-generated method stub |
|
545 |
|
|
546 |
} |
|
547 |
|
|
548 |
public void createCache(String name, DynObject parameters) |
|
549 |
throws DataException { |
|
550 |
// TODO Auto-generated method stub |
|
551 |
|
|
552 |
} |
|
553 |
|
|
554 |
public FeatureCache getCache() { |
|
555 |
// TODO Auto-generated method stub |
|
556 |
return null; |
|
557 |
} |
|
558 |
|
|
559 |
public void clear() { |
|
560 |
// Nothing to do |
|
561 |
} |
|
562 |
|
|
563 |
public String getProviderName() { |
|
564 |
// TODO Auto-generated method stub |
|
565 |
return null; |
|
566 |
} |
|
567 |
|
|
568 |
public String getFullName() { |
|
569 |
// TODO Auto-generated method stub |
|
570 |
return null; |
|
571 |
} |
|
572 |
|
|
573 |
public boolean isKnownEnvelope() { |
|
574 |
// TODO Auto-generated method stub |
|
575 |
return false; |
|
576 |
} |
|
577 |
|
|
578 |
public boolean hasRetrievedFeaturesLimit() { |
|
579 |
// TODO Auto-generated method stub |
|
580 |
return false; |
|
581 |
} |
|
582 |
|
|
583 |
public int getRetrievedFeaturesLimit() { |
|
584 |
// TODO Auto-generated method stub |
|
585 |
return 0; |
|
586 |
} |
|
587 |
|
|
588 |
public Interval getInterval() { |
|
589 |
// TODO Auto-generated method stub |
|
590 |
return null; |
|
591 |
} |
|
592 |
|
|
593 |
public Collection getTimes() { |
|
594 |
// TODO Auto-generated method stub |
|
595 |
return null; |
|
596 |
} |
|
597 |
|
|
598 |
public Collection getTimes(Interval interval) { |
|
599 |
// TODO Auto-generated method stub |
|
600 |
return null; |
|
601 |
} |
|
602 |
|
|
603 |
public FeatureIndex createIndex(String indexTypeName, |
|
604 |
FeatureType featureType, String attributeName, String indexName) |
|
605 |
throws DataException { |
|
606 |
// TODO Auto-generated method stub |
|
607 |
return null; |
|
608 |
} |
|
609 |
|
|
610 |
public FeatureIndex createIndex(String indexTypeName, |
|
611 |
FeatureType featureType, String attributeName, String indexName, |
|
612 |
Observer observer) throws DataException { |
|
613 |
// TODO Auto-generated method stub |
|
614 |
return null; |
|
615 |
} |
|
616 |
|
|
617 |
/* (non-Javadoc) |
|
618 |
* @see java.lang.Object#clone() |
|
619 |
*/ |
|
620 |
public Object clone() throws CloneNotSupportedException { |
|
621 |
// TODO Auto-generated method stub |
|
622 |
return super.clone(); |
|
623 |
} |
|
624 |
|
|
625 |
/* (non-Javadoc) |
|
626 |
* @see org.gvsig.fmap.dal.feature.FeatureStore#commitChanges() |
|
627 |
*/ |
|
628 |
public void commitChanges() throws DataException { |
|
629 |
// TODO Auto-generated method stub |
|
630 |
|
|
631 |
} |
|
632 |
|
|
633 |
/* (non-Javadoc) |
|
634 |
* @see org.gvsig.fmap.dal.feature.FeatureStore#canCommitChanges() |
|
635 |
*/ |
|
636 |
public boolean canCommitChanges() throws DataException { |
|
637 |
// TODO Auto-generated method stub |
|
638 |
return false; |
|
639 |
} |
|
640 |
|
|
641 |
public Feature getFeature(DynObject dynobject) { |
|
642 |
// TODO Auto-generated method stub |
|
643 |
return null; |
|
644 |
} |
|
645 |
} |
|
0 | 646 |
tags/org.gvsig.desktop-2.0.88/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/test/java/org/gvsig/fmap/mapcontext/persistence/DummyFileFeatureStore.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.fmap.mapcontext.persistence; |
|
25 |
|
|
26 |
import java.text.DateFormat; |
|
27 |
import java.util.Collection; |
|
28 |
import java.util.Iterator; |
|
29 |
import java.util.List; |
|
30 |
import java.util.Set; |
|
31 |
|
|
32 |
import org.cresques.cts.IProjection; |
|
33 |
|
|
34 |
import org.gvsig.fmap.dal.DataQuery; |
|
35 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
36 |
import org.gvsig.fmap.dal.DataSet; |
|
37 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
38 |
import org.gvsig.fmap.dal.exception.DataException; |
|
39 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
40 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
|
41 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
42 |
import org.gvsig.fmap.dal.feature.Feature; |
|
43 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
44 |
import org.gvsig.fmap.dal.feature.FeatureAttributeEmulator; |
|
45 |
import org.gvsig.fmap.dal.feature.FeatureAttributeGetter; |
|
46 |
import org.gvsig.fmap.dal.feature.FeatureCache; |
|
47 |
import org.gvsig.fmap.dal.feature.FeatureIndex; |
|
48 |
import org.gvsig.fmap.dal.feature.FeatureIndexes; |
|
49 |
import org.gvsig.fmap.dal.feature.FeatureLocks; |
|
50 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
|
51 |
import org.gvsig.fmap.dal.feature.FeatureReference; |
|
52 |
import org.gvsig.fmap.dal.feature.FeatureRules; |
|
53 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
|
54 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
|
55 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
|
56 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms; |
|
57 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
58 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
|
59 |
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException; |
|
60 |
import org.gvsig.fmap.geom.Geometry; |
|
61 |
import org.gvsig.fmap.geom.primitive.Envelope; |
|
62 |
import org.gvsig.fmap.geom.type.GeometryType; |
|
63 |
import org.gvsig.timesupport.Interval; |
|
64 |
import org.gvsig.tools.ToolsLocator; |
|
65 |
import org.gvsig.tools.dataTypes.CoercionException; |
|
66 |
import org.gvsig.tools.dataTypes.DataType; |
|
67 |
import org.gvsig.tools.dynobject.DynClass; |
|
68 |
import org.gvsig.tools.dynobject.DynField; |
|
69 |
import org.gvsig.tools.dynobject.DynMethod; |
|
70 |
import org.gvsig.tools.dynobject.DynObject; |
|
71 |
import org.gvsig.tools.dynobject.DynObjectValueItem; |
|
72 |
import org.gvsig.tools.dynobject.DynStruct; |
|
73 |
import org.gvsig.tools.dynobject.exception.DynFieldIsNotAContainerException; |
|
74 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
|
75 |
import org.gvsig.tools.dynobject.exception.DynFieldValidateException; |
|
76 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
|
77 |
import org.gvsig.tools.dynobject.exception.DynObjectValidateException; |
|
78 |
import org.gvsig.tools.evaluator.Evaluator; |
|
79 |
import org.gvsig.tools.exception.BaseException; |
|
80 |
import org.gvsig.tools.observer.Observer; |
|
81 |
import org.gvsig.tools.persistence.PersistenceManager; |
|
82 |
import org.gvsig.tools.persistence.PersistentState; |
|
83 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
|
84 |
import org.gvsig.tools.undo.RedoException; |
|
85 |
import org.gvsig.tools.undo.UndoException; |
|
86 |
import org.gvsig.tools.visitor.Visitor; |
|
87 |
|
|
88 |
public class DummyFileFeatureStore implements FeatureStore { |
|
89 |
|
|
90 |
public static class DummyFeatureAttributeDescriptor implements |
|
91 |
FeatureAttributeDescriptor { |
|
92 |
|
|
93 |
public boolean allowNull() { |
|
94 |
// TODO Auto-generated method stub |
|
95 |
return false; |
|
96 |
} |
|
97 |
|
|
98 |
public Object getAdditionalInfo(String infoName) { |
|
99 |
// TODO Auto-generated method stub |
|
100 |
return null; |
|
101 |
} |
|
102 |
|
|
103 |
public FeatureAttributeDescriptor getCopy() { |
|
104 |
// TODO Auto-generated method stub |
|
105 |
return null; |
|
106 |
} |
|
107 |
|
|
108 |
public DataType getDataType() { |
|
109 |
// TODO Auto-generated method stub |
|
110 |
return null; |
|
111 |
} |
|
112 |
|
|
113 |
public String getDataTypeName() { |
|
114 |
// TODO Auto-generated method stub |
|
115 |
return null; |
|
116 |
} |
|
117 |
|
|
118 |
public DateFormat getDateFormat() { |
|
119 |
// TODO Auto-generated method stub |
|
120 |
return null; |
|
121 |
} |
|
122 |
|
|
123 |
public Object getDefaultValue() { |
|
124 |
// TODO Auto-generated method stub |
|
125 |
return null; |
|
126 |
} |
|
127 |
|
|
128 |
public Evaluator getEvaluator() { |
|
129 |
// TODO Auto-generated method stub |
|
130 |
return null; |
|
131 |
} |
|
132 |
|
|
133 |
public int getGeometrySubType() { |
|
134 |
// TODO Auto-generated method stub |
|
135 |
return 0; |
|
136 |
} |
|
137 |
|
|
138 |
public int getGeometryType() { |
|
139 |
return Geometry.TYPES.POINT; |
|
140 |
} |
|
141 |
|
|
142 |
public int getIndex() { |
|
143 |
// TODO Auto-generated method stub |
|
144 |
return 0; |
|
145 |
} |
|
146 |
|
|
147 |
public int getMaximumOccurrences() { |
|
148 |
// TODO Auto-generated method stub |
|
149 |
return 0; |
|
150 |
} |
|
151 |
|
|
152 |
public int getMinimumOccurrences() { |
|
153 |
// TODO Auto-generated method stub |
|
154 |
return 0; |
|
155 |
} |
|
156 |
|
|
157 |
public String getName() { |
|
158 |
// TODO Auto-generated method stub |
|
159 |
return null; |
|
160 |
} |
|
161 |
|
|
162 |
public Class getObjectClass() { |
|
163 |
// TODO Auto-generated method stub |
|
164 |
return null; |
|
165 |
} |
|
166 |
|
|
167 |
public int getPrecision() { |
|
168 |
// TODO Auto-generated method stub |
|
169 |
return 0; |
|
170 |
} |
|
171 |
|
|
172 |
public IProjection getSRS() { |
|
173 |
// TODO Auto-generated method stub |
|
174 |
return null; |
|
175 |
} |
|
176 |
|
|
177 |
public int getSize() { |
|
178 |
// TODO Auto-generated method stub |
|
179 |
return 0; |
|
180 |
} |
|
181 |
|
|
182 |
public int getType() { |
|
183 |
// TODO Auto-generated method stub |
|
184 |
return 0; |
|
185 |
} |
|
186 |
|
|
187 |
public boolean isAutomatic() { |
|
188 |
// TODO Auto-generated method stub |
|
189 |
return false; |
|
190 |
} |
|
191 |
|
|
192 |
public boolean isPrimaryKey() { |
|
193 |
// TODO Auto-generated method stub |
|
194 |
return false; |
|
195 |
} |
|
196 |
|
|
197 |
public boolean isReadOnly() { |
|
198 |
// TODO Auto-generated method stub |
|
199 |
return false; |
|
200 |
} |
|
201 |
|
|
202 |
public String getSubtype() { |
|
203 |
// TODO Auto-generated method stub |
|
204 |
return null; |
|
205 |
} |
|
206 |
|
|
207 |
public int getTheTypeOfAvailableValues() { |
|
208 |
// TODO Auto-generated method stub |
|
209 |
return 0; |
|
210 |
} |
|
211 |
|
|
212 |
public boolean isContainer() { |
|
213 |
// TODO Auto-generated method stub |
|
214 |
return false; |
|
215 |
} |
|
216 |
|
|
217 |
public boolean isHidden() { |
|
218 |
// TODO Auto-generated method stub |
|
219 |
return false; |
|
220 |
} |
|
221 |
|
|
222 |
public boolean isMandatory() { |
|
223 |
// TODO Auto-generated method stub |
|
224 |
return false; |
|
225 |
} |
|
226 |
|
|
227 |
public boolean isPersistent() { |
|
228 |
// TODO Auto-generated method stub |
|
229 |
return false; |
|
230 |
} |
|
231 |
|
|
232 |
public DynField setAvailableValues(DynObjectValueItem[] values) { |
|
233 |
// TODO Auto-generated method stub |
|
234 |
return null; |
|
235 |
} |
|
236 |
|
|
237 |
public DynField setAvailableValues(List values) { |
|
238 |
// TODO Auto-generated method stub |
|
239 |
return null; |
|
240 |
} |
|
241 |
|
|
242 |
public DynField setClassOfItems(Class theClass) |
|
243 |
throws DynFieldIsNotAContainerException { |
|
244 |
// TODO Auto-generated method stub |
|
245 |
return null; |
|
246 |
} |
|
247 |
|
|
248 |
public DynField setClassOfValue(Class theClass) |
|
249 |
throws DynFieldIsNotAContainerException { |
|
250 |
// TODO Auto-generated method stub |
|
251 |
return null; |
|
252 |
} |
|
253 |
|
|
254 |
public DynField setDefaultDynValue(Object defaultValue) { |
|
255 |
// TODO Auto-generated method stub |
|
256 |
return null; |
|
257 |
} |
|
258 |
|
|
259 |
public DynField setDefaultFieldValue(Object defaultValue) { |
|
260 |
// TODO Auto-generated method stub |
|
261 |
return null; |
|
262 |
} |
|
263 |
|
|
264 |
public DynField setDescription(String description) { |
|
265 |
// TODO Auto-generated method stub |
|
266 |
return null; |
|
267 |
} |
|
268 |
|
|
269 |
public DynField setElementsType(int type) |
|
270 |
throws DynFieldIsNotAContainerException { |
|
271 |
// TODO Auto-generated method stub |
|
272 |
return null; |
|
273 |
} |
|
274 |
|
|
275 |
public DynField setElementsType(DynStruct type) |
|
276 |
throws DynFieldIsNotAContainerException { |
|
277 |
// TODO Auto-generated method stub |
|
278 |
return null; |
|
279 |
} |
|
280 |
|
|
281 |
public DynField setGroup(String groupName) { |
|
282 |
// TODO Auto-generated method stub |
|
283 |
return null; |
|
284 |
} |
|
285 |
|
|
286 |
public DynField setHidden(boolean hidden) { |
|
287 |
// TODO Auto-generated method stub |
|
288 |
return null; |
|
289 |
} |
|
290 |
|
|
291 |
public DynField setMandatory(boolean mandatory) { |
|
292 |
// TODO Auto-generated method stub |
|
293 |
return null; |
|
294 |
} |
|
295 |
|
|
296 |
public DynField setMaxValue(Object maxValue) { |
|
297 |
// TODO Auto-generated method stub |
|
298 |
return null; |
|
299 |
} |
|
300 |
|
|
301 |
public DynField setMinValue(Object minValue) { |
|
302 |
// TODO Auto-generated method stub |
|
303 |
return null; |
|
304 |
} |
|
305 |
|
|
306 |
public DynField setOrder(int order) { |
|
307 |
// TODO Auto-generated method stub |
|
308 |
return null; |
|
309 |
} |
|
310 |
|
|
311 |
public DynField setPersistent(boolean persistent) { |
|
312 |
// TODO Auto-generated method stub |
|
313 |
return null; |
|
314 |
} |
|
315 |
|
|
316 |
public DynField setReadOnly(boolean isReadOnly) { |
|
317 |
// TODO Auto-generated method stub |
|
318 |
return null; |
|
319 |
} |
|
320 |
|
|
321 |
public DynField setSubtype(String subtype) { |
|
322 |
// TODO Auto-generated method stub |
|
323 |
return null; |
|
324 |
} |
|
325 |
|
|
326 |
public DynField setTheTypeOfAvailableValues(int type) { |
|
327 |
// TODO Auto-generated method stub |
|
328 |
return null; |
|
329 |
} |
|
330 |
|
|
331 |
public DynField setType(int type) { |
|
332 |
// TODO Auto-generated method stub |
|
333 |
return null; |
|
334 |
} |
|
335 |
|
|
336 |
public DynField setType(DataType type) { |
|
337 |
// TODO Auto-generated method stub |
|
338 |
return null; |
|
339 |
} |
|
340 |
|
|
341 |
public void validate(Object value) throws DynFieldValidateException { |
|
342 |
// TODO Auto-generated method stub |
|
343 |
|
|
344 |
} |
|
345 |
|
|
346 |
public Object coerce(Object value) throws CoercionException { |
|
347 |
// TODO Auto-generated method stub |
|
348 |
return null; |
|
349 |
} |
|
350 |
|
|
351 |
public DynObjectValueItem[] getAvailableValues() { |
|
352 |
// TODO Auto-generated method stub |
|
353 |
return null; |
|
354 |
} |
|
355 |
|
|
356 |
public Class getClassOfItems() { |
|
357 |
// TODO Auto-generated method stub |
|
358 |
return null; |
|
359 |
} |
|
360 |
|
|
361 |
public Class getClassOfValue() { |
|
362 |
// TODO Auto-generated method stub |
|
363 |
return null; |
|
364 |
} |
|
365 |
|
|
366 |
public String getDescription() { |
|
367 |
// TODO Auto-generated method stub |
|
368 |
return null; |
|
369 |
} |
|
370 |
|
|
371 |
public DynField getElementsType() { |
|
372 |
// TODO Auto-generated method stub |
|
373 |
return null; |
|
374 |
} |
|
375 |
|
|
376 |
public String getGroup() { |
|
377 |
// TODO Auto-generated method stub |
|
378 |
return null; |
|
379 |
} |
|
380 |
|
|
381 |
public Object getMaxValue() { |
|
382 |
// TODO Auto-generated method stub |
|
383 |
return null; |
|
384 |
} |
|
385 |
|
|
386 |
public Object getMinValue() { |
|
387 |
// TODO Auto-generated method stub |
|
388 |
return null; |
|
389 |
} |
|
390 |
|
|
391 |
public int getOder() { |
|
392 |
// TODO Auto-generated method stub |
|
393 |
return 0; |
|
394 |
} |
|
395 |
|
|
396 |
public GeometryType getGeomType() { |
|
397 |
// TODO Auto-generated method stub |
|
398 |
return null; |
|
399 |
} |
|
400 |
|
|
401 |
public boolean isTime() { |
|
402 |
// TODO Auto-generated method stub |
|
403 |
return false; |
|
404 |
} |
|
405 |
|
|
406 |
public FeatureAttributeGetter getFeatureAttributeGetter() { |
|
407 |
// TODO Auto-generated method stub |
|
408 |
return null; |
|
409 |
} |
|
410 |
|
|
411 |
public void setFeatureAttributeGetter( |
|
412 |
FeatureAttributeGetter featureAttributeGetter) { |
|
413 |
// TODO Auto-generated method stub |
|
414 |
|
|
415 |
} |
|
416 |
|
|
417 |
public FeatureAttributeEmulator getFeatureAttributeEmulator() { |
|
418 |
return null; |
|
419 |
} |
|
420 |
|
|
421 |
public boolean isIndexed() { |
|
422 |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
|
423 |
} |
|
424 |
|
|
425 |
public boolean allowIndexDuplicateds() { |
|
426 |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
|
427 |
} |
|
428 |
|
|
429 |
public boolean isIndexAscending() { |
|
430 |
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. |
|
431 |
} |
|
432 |
} |
|
433 |
|
|
434 |
public static class DummyFeatureType implements FeatureType { |
|
435 |
|
|
436 |
public boolean allowAutomaticValues() { |
|
437 |
// TODO Auto-generated method stub |
|
438 |
return false; |
|
439 |
} |
|
440 |
|
|
441 |
public Object get(String name) { |
|
442 |
// TODO Auto-generated method stub |
|
443 |
return null; |
|
444 |
} |
|
445 |
|
|
446 |
public Object get(int index) { |
|
447 |
// TODO Auto-generated method stub |
Also available in: Unified diff