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 @ 42775
History | View | Annotate | Download (17.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 modify it under
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
9 |
* version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
14 |
* details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License along with
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
21 |
* gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.fmap.mapcontext.persistence; |
24 |
|
25 |
import java.util.Collection; |
26 |
import java.util.Iterator; |
27 |
import java.util.List; |
28 |
import java.util.Set; |
29 |
|
30 |
import org.cresques.cts.IProjection; |
31 |
import org.gvsig.fmap.dal.DataQuery; |
32 |
import org.gvsig.fmap.dal.DataServerExplorer; |
33 |
import org.gvsig.fmap.dal.DataSet; |
34 |
import org.gvsig.fmap.dal.DataStoreParameters; |
35 |
import org.gvsig.fmap.dal.exception.DataException; |
36 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
37 |
import org.gvsig.fmap.dal.feature.EditableFeature; |
38 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
39 |
import org.gvsig.fmap.dal.feature.Feature; |
40 |
import org.gvsig.fmap.dal.feature.FeatureCache; |
41 |
import org.gvsig.fmap.dal.feature.FeatureIndex; |
42 |
import org.gvsig.fmap.dal.feature.FeatureIndexes; |
43 |
import org.gvsig.fmap.dal.feature.FeatureLocks; |
44 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
45 |
import org.gvsig.fmap.dal.feature.FeatureReference; |
46 |
import org.gvsig.fmap.dal.feature.FeatureSelection; |
47 |
import org.gvsig.fmap.dal.feature.FeatureSet; |
48 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
49 |
import org.gvsig.fmap.dal.feature.FeatureStoreTransforms; |
50 |
import org.gvsig.fmap.dal.feature.FeatureType; |
51 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
52 |
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException; |
53 |
import org.gvsig.fmap.geom.primitive.Envelope; |
54 |
import org.gvsig.timesupport.Interval; |
55 |
import org.gvsig.tools.ToolsLocator; |
56 |
import org.gvsig.tools.dynobject.DynClass; |
57 |
import org.gvsig.tools.dynobject.DynObject; |
58 |
import org.gvsig.tools.dynobject.DynStruct; |
59 |
import org.gvsig.tools.dynobject.exception.DynFieldNotFoundException; |
60 |
import org.gvsig.tools.dynobject.exception.DynMethodException; |
61 |
import org.gvsig.tools.exception.BaseException; |
62 |
import org.gvsig.tools.observer.Observer; |
63 |
import org.gvsig.tools.persistence.PersistenceManager; |
64 |
import org.gvsig.tools.persistence.PersistentState; |
65 |
import org.gvsig.tools.persistence.exception.PersistenceException; |
66 |
import org.gvsig.tools.undo.RedoException; |
67 |
import org.gvsig.tools.undo.UndoException; |
68 |
import org.gvsig.tools.visitor.Visitor; |
69 |
|
70 |
public class DummyDBFeatureStore implements FeatureStore { |
71 |
|
72 |
private String name = "[empty]"; |
73 |
|
74 |
public DummyDBFeatureStore() {
|
75 |
|
76 |
} |
77 |
|
78 |
public DummyDBFeatureStore(String id) { |
79 |
name = "[DATABASE FEATURE STORE - " + id + "]"; |
80 |
} |
81 |
|
82 |
public boolean allowWrite() { |
83 |
// TODO Auto-generated method stub
|
84 |
return false; |
85 |
} |
86 |
|
87 |
public void beginEditingGroup(String description) |
88 |
throws NeedEditingModeException {
|
89 |
// TODO Auto-generated method stub
|
90 |
|
91 |
} |
92 |
|
93 |
public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException { |
94 |
// TODO Auto-generated method stub
|
95 |
return false; |
96 |
} |
97 |
|
98 |
public void cancelEditing() throws DataException { |
99 |
// TODO Auto-generated method stub
|
100 |
|
101 |
} |
102 |
|
103 |
public FeatureQuery createFeatureQuery() {
|
104 |
// TODO Auto-generated method stub
|
105 |
return null; |
106 |
} |
107 |
|
108 |
public FeatureSelection createFeatureSelection() throws DataException { |
109 |
// TODO Auto-generated method stub
|
110 |
return null; |
111 |
} |
112 |
|
113 |
public FeatureIndex createIndex(FeatureType featureType,
|
114 |
String attributeName, String indexName) throws DataException { |
115 |
// TODO Auto-generated method stub
|
116 |
return null; |
117 |
} |
118 |
|
119 |
public FeatureIndex createIndex(FeatureType featureType,
|
120 |
String attributeName, String indexName, Observer observer) |
121 |
throws DataException {
|
122 |
// TODO Auto-generated method stub
|
123 |
return null; |
124 |
} |
125 |
|
126 |
public EditableFeature createNewFeature() throws DataException { |
127 |
// TODO Auto-generated method stub
|
128 |
return null; |
129 |
} |
130 |
|
131 |
public EditableFeature createNewFeature(FeatureType type,
|
132 |
Feature defaultValues) throws DataException {
|
133 |
// TODO Auto-generated method stub
|
134 |
return null; |
135 |
} |
136 |
|
137 |
public EditableFeature createNewFeature(FeatureType type,
|
138 |
boolean defaultValues) throws DataException { |
139 |
// TODO Auto-generated method stub
|
140 |
return null; |
141 |
} |
142 |
|
143 |
public EditableFeature createNewFeature(boolean defaultValues) |
144 |
throws DataException {
|
145 |
// TODO Auto-generated method stub
|
146 |
return null; |
147 |
} |
148 |
|
149 |
public void delete(Feature feature) throws DataException { |
150 |
// TODO Auto-generated method stub
|
151 |
|
152 |
} |
153 |
|
154 |
public void edit() throws DataException { |
155 |
// TODO Auto-generated method stub
|
156 |
|
157 |
} |
158 |
|
159 |
public void edit(int mode) throws DataException { |
160 |
// TODO Auto-generated method stub
|
161 |
|
162 |
} |
163 |
|
164 |
public void endEditingGroup() throws NeedEditingModeException { |
165 |
// TODO Auto-generated method stub
|
166 |
|
167 |
} |
168 |
|
169 |
public void export(DataServerExplorer explorer, |
170 |
String providerName,
|
171 |
NewFeatureStoreParameters params) throws DataException {
|
172 |
// TODO Auto-generated method stub
|
173 |
|
174 |
} |
175 |
|
176 |
public void finishEditing() throws DataException { |
177 |
// TODO Auto-generated method stub
|
178 |
|
179 |
} |
180 |
|
181 |
public FeatureType getDefaultFeatureType() throws DataException { |
182 |
return new DummyFileFeatureStore.DummyFeatureType(); |
183 |
} |
184 |
|
185 |
public Envelope getEnvelope() throws DataException { |
186 |
// TODO Auto-generated method stub
|
187 |
return null; |
188 |
} |
189 |
|
190 |
public Feature getFeatureByReference(FeatureReference reference)
|
191 |
throws DataException {
|
192 |
// TODO Auto-generated method stub
|
193 |
return null; |
194 |
} |
195 |
|
196 |
public Feature getFeatureByReference(FeatureReference reference,
|
197 |
FeatureType featureType) throws DataException {
|
198 |
// TODO Auto-generated method stub
|
199 |
return null; |
200 |
} |
201 |
|
202 |
public long getFeatureCount() throws DataException { |
203 |
// TODO Auto-generated method stub
|
204 |
return 0; |
205 |
} |
206 |
|
207 |
public FeatureSelection getFeatureSelection() throws DataException { |
208 |
// TODO Auto-generated method stub
|
209 |
return null; |
210 |
} |
211 |
|
212 |
public FeatureSet getFeatureSet() throws DataException { |
213 |
// TODO Auto-generated method stub
|
214 |
return null; |
215 |
} |
216 |
|
217 |
public FeatureSet getFeatureSet(FeatureQuery featureQuery)
|
218 |
throws DataException {
|
219 |
// TODO Auto-generated method stub
|
220 |
return null; |
221 |
} |
222 |
|
223 |
public void getFeatureSet(FeatureQuery featureQuery, Observer observer) |
224 |
throws DataException {
|
225 |
// TODO Auto-generated method stub
|
226 |
|
227 |
} |
228 |
|
229 |
public void getFeatureSet(Observer observer) throws DataException { |
230 |
// TODO Auto-generated method stub
|
231 |
|
232 |
} |
233 |
|
234 |
public FeatureType getFeatureType(String featureTypeId) |
235 |
throws DataException {
|
236 |
// TODO Auto-generated method stub
|
237 |
return null; |
238 |
} |
239 |
|
240 |
public List getFeatureTypes() throws DataException { |
241 |
// TODO Auto-generated method stub
|
242 |
return null; |
243 |
} |
244 |
|
245 |
public FeatureIndexes getIndexes() {
|
246 |
// TODO Auto-generated method stub
|
247 |
return null; |
248 |
} |
249 |
|
250 |
public FeatureLocks getLocks() throws DataException { |
251 |
// TODO Auto-generated method stub
|
252 |
return null; |
253 |
} |
254 |
|
255 |
public DataStoreParameters getParameters() {
|
256 |
// TODO Auto-generated method stub
|
257 |
return null; |
258 |
} |
259 |
|
260 |
public IProjection getSRSDefaultGeometry() throws DataException { |
261 |
// TODO Auto-generated method stub
|
262 |
return null; |
263 |
} |
264 |
|
265 |
public FeatureStoreTransforms getTransforms() {
|
266 |
// TODO Auto-generated method stub
|
267 |
return null; |
268 |
} |
269 |
|
270 |
public void insert(EditableFeature feature) throws DataException { |
271 |
// TODO Auto-generated method stub
|
272 |
|
273 |
} |
274 |
|
275 |
public boolean isAppendModeSupported() { |
276 |
// TODO Auto-generated method stub
|
277 |
return false; |
278 |
} |
279 |
|
280 |
public boolean isAppending() { |
281 |
// TODO Auto-generated method stub
|
282 |
return false; |
283 |
} |
284 |
|
285 |
public boolean isEditing() { |
286 |
// TODO Auto-generated method stub
|
287 |
return false; |
288 |
} |
289 |
|
290 |
public boolean isLocksSupported() { |
291 |
// TODO Auto-generated method stub
|
292 |
return false; |
293 |
} |
294 |
|
295 |
public void setSelection(FeatureSet selection) throws DataException { |
296 |
// TODO Auto-generated method stub
|
297 |
|
298 |
} |
299 |
|
300 |
public void update(EditableFeatureType featureType) throws DataException { |
301 |
// TODO Auto-generated method stub
|
302 |
|
303 |
} |
304 |
|
305 |
public void update(EditableFeature feature) throws DataException { |
306 |
// TODO Auto-generated method stub
|
307 |
|
308 |
} |
309 |
|
310 |
public void validateFeatures(int mode) throws DataException { |
311 |
// TODO Auto-generated method stub
|
312 |
|
313 |
} |
314 |
|
315 |
public DataQuery createQuery() {
|
316 |
// TODO Auto-generated method stub
|
317 |
return null; |
318 |
} |
319 |
|
320 |
public DataSet createSelection() throws DataException { |
321 |
// TODO Auto-generated method stub
|
322 |
return null; |
323 |
} |
324 |
|
325 |
public void dispose() { |
326 |
// TODO Auto-generated method stub
|
327 |
|
328 |
} |
329 |
|
330 |
public Iterator getChildren() { |
331 |
// TODO Auto-generated method stub
|
332 |
return null; |
333 |
} |
334 |
|
335 |
public DataSet getDataSet() throws DataException { |
336 |
// TODO Auto-generated method stub
|
337 |
return null; |
338 |
} |
339 |
|
340 |
public DataSet getDataSet(DataQuery dataQuery) throws DataException { |
341 |
// TODO Auto-generated method stub
|
342 |
return null; |
343 |
} |
344 |
|
345 |
public void getDataSet(Observer observer) throws DataException { |
346 |
// TODO Auto-generated method stub
|
347 |
|
348 |
} |
349 |
|
350 |
public void getDataSet(DataQuery dataQuery, Observer observer) |
351 |
throws DataException {
|
352 |
// TODO Auto-generated method stub
|
353 |
|
354 |
} |
355 |
|
356 |
public DataServerExplorer getExplorer() throws DataException, |
357 |
ValidateDataParametersException { |
358 |
// TODO Auto-generated method stub
|
359 |
return null; |
360 |
} |
361 |
|
362 |
public String getName() { |
363 |
// TODO Auto-generated method stub
|
364 |
return name;
|
365 |
} |
366 |
|
367 |
public DataSet getSelection() throws DataException { |
368 |
// TODO Auto-generated method stub
|
369 |
return null; |
370 |
} |
371 |
|
372 |
public void refresh() throws DataException { |
373 |
// TODO Auto-generated method stub
|
374 |
|
375 |
} |
376 |
|
377 |
public void setSelection(DataSet selection) throws DataException { |
378 |
// TODO Auto-generated method stub
|
379 |
|
380 |
} |
381 |
|
382 |
public void beginComplexNotification() { |
383 |
// TODO Auto-generated method stub
|
384 |
|
385 |
} |
386 |
|
387 |
public void disableNotifications() { |
388 |
// TODO Auto-generated method stub
|
389 |
|
390 |
} |
391 |
|
392 |
public void enableNotifications() { |
393 |
// TODO Auto-generated method stub
|
394 |
|
395 |
} |
396 |
|
397 |
public void endComplexNotification() { |
398 |
// TODO Auto-generated method stub
|
399 |
|
400 |
} |
401 |
|
402 |
public void addObserver(Observer o) { |
403 |
// TODO Auto-generated method stub
|
404 |
|
405 |
} |
406 |
|
407 |
public void deleteObserver(Observer o) { |
408 |
// TODO Auto-generated method stub
|
409 |
|
410 |
} |
411 |
|
412 |
public void deleteObservers() { |
413 |
// TODO Auto-generated method stub
|
414 |
|
415 |
} |
416 |
|
417 |
public void loadFromState(PersistentState state) throws PersistenceException { |
418 |
name = state.getString("name");
|
419 |
} |
420 |
|
421 |
public void saveToState(PersistentState state) throws PersistenceException { |
422 |
state.set("name", name);
|
423 |
} |
424 |
|
425 |
public Set getMetadataChildren() { |
426 |
// TODO Auto-generated method stub
|
427 |
return null; |
428 |
} |
429 |
|
430 |
public Object getMetadataID() { |
431 |
// TODO Auto-generated method stub
|
432 |
return null; |
433 |
} |
434 |
|
435 |
public String getMetadataName() { |
436 |
// TODO Auto-generated method stub
|
437 |
return null; |
438 |
} |
439 |
|
440 |
public void delegate(DynObject dynObject) { |
441 |
// TODO Auto-generated method stub
|
442 |
|
443 |
} |
444 |
|
445 |
public DynClass getDynClass() {
|
446 |
// TODO Auto-generated method stub
|
447 |
return null; |
448 |
} |
449 |
|
450 |
public Object getDynValue(String name) throws DynFieldNotFoundException { |
451 |
// TODO Auto-generated method stub
|
452 |
return null; |
453 |
} |
454 |
|
455 |
public boolean hasDynValue(String name) { |
456 |
// TODO Auto-generated method stub
|
457 |
return false; |
458 |
} |
459 |
|
460 |
public void implement(DynClass dynClass) { |
461 |
// TODO Auto-generated method stub
|
462 |
|
463 |
} |
464 |
|
465 |
public Object invokeDynMethod(String name, Object[] args) |
466 |
throws DynMethodException {
|
467 |
// TODO Auto-generated method stub
|
468 |
return null; |
469 |
} |
470 |
|
471 |
public Object invokeDynMethod(int code, Object[] args) |
472 |
throws DynMethodException {
|
473 |
// TODO Auto-generated method stub
|
474 |
return null; |
475 |
} |
476 |
|
477 |
public void setDynValue(String name, Object value) |
478 |
throws DynFieldNotFoundException {
|
479 |
// TODO Auto-generated method stub
|
480 |
|
481 |
} |
482 |
|
483 |
public boolean canRedo() { |
484 |
// TODO Auto-generated method stub
|
485 |
return false; |
486 |
} |
487 |
|
488 |
public boolean canUndo() { |
489 |
// TODO Auto-generated method stub
|
490 |
return false; |
491 |
} |
492 |
|
493 |
public List getRedoInfos() { |
494 |
// TODO Auto-generated method stub
|
495 |
return null; |
496 |
} |
497 |
|
498 |
public List getUndoInfos() { |
499 |
// TODO Auto-generated method stub
|
500 |
return null; |
501 |
} |
502 |
|
503 |
public void redo() throws RedoException { |
504 |
// TODO Auto-generated method stub
|
505 |
|
506 |
} |
507 |
|
508 |
public void redo(int num) throws RedoException { |
509 |
// TODO Auto-generated method stub
|
510 |
|
511 |
} |
512 |
|
513 |
public void undo() throws UndoException { |
514 |
// TODO Auto-generated method stub
|
515 |
|
516 |
} |
517 |
|
518 |
public void undo(int num) throws UndoException { |
519 |
// TODO Auto-generated method stub
|
520 |
|
521 |
} |
522 |
|
523 |
public static void registerPersistent() { |
524 |
PersistenceManager manager = ToolsLocator.getPersistenceManager(); |
525 |
DynStruct definition = manager.addDefinition( |
526 |
DummyDBFeatureStore.class, |
527 |
"DummyDBFeatureStore",
|
528 |
"DummyDBFeatureStore Persistence definition",
|
529 |
null,
|
530 |
null
|
531 |
); |
532 |
definition.addDynFieldString("name");
|
533 |
} |
534 |
|
535 |
public void accept(Visitor visitor) throws BaseException { |
536 |
// TODO Auto-generated method stub
|
537 |
|
538 |
} |
539 |
|
540 |
public void accept(Visitor visitor, DataQuery dataQuery) |
541 |
throws BaseException {
|
542 |
// TODO Auto-generated method stub
|
543 |
|
544 |
} |
545 |
|
546 |
public void createCache(String name, DynObject parameters) |
547 |
throws DataException {
|
548 |
// TODO Auto-generated method stub
|
549 |
|
550 |
} |
551 |
|
552 |
public FeatureCache getCache() {
|
553 |
// TODO Auto-generated method stub
|
554 |
return null; |
555 |
} |
556 |
|
557 |
public void clear() { |
558 |
// Nothing to do
|
559 |
} |
560 |
|
561 |
public String getProviderName() { |
562 |
// TODO Auto-generated method stub
|
563 |
return null; |
564 |
} |
565 |
|
566 |
public String getFullName() { |
567 |
// TODO Auto-generated method stub
|
568 |
return null; |
569 |
} |
570 |
|
571 |
public boolean isKnownEnvelope() { |
572 |
// TODO Auto-generated method stub
|
573 |
return false; |
574 |
} |
575 |
|
576 |
public boolean hasRetrievedFeaturesLimit() { |
577 |
// TODO Auto-generated method stub
|
578 |
return false; |
579 |
} |
580 |
|
581 |
public int getRetrievedFeaturesLimit() { |
582 |
// TODO Auto-generated method stub
|
583 |
return 0; |
584 |
} |
585 |
|
586 |
public Interval getInterval() {
|
587 |
// TODO Auto-generated method stub
|
588 |
return null; |
589 |
} |
590 |
|
591 |
public Collection getTimes() { |
592 |
// TODO Auto-generated method stub
|
593 |
return null; |
594 |
} |
595 |
|
596 |
public Collection getTimes(Interval interval) { |
597 |
// TODO Auto-generated method stub
|
598 |
return null; |
599 |
} |
600 |
|
601 |
public FeatureIndex createIndex(String indexTypeName, |
602 |
FeatureType featureType, String attributeName, String indexName) |
603 |
throws DataException {
|
604 |
// TODO Auto-generated method stub
|
605 |
return null; |
606 |
} |
607 |
|
608 |
public FeatureIndex createIndex(String indexTypeName, |
609 |
FeatureType featureType, String attributeName, String indexName, |
610 |
Observer observer) throws DataException { |
611 |
// TODO Auto-generated method stub
|
612 |
return null; |
613 |
} |
614 |
|
615 |
/* (non-Javadoc)
|
616 |
* @see java.lang.Object#clone()
|
617 |
*/
|
618 |
public Object clone() throws CloneNotSupportedException { |
619 |
// TODO Auto-generated method stub
|
620 |
return super.clone(); |
621 |
} |
622 |
|
623 |
/* (non-Javadoc)
|
624 |
* @see org.gvsig.fmap.dal.feature.FeatureStore#commitChanges()
|
625 |
*/
|
626 |
public void commitChanges() throws DataException { |
627 |
// TODO Auto-generated method stub
|
628 |
|
629 |
} |
630 |
|
631 |
/* (non-Javadoc)
|
632 |
* @see org.gvsig.fmap.dal.feature.FeatureStore#canCommitChanges()
|
633 |
*/
|
634 |
public boolean canCommitChanges() throws DataException { |
635 |
// TODO Auto-generated method stub
|
636 |
return false; |
637 |
} |
638 |
|
639 |
public Feature getFeature(DynObject dynobject) {
|
640 |
// TODO Auto-generated method stub
|
641 |
return null; |
642 |
} |
643 |
|
644 |
public EditableFeature createNewFeature(Feature defaultValues) throws DataException { |
645 |
return null; |
646 |
} |
647 |
|
648 |
public Iterator iterator() { |
649 |
return null; |
650 |
} |
651 |
|
652 |
} |