Revision 41818 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.api/src/main/java/org/gvsig/fmap/dal/feature/FeatureStore.java

View differences:

FeatureStore.java
49 49
 * {@link Feature}(s). {@link Feature}(s) from the same FeatureStore can be of
50 50
 * different {@link FeatureType}(s) (as in GML format for instance).
51 51
 * </p>
52
 * 
52
 *
53 53
 * <p>
54 54
 * FeatureStore allows:
55 55
 * </p>
......
68 68
 * <li>Selection.
69 69
 * <li>Locks management.
70 70
 * </ul>
71
 * 
71
 *
72 72
 */
73 73
public interface FeatureStore extends DataStore, UndoRedoStack, Cloneable {
74 74

  
......
85 85

  
86 86
    /*
87 87
     * =============================================================
88
     * 
88
     *
89 89
     * information related services
90 90
     */
91 91

  
92 92
    /**
93 93
     * Indicates whether this store allows writing.
94
     * 
94
     *
95 95
     * @return
96 96
     *         true if this store can be written, false if not.
97 97
     */
......
99 99

  
100 100
    /**
101 101
     * Returns this store's default {@link FeatureType}.
102
     * 
102
     *
103 103
     * @return
104 104
     *         this store's default {@link FeatureType}.
105
     * 
105
     *
106 106
     * @throws DataException
107 107
     */
108 108
    public FeatureType getDefaultFeatureType() throws DataException;
......
110 110
    /**
111 111
     * Returns this store's featureType {@link FeatureType} matches with
112 112
     * featureTypeId.
113
     * 
113
     *
114 114
     * @param featureTypeId
115
     * 
115
     *
116 116
     * @return this store's default {@link FeatureType}.
117
     * 
117
     *
118 118
     * @throws DataException
119 119
     */
120 120
    public FeatureType getFeatureType(String featureTypeId)
......
122 122

  
123 123
    /**
124 124
     * Returns this store's {@link FeatureType}(s).
125
     * 
125
     *
126 126
     * @return a list with this store's {@link FeatureType}(s).
127
     * 
127
     *
128 128
     * @throws DataException
129 129
     */
130 130
    public List getFeatureTypes() throws DataException;
131 131

  
132 132
    /**
133 133
     * Returns this store's parameters.
134
     * 
134
     *
135 135
     * @return
136 136
     *         {@link DataStoreParameters} containing this store's parameters
137 137
     */
......
145 145

  
146 146
    /**
147 147
     * Returns this store's total envelope (extent).
148
     * 
148
     *
149 149
     * @return this store's total envelope (extent) or <code>null</code> if
150 150
     *         store not have geometry information
151 151
     */
152 152
    public Envelope getEnvelope() throws DataException;
153 153

  
154 154
    /**
155
     * 
155
     *
156 156
     * @deprecated use getDefaultFeatureType().getDefaultSRS()
157 157
     * @return
158 158
     * @throws DataException
......
161 161

  
162 162
    /**
163 163
     * Exports this store to another store.
164
     * 
164
     *
165 165
     * @param explorer
166 166
     *            {@link DataServerExplorer} target
167 167
     * @param params
168 168
     *            New parameters of this store that will be used on the target
169 169
     *            explorer
170
     * 
170
     *
171 171
     * @throws DataException
172
     * 
172
     *
173 173
     * @Deprecated this method is unstable
174 174
     */
175 175
    public void export(DataServerExplorer explorer, String provider,
......
177 177

  
178 178
    /*
179 179
     * =============================================================
180
     * 
180
     *
181 181
     * Query related services
182 182
     */
183 183

  
......
185 185
     * Returns all available features in the store.
186 186
     * <p>
187 187
     * <em>
188
     * <strong>NOTE:</strong> if you use this method to get a 
189
     * {@link FeatureSet}, you  must get sure it is disposed 
190
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an 
191
     * error occurs while getting the data. It is recommended to use the 
192
     * <code>accept</code> methods instead, which handle everything for you. 
193
     * Take into account the accept methods may use a fast iterator to 
188
     * <strong>NOTE:</strong> if you use this method to get a
189
     * {@link FeatureSet}, you  must get sure it is disposed
190
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an
191
     * error occurs while getting the data. It is recommended to use the
192
     * <code>accept</code> methods instead, which handle everything for you.
193
     * Take into account the accept methods may use a fast iterator to
194 194
     * get the features.
195 195
     * </em>
196 196
     * </p>
197
     * 
197
     *
198 198
     * @see #accept(org.gvsig.tools.visitor.Visitor)
199
     * 
199
     *
200 200
     * @return a collection of features
201 201
     * @throws ReadException
202 202
     *             if there is any error while reading the features
......
208 208
     * restrictions of the FeatureQuery.
209 209
     * <p>
210 210
     * <em>
211
     * <strong>NOTE:</strong> if you use this method to get a 
212
     * {@link FeatureSet}, you  must get sure it is disposed 
213
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an 
214
     * error occurs while getting the data. It is recommended to use the 
215
     * <code>accept</code> methods instead, which handle everything for you. 
216
     * Take into account the accept methods may use a fast iterator to 
211
     * <strong>NOTE:</strong> if you use this method to get a
212
     * {@link FeatureSet}, you  must get sure it is disposed
213
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an
214
     * error occurs while getting the data. It is recommended to use the
215
     * <code>accept</code> methods instead, which handle everything for you.
216
     * Take into account the accept methods may use a fast iterator to
217 217
     * get the features.
218 218
     * </em>
219 219
     * </p>
220
     * 
220
     *
221 221
     * @see #accept(org.gvsig.tools.visitor.Visitor,
222 222
     *      org.gvsig.fmap.dal.DataQuery)
223
     * 
223
     *
224 224
     * @param featureQuery
225 225
     *            defines the characteristics of the features to return
226 226
     * @return a collection of features
......
233 233
     * Loads a subset of features taking into account the properties and
234 234
     * restrictions of the FeatureQuery. Feature loading is performed by calling
235 235
     * the Observer, once each loaded Feature.
236
     * 
236
     *
237 237
     * @param featureQuery
238 238
     *            defines the characteristics of the features to return
239 239
     * @param observer
......
247 247
    /**
248 248
     * Loads all available feature in the store. The loading of Features is
249 249
     * performed by calling the Observer, once each loaded Feature.
250
     * 
250
     *
251 251
     * @param observer
252 252
     *            to be notified of each loaded Feature
253 253
     * @throws DataException
......
257 257

  
258 258
    /**
259 259
     * Returns the feature given its reference.
260
     * 
260
     *
261 261
     * @param reference
262 262
     *            a unique FeatureReference
263 263
     * @return
264 264
     *         The Feature
265
     * 
265
     *
266 266
     * @throws DataException
267
     * 
267
     *
268 268
     */
269 269
    public Feature getFeatureByReference(FeatureReference reference)
270 270
        throws DataException;
271 271

  
272 272
    /**
273 273
     * Returns the feature given its reference and feature type.
274
     * 
274
     *
275 275
     * @param reference
276 276
     *            a unique FeatureReference
277
     * 
277
     *
278 278
     * @param featureType
279 279
     *            FeatureType to which the requested Feature belongs
280
     * 
280
     *
281 281
     * @return
282 282
     *         The Feature
283
     * 
283
     *
284 284
     * @throws DataException
285
     * 
285
     *
286 286
     */
287 287
    public Feature getFeatureByReference(FeatureReference reference,
288 288
        FeatureType featureType) throws DataException;
289 289

  
290 290
    /*
291 291
     * =============================================================
292
     * 
292
     *
293 293
     * Editing related services
294 294
     */
295 295

  
......
300 300

  
301 301
    /**
302 302
     * Enters editing state specifying the editing mode.
303
     * 
303
     *
304 304
     * @param mode
305
     * 
305
     *
306 306
     * @throws DataException
307 307
     */
308 308
    public void edit(int mode) throws DataException;
309 309

  
310 310
    /**
311 311
     * Cancels all editing since the last edit().
312
     * 
312
     *
313 313
     * @throws DataException
314 314
     */
315 315
    public void cancelEditing() throws DataException;
316 316

  
317 317
    /**
318 318
     * Exits editing state.
319
     * 
319
     *
320 320
     * @throws DataException
321 321
     */
322 322
    public void finishEditing() throws DataException;
......
336 336
     * Returns true if you can call CommitChanges method.
337 337
     * If not in editing or changes have been made in the structure
338 338
     * return false.
339
     *  
339
     *
340 340
     * @return true if can call commitChanges
341
     * @throws DataException 
341
     * @throws DataException
342 342
     */
343 343
    public boolean canCommitChanges() throws DataException;
344 344

  
345
    
345

  
346 346
    /**
347 347
     * Indicates whether this store is in editing state.
348
     * 
348
     *
349 349
     * @return
350 350
     *         true if this store is in editing state, false if not.
351 351
     */
......
354 354
    /**
355 355
     * Indicates whether this store is in appending state. In this state the new
356 356
     * features are automatically inserted at the end of the {@link FeatureSet}.
357
     * 
357
     *
358 358
     * @return true if this store is in appending state.
359 359
     */
360 360
    public boolean isAppending();
......
362 362
    /**
363 363
     * Updates a {@link FeatureType} in the store with the changes in the
364 364
     * {@link EditableFeatureType}.<br>
365
     * 
365
     *
366 366
     * Any {@link FeatureSet} from this store that are used will be invalidated.
367
     * 
367
     *
368 368
     * @param featureType
369 369
     *            an {@link EditableFeatureType} with the changes.
370
     * 
370
     *
371 371
     * @throws DataException
372 372
     */
373 373
    public void update(EditableFeatureType featureType) throws DataException;
......
375 375
    /**
376 376
     * Updates a {@link Feature} in the store with the changes in the
377 377
     * {@link EditableFeature}.<br>
378
     * 
378
     *
379 379
     * Any {@link FeatureSet} from this store that was still in use will be
380 380
     * invalidated. You can override this using
381 381
     * {@link FeatureSet#update(EditableFeature)}.
382
     * 
382
     *
383 383
     * @param feature
384 384
     *            the feature to be updated
385
     * 
385
     *
386 386
     * @throws DataException
387 387
     */
388 388
    public void update(EditableFeature feature) throws DataException;
389 389

  
390 390
    /**
391 391
     * Deletes a {@link Feature} from the store.<br>
392
     * 
392
     *
393 393
     * Any {@link FeatureSet} from this store that was still in use will be
394 394
     * invalidated. You can override this using {@link Iterator#remove()} from
395 395
     * {@link FeatureSet}.
396
     * 
396
     *
397 397
     * @param feature
398 398
     *            The feature to be deleted.
399
     * 
399
     *
400 400
     * @throws DataException
401 401
     */
402 402
    public void delete(Feature feature) throws DataException;
403 403

  
404 404
    /**
405 405
     * Inserts a {@link Feature} in the store.<br>
406
     * 
406
     *
407 407
     * Any {@link FeatureSet} from this store that was still in use will be
408 408
     * invalidated. You can override this using
409 409
     * {@link FeatureSet#insert(EditableFeature)}.
410
     * 
410
     *
411 411
     * @param feature
412 412
     *            The feature to be inserted
413
     * 
413
     *
414 414
     * @throws DataException
415 415
     */
416 416
    public void insert(EditableFeature feature) throws DataException;
......
418 418
    /**
419 419
     * Creates a new feature using the default feature type and returns it as an
420 420
     * {@link EditableFeature}
421
     * 
421
     *
422 422
     * @return a new feature in editable state
423
     * 
423
     *
424 424
     * @throws DataException
425 425
     */
426 426
    public EditableFeature createNewFeature() throws DataException;
......
428 428
    /**
429 429
     * Creates a new feature of the given {@link FeatureType} and uses the given
430 430
     * {@link Feature} as default values to initialize it.
431
     * 
431
     *
432 432
     * @param type
433 433
     *            the new feature's feature type
434
     * 
434
     *
435 435
     * @param defaultValues
436 436
     *            a feature whose values are used as default values for the new
437 437
     *            feature.
438
     * 
438
     *
439 439
     * @return the new feature.
440
     * 
440
     *
441 441
     * @throws DataException
442 442
     */
443 443
    public EditableFeature createNewFeature(FeatureType type,
......
447 447
     * Creates a new feature of the given {@link FeatureType}. The flag
448 448
     * defaultValues is used to indicate whether the new feature should be
449 449
     * initialized with default values or not.
450
     * 
450
     *
451 451
     * @param type
452 452
     *            the new feature's feature type
453
     * 
453
     *
454 454
     * @param defaultValues
455 455
     *            if true the new feature is initialized with each attribute's
456 456
     *            default value.
457
     * 
457
     *
458 458
     * @return
459 459
     *         the new feature
460
     * 
460
     *
461 461
     * @throws DataException
462 462
     */
463 463
    public EditableFeature createNewFeature(FeatureType type,
......
467 467
     * Creates a new feature of default {@link FeatureType}. The flag
468 468
     * defaultValues is used to indicate whether the new feature should be
469 469
     * initialized with default values or not.
470
     * 
470
     *
471 471
     * @param defaultValues
472 472
     *            if true the new feature is initialized with each attribute's
473 473
     *            default value.
474
     * 
474
     *
475 475
     * @return
476 476
     *         the new feature
477
     * 
477
     *
478 478
     * @throws DataException
479 479
     */
480 480
    public EditableFeature createNewFeature(boolean defaultValues)
......
483 483
    /**
484 484
     * Applies the validation rules associated to the given mode to the active
485 485
     * {@link FeatureSet}.
486
     * 
486
     *
487 487
     * @param mode
488 488
     *            can be one of {MODE_QUERY, MODE_FULLEDIT, MODE_APPEND}
489
     * 
489
     *
490 490
     * @throws DataException
491 491
     */
492 492
    public void validateFeatures(int mode) throws DataException;
493 493

  
494 494
    /**
495 495
     * Indicates whether this store supports append mode.
496
     * 
496
     *
497 497
     * @return
498 498
     *         true if this store supports append mode.
499 499
     */
......
502 502
    /**
503 503
     * Initiates an editing group. This is typically used to group series of
504 504
     * store editing operations.
505
     * 
505
     *
506 506
     * @param description
507 507
     *            Description of the editing group.
508
     * 
508
     *
509 509
     * @throws NeedEditingModeException
510 510
     */
511 511
    public void beginEditingGroup(String description)
......
513 513

  
514 514
    /**
515 515
     * Finishes an editing group.
516
     * 
516
     *
517 517
     * @throws NeedEditingModeException
518 518
     */
519 519
    public void endEditingGroup() throws NeedEditingModeException;
520 520

  
521 521
    /*
522 522
     * =============================================================
523
     * 
523
     *
524 524
     * Index related services
525 525
     */
526 526

  
527 527
    /**
528 528
     * Creates an index which will be applied to the features of the given type,
529 529
     * by using the data of the given attribute.
530
     * 
530
     *
531 531
     * @param featureType
532 532
     *            The FeatureType to which the indexed attribute belongs.
533
     * 
533
     *
534 534
     * @param attributeName
535 535
     *            The name of the attributed to be indexed
536
     * 
536
     *
537 537
     * @param indexName
538 538
     *            The index name
539
     * 
539
     *
540 540
     * @return the resulting {@link FeatureIndex}
541
     * 
542
     * 
541
     *
542
     *
543 543
     * @throws FeatureIndexException
544 544
     *             if there is an error creating the index
545 545
     */
......
549 549
    /**
550 550
     * Creates an index which will be applied to the features of the given type,
551 551
     * by using the data of the given attribute.
552
     * 
552
     *
553 553
     * @param indexTypeName
554 554
     *            the type of the index to be created. That name is
555 555
     *            related to one of the registered index providers
556 556
     * @param featureType
557 557
     *            The FeatureType to which the indexed attribute belongs.
558
     * 
558
     *
559 559
     * @param attributeName
560 560
     *            The name of the attributed to be indexed
561
     * 
561
     *
562 562
     * @param indexName
563 563
     *            The index name
564
     * 
564
     *
565 565
     * @return the resulting {@link FeatureIndex}
566
     * 
567
     * 
566
     *
567
     *
568 568
     * @throws FeatureIndexException
569 569
     *             if there is an error creating the index
570 570
     */
......
580 580
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
581 581
     * when the index has finished filling with data and is available to be
582 582
     * used.
583
     * 
583
     *
584 584
     * @param featureType
585 585
     *            The FeatureType to which the indexed attribute belongs.
586
     * 
586
     *
587 587
     * @param attributeName
588 588
     *            The name of the attributed to be indexed
589
     * 
589
     *
590 590
     * @param indexName
591 591
     *            The index name
592
     * 
592
     *
593 593
     * @param observer
594 594
     *            to notify to when the created index has finished filling
595 595
     *            with data and is available to be used. The observer will
......
600 600
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
601 601
     *            notification with the exception object if there has been
602 602
     *            any error in the process. Optional.
603
     * 
603
     *
604 604
     * @return the resulting {@link FeatureIndex}
605
     * 
605
     *
606 606
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
607 607
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
608 608
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
609 609
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
610
     * 
610
     *
611 611
     * @throws FeatureIndexException
612 612
     *             if there is an error creating the index
613 613
     */
......
623 623
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
624 624
     * when the index has finished filling with data and is available to be
625 625
     * used.
626
     * 
626
     *
627 627
     * @param indexTypeName
628 628
     *            the type of the index to be created. That name is
629 629
     *            related to one of the registered index providers
630 630
     * @param featureType
631 631
     *            The FeatureType to which the indexed attribute belongs.
632
     * 
632
     *
633 633
     * @param attributeName
634 634
     *            The name of the attributed to be indexed
635
     * 
635
     *
636 636
     * @param indexName
637 637
     *            The index name
638
     * 
638
     *
639 639
     * @param observer
640 640
     *            to notify to when the created index has finished filling
641 641
     *            with data and is available to be used. The observer will
......
646 646
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
647 647
     *            notification with the exception object if there has been
648 648
     *            any error in the process. Optional.
649
     * 
649
     *
650 650
     * @return the resulting {@link FeatureIndex}
651
     * 
651
     *
652 652
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
653 653
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
654 654
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
655 655
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
656
     * 
656
     *
657 657
     * @throws FeatureIndexException
658 658
     *             if there is an error creating the index
659 659
     */
......
664 664
    /**
665 665
     * Returns a FeatureIndexes structure containing all available indexes in
666 666
     * the store.
667
     * 
667
     *
668 668
     * @return
669 669
     */
670 670
    public FeatureIndexes getIndexes();
671 671

  
672 672
    /*
673 673
     * =============================================================
674
     * 
674
     *
675 675
     * Selection related services
676 676
     */
677 677

  
678 678
    /**
679 679
     * Sets the selection to the passed {@link FeatureSet}
680
     * 
680
     *
681 681
     * @param selection
682 682
     *            A {@link FeatureSet} with the requested selection
683 683
     */
......
685 685

  
686 686
    /**
687 687
     * Creates a {@link FeatureSelection}
688
     * 
688
     *
689 689
     * @return
690 690
     *         a {@link FeatureSelection}
691
     * 
691
     *
692 692
     * @throws DataException
693 693
     */
694 694
    public FeatureSelection createFeatureSelection() throws DataException;
......
696 696
    /**
697 697
     * Returns the current {@link FeatureSelection}.
698 698
     * Create a empty selection if not exits.
699
     * 
699
     *
700 700
     * @return
701 701
     *         current {@link FeatureSelection}.
702
     * 
702
     *
703 703
     * @throws DataException
704 704
     */
705 705
    public FeatureSelection getFeatureSelection() throws DataException;
706 706

  
707 707
    /*
708 708
     * =============================================================
709
     * 
709
     *
710 710
     * Lock related services
711 711
     */
712 712

  
713 713
    /**
714 714
     * Indicates whether this store supports locks.
715
     * 
715
     *
716 716
     * @return
717 717
     *         true if this store supports locks, false if not.
718 718
     */
......
720 720

  
721 721
    /**
722 722
     * Returns the set of locked features
723
     * 
723
     *
724 724
     * @return
725 725
     *         set of locked features
726
     * 
726
     *
727 727
     * @throws DataException
728 728
     */
729 729
    public FeatureLocks getLocks() throws DataException;
......
736 736

  
737 737
    /**
738 738
     * Returns this store transforms
739
     * 
739
     *
740 740
     * @return
741 741
     *         this store transforms
742 742
     */
......
744 744

  
745 745
    /**
746 746
     * Returns a new {@link FeatureQuery} associated to this store.
747
     * 
747
     *
748 748
     * @return
749 749
     *         a new {@link FeatureQuery} associated to this store.
750 750
     */
......
752 752

  
753 753
    /**
754 754
     * Returns featue count of this store.
755
     * 
755
     *
756 756
     * @return
757 757
     * @throws DataException
758 758
     */
......
760 760

  
761 761
    /**
762 762
     * Creates a vectorial cache that is used to save and retrieve data.
763
     * 
763
     *
764 764
     * @param name
765 765
     *            the cache name.
766 766
     * @param parameters
......
779 779
     * Return if the provider knows the real envelope of a layer. If not,
780 780
     * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
781 781
     * the full envelope.
782
     * 
782
     *
783 783
     * @return
784 784
     *         <true> if it knows the real envelope.
785 785
     */
......
788 788
    /**
789 789
     * Return if the maximum number of features provided by the
790 790
     * provider are limited.
791
     * 
791
     *
792 792
     * @return
793 793
     *         <true> if there is a limit of features.
794 794
     */
......
798 798
     * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns
799 799
     * true,
800 800
     * it returns the limit of features retrieved from the provider.
801
     * 
801
     *
802 802
     * @return
803 803
     *         The limit of the retrieved features.
804 804
     */
805 805
    public int getRetrievedFeaturesLimit();
806

  
807
    /**
808
     * Return the associated feature to the dynobject.
809
     * If the dynobject isn't associated to a feature of this store, return null.
810
     *
811
     * @param dynobject
812
     * @return
813
     */
814
    public Feature getFeature(DynObject dynobject);
806 815
}

Also available in: Unified diff