svn-gvsig-desktop / trunk / 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 @ 40559
History | View | Annotate | Download (15.1 KB)
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 |
} |