Statistics
| Revision:

svn-gvsig-desktop / 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 @ 43628

History | View | Annotate | Download (28.6 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.dal.feature;
25

    
26
import java.util.Iterator;
27
import java.util.List;
28

    
29
import org.cresques.cts.IProjection;
30

    
31
import org.gvsig.fmap.dal.DataServerExplorer;
32
import org.gvsig.fmap.dal.DataStore;
33
import org.gvsig.fmap.dal.DataStoreParameters;
34
import org.gvsig.fmap.dal.ExpressionBuilder;
35
import org.gvsig.fmap.dal.exception.DataException;
36
import org.gvsig.fmap.dal.exception.ReadException;
37
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
38
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException;
39
import org.gvsig.fmap.geom.Geometry;
40
import org.gvsig.fmap.geom.SpatialIndex;
41
import org.gvsig.fmap.geom.primitive.Envelope;
42
import org.gvsig.tools.dispose.DisposableIterator;
43
import org.gvsig.tools.dynobject.DynObject;
44
import org.gvsig.tools.lang.Cloneable;
45
import org.gvsig.tools.observer.Observer;
46
import org.gvsig.tools.undo.UndoRedoStack;
47

    
48
/**
49
 * <p>
50
 * A FeatureStore is a type of store whose data consists on sets of
51
 * {@link Feature}(s). {@link Feature}(s) from the same FeatureStore can be of
52
 * different {@link FeatureType}(s) (as in GML format for instance).
53
 * </p>
54
 *
55
 * <p>
56
 * FeatureStore allows:
57
 * </p>
58
 * <ul>
59
 * <li>Obtaining the default {@link FeatureType}. A FeatureStore always has one
60
 * and only one default FeatureType.
61
 * <li>Obtaining the list of {@link FeatureType}(s) defined in the FeatureStore.
62
 * <li>Obtaining, filtering and sorting subsets of data ({@link FeatureSet})
63
 * through {@link FeatureQuery}, as well as background loading.
64
 * <li>Obtaining the total {@link Envelope} (AKA bounding box or extent) of the
65
 * store.
66
 * <li>Support for editing {@link FeatureType}(s).
67
 * <li>Obtaining information about contained {@link Geometry} types.
68
 * <li>Exporting to another store.
69
 * <li>Indexing.
70
 * <li>Selection.
71
 * <li>Locks management.
72
 * </ul>
73
 *
74
 */
75
public interface FeatureStore extends DataStore, UndoRedoStack, Cloneable {
76

    
77
    public static final String METADATA_DEFINITION_NAME = "FeatureStore";
78

    
79
    /** Indicates that this store is in query mode */
80
    final static int MODE_QUERY = 0;
81

    
82
    /** Indicates that this store is in full edit mode */
83
    final static int MODE_FULLEDIT = 1;
84

    
85
    /** Indicates that this store is in append mode */
86
    final static int MODE_APPEND = 2;
87

    
88
    /*
89
     * =============================================================
90
     *
91
     * information related services
92
     */
93

    
94
    /**
95
     * Indicates whether this store allows writing.
96
     *
97
     * @return
98
     *         true if this store can be written, false if not.
99
     */
100
    public boolean allowWrite();
101

    
102
    /**
103
     * Returns this store's default {@link FeatureType}.
104
     *
105
     * @return
106
     *         this store's default {@link FeatureType}.
107
     *
108
     * @throws DataException
109
     */
110
    public FeatureType getDefaultFeatureType() throws DataException;
111

    
112
    /**
113
     * Returns this store's featureType {@link FeatureType} matches with
114
     * featureTypeId.
115
     *
116
     * @param featureTypeId
117
     *
118
     * @return this store's default {@link FeatureType}.
119
     *
120
     * @throws DataException
121
     */
122
    public FeatureType getFeatureType(String featureTypeId)
123
        throws DataException;
124

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

    
134
    /**
135
     * Returns this store's parameters.
136
     *
137
     * @return
138
     *         {@link DataStoreParameters} containing this store's parameters
139
     */
140
    public DataStoreParameters getParameters();
141

    
142
    /**
143
     *@throws DataException
144
     * @deprecated Mirar de cambiarlo a metadatos
145
     */
146
    public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException;
147

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

    
156
    /**
157
     *
158
     * @deprecated use getDefaultFeatureType().getDefaultSRS()
159
     * @return
160
     * @throws DataException
161
     */
162
    public IProjection getSRSDefaultGeometry() throws DataException;
163

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

    
180
    /*
181
     * =============================================================
182
     *
183
     * Query related services
184
     */
185

    
186
    /**
187
     * Returns all available features in the store.
188
     * <p>
189
     * <em>
190
     * <strong>NOTE:</strong> if you use this method to get a
191
     * {@link FeatureSet}, you  must get sure it is disposed
192
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an
193
     * error occurs while getting the data. It is recommended to use the
194
     * <code>accept</code> methods instead, which handle everything for you.
195
     * Take into account the accept methods may use a fast iterator to
196
     * get the features.
197
     * </em>
198
     * </p>
199
     *
200
     * @see #accept(org.gvsig.tools.visitor.Visitor)
201
     *
202
     * @return a collection of features
203
     * @throws ReadException
204
     *             if there is any error while reading the features
205
     */
206
    FeatureSet getFeatureSet() throws DataException;
207

    
208
    FeatureSet getFeatureSet(String filter) throws DataException;
209

    
210
    FeatureSet getFeatureSet(String filter, String sortBy) throws DataException;
211

    
212
    FeatureSet getFeatureSet(String filter, String sortBy, boolean asc) throws DataException;
213

    
214
    /**
215
     * Returns a subset of features taking into account the properties and
216
     * restrictions of the FeatureQuery.
217
     * <p>
218
     * <em>
219
     * <strong>NOTE:</strong> if you use this method to get a
220
     * {@link FeatureSet}, you  must get sure it is disposed
221
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an
222
     * error occurs while getting the data. It is recommended to use the
223
     * <code>accept</code> methods instead, which handle everything for you.
224
     * Take into account the accept methods may use a fast iterator to
225
     * get the features.
226
     * </em>
227
     * </p>
228
     *
229
     * @see #accept(org.gvsig.tools.visitor.Visitor,
230
     *      org.gvsig.fmap.dal.DataQuery)
231
     *
232
     * @param featureQuery
233
     *            defines the characteristics of the features to return
234
     * @return a collection of features
235
     * @throws ReadException
236
     *             if there is any error while reading the features
237
     */
238
    FeatureSet getFeatureSet(FeatureQuery featureQuery) throws DataException;
239

    
240
    /**
241
     * Loads a subset of features taking into account the properties and
242
     * restrictions of the FeatureQuery. Feature loading is performed by calling
243
     * the Observer, once each loaded Feature.
244
     *
245
     * @param featureQuery
246
     *            defines the characteristics of the features to return
247
     * @param observer
248
     *            to be notified of each loaded Feature
249
     * @throws DataException
250
     *             if there is any error while loading the features
251
     */
252
    void getFeatureSet(FeatureQuery featureQuery, Observer observer)
253
        throws DataException;
254

    
255
    /**
256
     * Loads all available feature in the store. The loading of Features is
257
     * performed by calling the Observer, once each loaded Feature.
258
     *
259
     * @param observer
260
     *            to be notified of each loaded Feature
261
     * @throws DataException
262
     *             if there is any error while loading the features
263
     */
264
    void getFeatureSet(Observer observer) throws DataException;
265

    
266
    /**
267
     * Return a paginated list of Features filtered by the query.
268
     *
269
     * The returned List of Features is paginated, and the page size
270
     * used is "pageSize".
271
     *
272
     * @param query to filter the returned feature list
273
     * @param pageSize the page size of the list
274
     * @return the list of features
275
     */
276
    public List<Feature> getFeatures(FeatureQuery query, int pageSize);
277

    
278
    public List<Feature> getFeatures(FeatureQuery query);
279

    
280
    public List<Feature> getFeatures();
281

    
282
    public List<Feature> getFeatures(String filter);
283

    
284
    public List<Feature> getFeatures(String filter, String sortBy);
285

    
286
    public List<Feature> getFeatures(String filter, String sortBy, boolean asc);
287

    
288
    public Feature findFirst(String filter) throws DataException;
289

    
290
    public Feature findFirst(String filter, String sortBy) throws DataException;
291

    
292
    public Feature findFirst(String filter, String sortBy, boolean asc) throws DataException;
293

    
294
    /**
295
     * Returns the feature given its reference.
296
     *
297
     * @param reference
298
     *            a unique FeatureReference
299
     * @return
300
     *         The Feature
301
     *
302
     * @throws DataException
303
     *
304
     */
305
    public Feature getFeatureByReference(FeatureReference reference)
306
        throws DataException;
307

    
308
    /**
309
     * Returns the feature given its reference and feature type.
310
     *
311
     * @param reference
312
     *            a unique FeatureReference
313
     *
314
     * @param featureType
315
     *            FeatureType to which the requested Feature belongs
316
     *
317
     * @return
318
     *         The Feature
319
     *
320
     * @throws DataException
321
     *
322
     */
323
    public Feature getFeatureByReference(FeatureReference reference,
324
        FeatureType featureType) throws DataException;
325

    
326
    /*
327
     * =============================================================
328
     *
329
     * Editing related services
330
     */
331

    
332
    /**
333
     * Enters editing state.
334
     */
335
    public void edit() throws DataException;
336

    
337
    /**
338
     * Enters editing state specifying the editing mode.
339
     *
340
     * @param mode
341
     *
342
     * @throws DataException
343
     */
344
    public void edit(int mode) throws DataException;
345

    
346
    /**
347
     * Cancels all editing since the last edit().
348
     *
349
     * @throws DataException
350
     */
351
    public void cancelEditing() throws DataException;
352

    
353
    /**
354
     * Exits editing state.
355
     *
356
     * @throws DataException
357
     */
358
    public void finishEditing() throws DataException;
359

    
360
    /**
361
     * Save changes in the provider without leaving the edit mode.
362
     * Do not call observers to communicate a change of ediding mode.
363
     * The operation's history is eliminated to prevent inconsistencies
364
     * in the data.
365
     *
366
     * @throws DataException
367
     */
368
    public void commitChanges() throws DataException ;
369

    
370
    /**
371
     *
372
     * Returns true if you can call CommitChanges method.
373
     * If not in editing or changes have been made in the structure
374
     * return false.
375
     *
376
     * @return true if can call commitChanges
377
     * @throws DataException
378
     */
379
    public boolean canCommitChanges() throws DataException;
380

    
381

    
382
    /**
383
     * Indicates whether this store is in editing state.
384
     *
385
     * @return
386
     *         true if this store is in editing state, false if not.
387
     */
388
    public boolean isEditing();
389

    
390
    /**
391
     * Indicates whether this store is in appending state. In this state the new
392
     * features are automatically inserted at the end of the {@link FeatureSet}.
393
     *
394
     * @return true if this store is in appending state.
395
     */
396
    public boolean isAppending();
397

    
398
    /**
399
     * Updates a {@link FeatureType} in the store with the changes in the
400
     * {@link EditableFeatureType}.<br>
401
     *
402
     * Any {@link FeatureSet} from this store that are used will be invalidated.
403
     *
404
     * @param featureType
405
     *            an {@link EditableFeatureType} with the changes.
406
     *
407
     * @throws DataException
408
     */
409
    public void update(EditableFeatureType featureType) throws DataException;
410

    
411
    /**
412
     * Updates a {@link Feature} in the store with the changes in the
413
     * {@link EditableFeature}.<br>
414
     *
415
     * Any {@link FeatureSet} from this store that was still in use will be
416
     * invalidated. You can override this using
417
     * {@link FeatureSet#update(EditableFeature)}.
418
     *
419
     * @param feature
420
     *            the feature to be updated
421
     *
422
     * @throws DataException
423
     */
424
    public void update(EditableFeature feature) throws DataException;
425

    
426
    /**
427
     * Deletes a {@link Feature} from the store.<br>
428
     *
429
     * Any {@link FeatureSet} from this store that was still in use will be
430
     * invalidated. You can override this using {@link Iterator#remove()} from
431
     * {@link FeatureSet}.
432
     *
433
     * @param feature
434
     *            The feature to be deleted.
435
     *
436
     * @throws DataException
437
     */
438
    public void delete(Feature feature) throws DataException;
439

    
440
    /**
441
     * Inserts a {@link Feature} in the store.<br>
442
     *
443
     * Any {@link FeatureSet} from this store that was still in use will be
444
     * invalidated. You can override this using
445
     * {@link FeatureSet#insert(EditableFeature)}.
446
     *
447
     * @param feature
448
     *            The feature to be inserted
449
     *
450
     * @throws DataException
451
     */
452
    public void insert(EditableFeature feature) throws DataException;
453

    
454
    /**
455
     * Creates a new feature using the default feature type and returns it as an
456
     * {@link EditableFeature}
457
     *
458
     * @return a new feature in editable state
459
     *
460
     * @throws DataException
461
     */
462
    public EditableFeature createNewFeature() throws DataException;
463

    
464
    /**
465
     * Creates a new feature of the given {@link FeatureType} and uses the given
466
     * {@link Feature} as default values to initialize it.
467
     *
468
     * @param type
469
     *            the new feature's feature type
470
     *
471
     * @param defaultValues
472
     *            a feature whose values are used as default values for the new
473
     *            feature.
474
     *
475
     * @return the new feature.
476
     *
477
     * @throws DataException
478
     */
479
    public EditableFeature createNewFeature(FeatureType type,
480
        Feature defaultValues) throws DataException;
481

    
482
    /**
483
     * Creates a new feature of the given {@link FeatureType}. The flag
484
     * defaultValues is used to indicate whether the new feature should be
485
     * initialized with default values or not.
486
     *
487
     * @param type
488
     *            the new feature's feature type
489
     *
490
     * @param defaultValues
491
     *            if true the new feature is initialized with each attribute's
492
     *            default value.
493
     *
494
     * @return
495
     *         the new feature
496
     *
497
     * @throws DataException
498
     */
499
    public EditableFeature createNewFeature(FeatureType type,
500
        boolean defaultValues) throws DataException;
501

    
502
    /**
503
     * Creates a new feature of default {@link FeatureType}. The flag
504
     * defaultValues is used to indicate whether the new feature should be
505
     * initialized with default values or not.
506
     *
507
     * @param defaultValues
508
     *            if true the new feature is initialized with each attribute's
509
     *            default value.
510
     *
511
     * @return
512
     *         the new feature
513
     *
514
     * @throws DataException
515
     */
516
    public EditableFeature createNewFeature(boolean defaultValues)
517
        throws DataException;
518

    
519
    /**
520
     * Creates a new feature of default {@link FeatureType}.
521
     * The new feature should be initialized with the values of the feature
522
     * passed as parameter.
523
     * Values are inicialiced by name from the feature specified. Error in
524
     * value assignement are ignoreds.
525
     *
526
     * @param defaultValues the values to initialize the new feature.
527
     * @return the new feature
528
     * @throws DataException
529
     */
530
    public EditableFeature createNewFeature(Feature defaultValues)
531
        throws DataException;
532

    
533
    /**
534
     * Applies the validation rules associated to the given mode to the active
535
     * {@link FeatureSet}.
536
     *
537
     * @param mode
538
     *            can be one of {MODE_QUERY, MODE_FULLEDIT, MODE_APPEND}
539
     *
540
     * @throws DataException
541
     */
542
    public void validateFeatures(int mode) throws DataException;
543

    
544
    /**
545
     * Indicates whether this store supports append mode.
546
     *
547
     * @return
548
     *         true if this store supports append mode.
549
     */
550
    public boolean isAppendModeSupported();
551

    
552
    /**
553
     * Initiates an editing group. This is typically used to group series of
554
     * store editing operations.
555
     *
556
     * @param description
557
     *            Description of the editing group.
558
     *
559
     * @throws NeedEditingModeException
560
     */
561
    public void beginEditingGroup(String description)
562
        throws NeedEditingModeException;
563

    
564
    /**
565
     * Finishes an editing group.
566
     *
567
     * @throws NeedEditingModeException
568
     */
569
    public void endEditingGroup() throws NeedEditingModeException;
570

    
571
    /*
572
     * =============================================================
573
     *
574
     * Index related services
575
     */
576

    
577
    /**
578
     * Creates an index which will be applied to the features of the given type,
579
     * by using the data of the given attribute.
580
     *
581
     * @param featureType
582
     *            The FeatureType to which the indexed attribute belongs.
583
     *
584
     * @param attributeName
585
     *            The name of the attributed to be indexed
586
     *
587
     * @param indexName
588
     *            The index name
589
     *
590
     * @return the resulting {@link FeatureIndex}
591
     *
592
     *
593
     * @throws FeatureIndexException
594
     *             if there is an error creating the index
595
     */
596
    public FeatureIndex createIndex(FeatureType featureType,
597
        String attributeName, String indexName) throws DataException;
598

    
599
    /**
600
     * Creates an index which will be applied to the features of the given type,
601
     * by using the data of the given attribute.
602
     *
603
     * @param indexTypeName
604
     *            the type of the index to be created. That name is
605
     *            related to one of the registered index providers
606
     * @param featureType
607
     *            The FeatureType to which the indexed attribute belongs.
608
     *
609
     * @param attributeName
610
     *            The name of the attributed to be indexed
611
     *
612
     * @param indexName
613
     *            The index name
614
     *
615
     * @return the resulting {@link FeatureIndex}
616
     *
617
     *
618
     * @throws FeatureIndexException
619
     *             if there is an error creating the index
620
     */
621
    public FeatureIndex createIndex(String indexTypeName,
622
        FeatureType featureType, String attributeName, String indexName)
623
        throws DataException;
624

    
625
    /**
626
     * Creates an index which will be applied to the features of the given type,
627
     * by using the data of the given attribute. This method will return without
628
     * waiting for the index to be filled, as that will be performed in
629
     * background. An optional {@link Observer} parameter is provided to be
630
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
631
     * when the index has finished filling with data and is available to be
632
     * used.
633
     *
634
     * @param featureType
635
     *            The FeatureType to which the indexed attribute belongs.
636
     *
637
     * @param attributeName
638
     *            The name of the attributed to be indexed
639
     *
640
     * @param indexName
641
     *            The index name
642
     *
643
     * @param observer
644
     *            to notify to when the created index has finished filling
645
     *            with data and is available to be used. The observer will
646
     *            receive then a
647
     *            {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
648
     *            notification, with the index object if it has finished
649
     *            successfully, or a
650
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
651
     *            notification with the exception object if there has been
652
     *            any error in the process. Optional.
653
     *
654
     * @return the resulting {@link FeatureIndex}
655
     *
656
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
657
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
658
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
659
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
660
     *
661
     * @throws FeatureIndexException
662
     *             if there is an error creating the index
663
     */
664
    public FeatureIndex createIndex(FeatureType featureType,
665
        String attributeName, String indexName, Observer observer)
666
        throws DataException;
667

    
668
    /**
669
     * Creates an index which will be applied to the features of the given type,
670
     * by using the data of the given attribute. This method will return without
671
     * waiting for the index to be filled, as that will be performed in
672
     * background. An optional {@link Observer} parameter is provided to be
673
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
674
     * when the index has finished filling with data and is available to be
675
     * used.
676
     *
677
     * @param indexTypeName
678
     *            the type of the index to be created. That name is
679
     *            related to one of the registered index providers
680
     * @param featureType
681
     *            The FeatureType to which the indexed attribute belongs.
682
     *
683
     * @param attributeName
684
     *            The name of the attributed to be indexed
685
     *
686
     * @param indexName
687
     *            The index name
688
     *
689
     * @param observer
690
     *            to notify to when the created index has finished filling
691
     *            with data and is available to be used. The observer will
692
     *            receive then a
693
     *            {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
694
     *            notification, with the index object if it has finished
695
     *            successfully, or a
696
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
697
     *            notification with the exception object if there has been
698
     *            any error in the process. Optional.
699
     *
700
     * @return the resulting {@link FeatureIndex}
701
     *
702
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
703
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
704
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
705
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
706
     *
707
     * @throws FeatureIndexException
708
     *             if there is an error creating the index
709
     */
710
    public FeatureIndex createIndex(String indexTypeName,
711
        FeatureType featureType, String attributeName, String indexName,
712
        Observer observer) throws DataException;
713

    
714
    /**
715
     * Returns a FeatureIndexes structure containing all available indexes in
716
     * the store.
717
     *
718
     * @return
719
     */
720
    public FeatureIndexes getIndexes();
721

    
722
    /*
723
     * =============================================================
724
     *
725
     * Selection related services
726
     */
727

    
728
    /**
729
     * Sets the selection to the passed {@link FeatureSet}
730
     *
731
     * @param selection
732
     *            A {@link FeatureSet} with the requested selection
733
     */
734
    public void setSelection(FeatureSet selection) throws DataException;
735

    
736
    /**
737
     * Creates a {@link FeatureSelection}
738
     *
739
     * @return
740
     *         a {@link FeatureSelection}
741
     *
742
     * @throws DataException
743
     */
744
    public FeatureSelection createFeatureSelection() throws DataException;
745

    
746
    /**
747
     * Returns the current {@link FeatureSelection}.
748
     * Create a empty selection if not exits.
749
     * 
750
     * Manage of the selection can be slow on some data sources. 
751
     * Use with care.
752
     * In data sources that do not support position access to records, 
753
     * it may be slow to retrieve items from the selection. In some data 
754
     * sources it may be necessary to access to this to retrieve each 
755
     * item in the selection.
756
     *
757
     * @return
758
     *         current {@link FeatureSelection}.
759
     *
760
     * @throws DataException
761
     */
762
    public FeatureSelection getFeatureSelection() throws DataException;
763

    
764
    /*
765
     * =============================================================
766
     *
767
     * Lock related services
768
     */
769

    
770
    /**
771
     * Indicates whether this store supports locks.
772
     *
773
     * @return
774
     *         true if this store supports locks, false if not.
775
     */
776
    public boolean isLocksSupported();
777

    
778
    /**
779
     * Returns the set of locked features
780
     *
781
     * @return
782
     *         set of locked features
783
     *
784
     * @throws DataException
785
     */
786
    public FeatureLocks getLocks() throws DataException;
787

    
788
    /*
789
     * =============================================================
790
     * Transforms related services
791
     * =============================================================
792
     */
793

    
794
    /**
795
     * Returns this store transforms
796
     *
797
     * @return
798
     *         this store transforms
799
     */
800
    public FeatureStoreTransforms getTransforms();
801

    
802
    /**
803
     * Returns a new {@link FeatureQuery} associated to this store.
804
     *
805
     * @return
806
     *         a new {@link FeatureQuery} associated to this store.
807
     */
808
    public FeatureQuery createFeatureQuery();
809

    
810
    /**
811
     * Returns featue count of this store.
812
     *
813
     * @return
814
     * @throws DataException
815
     */
816
    public long getFeatureCount() throws DataException;
817

    
818
//    /**
819
//     * Creates a vectorial cache that is used to save and retrieve data.
820
//     *
821
//     * @param name
822
//     *            the cache name.
823
//     * @param parameters
824
//     *            parameters to create the stores used to save data.
825
//     * @throws DataException
826
//     */
827
//    public void createCache(String name, DynObject parameters)
828
//        throws DataException;
829
//
830
//    /**
831
//     * @return the vectorial cache
832
//     */
833
//    public FeatureCache getCache();
834

    
835
    /**
836
     * Return if the provider knows the real envelope of a layer. If not,
837
     * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
838
     * the full envelope.
839
     *
840
     * @return
841
     *         <true> if it knows the real envelope.
842
     */
843
    public boolean isKnownEnvelope();
844

    
845
    /**
846
     * Return if the maximum number of features provided by the
847
     * provider are limited.
848
     *
849
     * @return
850
     *         <true> if there is a limit of features.
851
     */
852
    public boolean hasRetrievedFeaturesLimit();
853

    
854
    /**
855
     * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns
856
     * true,
857
     * it returns the limit of features retrieved from the provider.
858
     *
859
     * @return
860
     *         The limit of the retrieved features.
861
     */
862
    public int getRetrievedFeaturesLimit();
863

    
864
    /**
865
     * Return the associated feature to the dynobject.
866
     * If the dynobject isn't associated to a feature of this store, return null.
867
     *
868
     * @param dynobject
869
     * @return
870
     */
871
    public Feature getFeature(DynObject dynobject);
872

    
873
    public Iterator iterator();
874

    
875
    public ExpressionBuilder createExpressionBuilder();
876

    
877
    /**
878
     * 
879
     * @return 
880
     * @deprecated use createExpressionBuilder
881
     */
882
    public ExpressionBuilder createExpression();
883

    
884
    public void createCache(String name, DynObject parameters)
885
        throws DataException;
886

    
887
    public FeatureCache getCache();
888

    
889
    public boolean isBroken();
890

    
891
        public Throwable getBreakingsCause();
892

    
893
    /**
894
     * @param index
895
     * @return
896
     */
897
    SpatialIndex wrapSpatialIndex(SpatialIndex index);
898
}