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 @ 44259

History | View | Annotate | Download (30.2 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
import org.gvsig.expressionevaluator.Expression;
31
import org.gvsig.expressionevaluator.ExpressionBuilder;
32

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

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

    
80
    public static final String METADATA_DEFINITION_NAME = "FeatureStore";
81

    
82
    /** Indicates that this store is in query mode */
83
    final static int MODE_QUERY = 0;
84

    
85
    /** Indicates that this store is in full edit mode */
86
    final static int MODE_FULLEDIT = 1;
87

    
88
    /** Indicates that this store is in append mode */
89
    final static int MODE_APPEND = 2;
90

    
91
    /*
92
     * =============================================================
93
     *
94
     * information related services
95
     */
96

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

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

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

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

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

    
145
    /**
146
     *@throws DataException
147
     * @deprecated Mirar de cambiarlo a metadatos
148
     */
149
    public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException;
150

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

    
159
    /**
160
     *
161
     * @deprecated use getDefaultFeatureType().getDefaultSRS()
162
     * @return
163
     * @throws DataException
164
     */
165
    public IProjection getSRSDefaultGeometry() throws DataException;
166

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

    
183
    /*
184
     * =============================================================
185
     *
186
     * Query related services
187
     */
188

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

    
211
    FeatureSet getFeatureSet(String filter) throws DataException;
212

    
213
    FeatureSet getFeatureSet(String filter, String sortBy) throws DataException;
214

    
215
    FeatureSet getFeatureSet(String filter, String sortBy, boolean asc) throws DataException;
216

    
217
    FeatureSet getFeatureSet(Expression filter) throws DataException;
218

    
219
    FeatureSet getFeatureSet(Expression filter, String sortBy) throws DataException;
220

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

    
248
    /**
249
     * Loads a subset of features taking into account the properties and
250
     * restrictions of the FeatureQuery. Feature loading is performed by calling
251
     * the Observer, once each loaded Feature.
252
     *
253
     * @param featureQuery
254
     *            defines the characteristics of the features to return
255
     * @param observer
256
     *            to be notified of each loaded Feature
257
     * @throws DataException
258
     *             if there is any error while loading the features
259
     */
260
    void getFeatureSet(FeatureQuery featureQuery, Observer observer)
261
        throws DataException;
262

    
263
    /**
264
     * Loads all available feature in the store. The loading of Features is
265
     * performed by calling the Observer, once each loaded Feature.
266
     *
267
     * @param observer
268
     *            to be notified of each loaded Feature
269
     * @throws DataException
270
     *             if there is any error while loading the features
271
     */
272
    void getFeatureSet(Observer observer) throws DataException;
273

    
274
    /**
275
     * Return a paginated list of Features filtered by the query.
276
     *
277
     * The returned List of Features is paginated, and the page size
278
     * used is "pageSize".
279
     *
280
     * @param query to filter the returned feature list
281
     * @param pageSize the page size of the list
282
     * @return the list of features
283
     */
284
    public List<Feature> getFeatures(FeatureQuery query, int pageSize);
285

    
286
    public List<Feature> getFeatures(FeatureQuery query);
287

    
288
    public List<Feature> getFeatures();
289

    
290
    public List<Feature> getFeatures(String filter);
291

    
292
    public List<Feature> getFeatures(String filter, String sortBy);
293

    
294
    public List<Feature> getFeatures(String filter, String sortBy, boolean asc);
295

    
296
    public List<Feature> getFeatures(Expression filter);
297

    
298
    public List<Feature> getFeatures(Expression filter, String sortBy);
299

    
300
    public List<Feature> getFeatures(Expression filter, String sortBy, boolean asc);
301

    
302
    public Feature first() throws DataException;
303

    
304
    public Feature findFirst(String filter) throws DataException;
305

    
306
    public Feature findFirst(String filter, String sortBy) throws DataException;
307

    
308
    public Feature findFirst(String filter, String sortBy, boolean asc) throws DataException;
309

    
310
    public Feature findFirst(Expression filter) throws DataException;
311

    
312
    public Feature findFirst(Expression filter, String sortBy) throws DataException;
313

    
314
    public Feature findFirst(Expression filter, String sortBy, boolean asc) throws DataException;
315

    
316
    /**
317
     * Returns the feature given its reference.
318
     *
319
     * @param reference
320
     *            a unique FeatureReference
321
     * @return
322
     *         The Feature
323
     *
324
     * @throws DataException
325
     *
326
     */
327
    public Feature getFeatureByReference(FeatureReference reference)
328
        throws DataException;
329

    
330
    /**
331
     * Returns the feature given its reference and feature type.
332
     *
333
     * @param reference
334
     *            a unique FeatureReference
335
     *
336
     * @param featureType
337
     *            FeatureType to which the requested Feature belongs
338
     *
339
     * @return
340
     *         The Feature
341
     *
342
     * @throws DataException
343
     *
344
     */
345
    public Feature getFeatureByReference(FeatureReference reference,
346
        FeatureType featureType) throws DataException;
347

    
348
    /*
349
     * =============================================================
350
     *
351
     * Editing related services
352
     */
353

    
354
    /**
355
     * Enters editing state.
356
     */
357
    public void edit() throws DataException;
358

    
359
    /**
360
     * Enters editing state specifying the editing mode.
361
     *
362
     * @param mode
363
     *
364
     * @throws DataException
365
     */
366
    public void edit(int mode) throws DataException;
367

    
368
    /**
369
     * Cancels all editing since the last edit().
370
     *
371
     * @throws DataException
372
     */
373
    public void cancelEditing() throws DataException;
374

    
375
    /**
376
     * Exits editing state.
377
     *
378
     * @throws DataException
379
     */
380
    public void finishEditing() throws DataException;
381

    
382
    /**
383
     * Save changes in the provider without leaving the edit mode.
384
     * Do not call observers to communicate a change of ediding mode.
385
     * The operation's history is eliminated to prevent inconsistencies
386
     * in the data.
387
     *
388
     * @throws DataException
389
     */
390
    public void commitChanges() throws DataException ;
391

    
392
    /**
393
     *
394
     * Returns true if you can call CommitChanges method.
395
     * If not in editing or changes have been made in the structure
396
     * return false.
397
     *
398
     * @return true if can call commitChanges
399
     * @throws DataException
400
     */
401
    public boolean canCommitChanges() throws DataException;
402

    
403

    
404
    /**
405
     * Indicates whether this store is in editing state.
406
     *
407
     * @return
408
     *         true if this store is in editing state, false if not.
409
     */
410
    public boolean isEditing();
411

    
412
    /**
413
     * Indicates whether this store is in appending state. In this state the new
414
     * features are automatically inserted at the end of the {@link FeatureSet}.
415
     *
416
     * @return true if this store is in appending state.
417
     */
418
    public boolean isAppending();
419

    
420
    /**
421
     * Updates a {@link FeatureType} in the store with the changes in the
422
     * {@link EditableFeatureType}.<br>
423
     *
424
     * Any {@link FeatureSet} from this store that are used will be invalidated.
425
     *
426
     * @param featureType
427
     *            an {@link EditableFeatureType} with the changes.
428
     *
429
     * @throws DataException
430
     */
431
    public void update(EditableFeatureType featureType) throws DataException;
432

    
433
    /**
434
     * Updates a {@link Feature} in the store with the changes in the
435
     * {@link EditableFeature}.<br>
436
     *
437
     * Any {@link FeatureSet} from this store that was still in use will be
438
     * invalidated. You can override this using
439
     * {@link FeatureSet#update(EditableFeature)}.
440
     *
441
     * @param feature
442
     *            the feature to be updated
443
     *
444
     * @throws DataException
445
     */
446
    public void update(EditableFeature feature) throws DataException;
447

    
448
    /**
449
     * Deletes a {@link Feature} from the store.<br>
450
     *
451
     * Any {@link FeatureSet} from this store that was still in use will be
452
     * invalidated. You can override this using {@link Iterator#remove()} from
453
     * {@link FeatureSet}.
454
     *
455
     * @param feature
456
     *            The feature to be deleted.
457
     *
458
     * @throws DataException
459
     */
460
    public void delete(Feature feature) throws DataException;
461

    
462
    /**
463
     * Inserts a {@link Feature} in the store.<br>
464
     *
465
     * Any {@link FeatureSet} from this store that was still in use will be
466
     * invalidated. You can override this using
467
     * {@link FeatureSet#insert(EditableFeature)}.
468
     *
469
     * @param feature
470
     *            The feature to be inserted
471
     *
472
     * @throws DataException
473
     */
474
    public void insert(EditableFeature feature) throws DataException;
475

    
476
    /**
477
     * Creates a new feature using the default feature type and returns it as an
478
     * {@link EditableFeature}
479
     *
480
     * @return a new feature in editable state
481
     *
482
     * @throws DataException
483
     */
484
    public EditableFeature createNewFeature() throws DataException;
485

    
486
    /**
487
     * Creates a new feature of the given {@link FeatureType} and uses the given
488
     * {@link Feature} as default values to initialize it.
489
     *
490
     * @param type
491
     *            the new feature's feature type
492
     *
493
     * @param defaultValues
494
     *            a feature whose values are used as default values for the new
495
     *            feature.
496
     *
497
     * @return the new feature.
498
     *
499
     * @throws DataException
500
     */
501
    public EditableFeature createNewFeature(FeatureType type,
502
        Feature defaultValues) throws DataException;
503

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

    
524
    /**
525
     * Creates a new feature of default {@link FeatureType}. The flag
526
     * defaultValues is used to indicate whether the new feature should be
527
     * initialized with default values or not.
528
     *
529
     * @param defaultValues
530
     *            if true the new feature is initialized with each attribute's
531
     *            default value.
532
     *
533
     * @return
534
     *         the new feature
535
     *
536
     * @throws DataException
537
     */
538
    public EditableFeature createNewFeature(boolean defaultValues)
539
        throws DataException;
540

    
541
    /**
542
     * Creates a new feature of default {@link FeatureType}.
543
     * The new feature should be initialized with the values of the feature
544
     * passed as parameter.
545
     * Values are inicialiced by name from the feature specified. Error in
546
     * value assignement are ignoreds.
547
     *
548
     * @param defaultValues the values to initialize the new feature.
549
     * @return the new feature
550
     * @throws DataException
551
     */
552
    public EditableFeature createNewFeature(Feature defaultValues)
553
        throws DataException;
554

    
555
    /**
556
     * Applies the validation rules associated to the given mode to the active
557
     * {@link FeatureSet}.
558
     *
559
     * @param mode
560
     *            can be one of {MODE_QUERY, MODE_FULLEDIT, MODE_APPEND}
561
     *
562
     * @throws DataException
563
     */
564
    public void validateFeatures(int mode) throws DataException;
565

    
566
    /**
567
     * Indicates whether this store supports append mode.
568
     *
569
     * @return
570
     *         true if this store supports append mode.
571
     */
572
    public boolean isAppendModeSupported();
573

    
574
    /**
575
     * Initiates an editing group. This is typically used to group series of
576
     * store editing operations.
577
     *
578
     * @param description
579
     *            Description of the editing group.
580
     *
581
     * @throws NeedEditingModeException
582
     */
583
    public void beginEditingGroup(String description)
584
        throws NeedEditingModeException;
585

    
586
    /**
587
     * Finishes an editing group.
588
     *
589
     * @throws NeedEditingModeException
590
     */
591
    public void endEditingGroup() throws NeedEditingModeException;
592

    
593
    /*
594
     * =============================================================
595
     *
596
     * Index related services
597
     */
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 featureType
604
     *            The FeatureType to which the indexed attribute belongs.
605
     *
606
     * @param attributeName
607
     *            The name of the attributed to be indexed
608
     *
609
     * @param indexName
610
     *            The index name
611
     *
612
     * @return the resulting {@link FeatureIndex}
613
     *
614
     *
615
     * @throws FeatureIndexException
616
     *             if there is an error creating the index
617
     */
618
    public FeatureIndex createIndex(FeatureType featureType,
619
        String attributeName, String indexName) throws DataException;
620

    
621
    /**
622
     * Creates an index which will be applied to the features of the given type,
623
     * by using the data of the given attribute.
624
     *
625
     * @param indexTypeName
626
     *            the type of the index to be created. That name is
627
     *            related to one of the registered index providers
628
     * @param featureType
629
     *            The FeatureType to which the indexed attribute belongs.
630
     *
631
     * @param attributeName
632
     *            The name of the attributed to be indexed
633
     *
634
     * @param indexName
635
     *            The index name
636
     *
637
     * @return the resulting {@link FeatureIndex}
638
     *
639
     *
640
     * @throws FeatureIndexException
641
     *             if there is an error creating the index
642
     */
643
    public FeatureIndex createIndex(String indexTypeName,
644
        FeatureType featureType, String attributeName, String indexName)
645
        throws DataException;
646

    
647
    /**
648
     * Creates an index which will be applied to the features of the given type,
649
     * by using the data of the given attribute. This method will return without
650
     * waiting for the index to be filled, as that will be performed in
651
     * background. An optional {@link Observer} parameter is provided to be
652
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
653
     * when the index has finished filling with data and is available to be
654
     * used.
655
     *
656
     * @param featureType
657
     *            The FeatureType to which the indexed attribute belongs.
658
     *
659
     * @param attributeName
660
     *            The name of the attributed to be indexed
661
     *
662
     * @param indexName
663
     *            The index name
664
     *
665
     * @param observer
666
     *            to notify to when the created index has finished filling
667
     *            with data and is available to be used. The observer will
668
     *            receive then a
669
     *            {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
670
     *            notification, with the index object if it has finished
671
     *            successfully, or a
672
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
673
     *            notification with the exception object if there has been
674
     *            any error in the process. Optional.
675
     *
676
     * @return the resulting {@link FeatureIndex}
677
     *
678
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
679
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
680
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
681
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
682
     *
683
     * @throws FeatureIndexException
684
     *             if there is an error creating the index
685
     */
686
    public FeatureIndex createIndex(FeatureType featureType,
687
        String attributeName, String indexName, Observer observer)
688
        throws DataException;
689

    
690
    /**
691
     * Creates an index which will be applied to the features of the given type,
692
     * by using the data of the given attribute. This method will return without
693
     * waiting for the index to be filled, as that will be performed in
694
     * background. An optional {@link Observer} parameter is provided to be
695
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
696
     * when the index has finished filling with data and is available to be
697
     * used.
698
     *
699
     * @param indexTypeName
700
     *            the type of the index to be created. That name is
701
     *            related to one of the registered index providers
702
     * @param featureType
703
     *            The FeatureType to which the indexed attribute belongs.
704
     *
705
     * @param attributeName
706
     *            The name of the attributed to be indexed
707
     *
708
     * @param indexName
709
     *            The index name
710
     *
711
     * @param observer
712
     *            to notify to when the created index has finished filling
713
     *            with data and is available to be used. The observer will
714
     *            receive then a
715
     *            {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
716
     *            notification, with the index object if it has finished
717
     *            successfully, or a
718
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
719
     *            notification with the exception object if there has been
720
     *            any error in the process. Optional.
721
     *
722
     * @return the resulting {@link FeatureIndex}
723
     *
724
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
725
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
726
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
727
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
728
     *
729
     * @throws FeatureIndexException
730
     *             if there is an error creating the index
731
     */
732
    public FeatureIndex createIndex(String indexTypeName,
733
        FeatureType featureType, String attributeName, String indexName,
734
        Observer observer) throws DataException;
735

    
736
    /**
737
     * Returns a FeatureIndexes structure containing all available indexes in
738
     * the store.
739
     *
740
     * @return
741
     */
742
    public FeatureIndexes getIndexes();
743

    
744
    /*
745
     * =============================================================
746
     *
747
     * Selection related services
748
     */
749

    
750
    /**
751
     * Sets the selection to the passed {@link FeatureSet}
752
     *
753
     * @param selection
754
     *            A {@link FeatureSet} with the requested selection
755
     */
756
    public void setSelection(FeatureSet selection) throws DataException;
757

    
758
    /**
759
     * Creates a {@link FeatureSelection}
760
     *
761
     * @return
762
     *         a {@link FeatureSelection}
763
     *
764
     * @throws DataException
765
     */
766
    public FeatureSelection createFeatureSelection() throws DataException;
767

    
768
    /**
769
     * Returns the current {@link FeatureSelection}.
770
     * Create a empty selection if not exits.
771
     * 
772
     * Manage of the selection can be slow on some data sources. 
773
     * Use with care.
774
     * In data sources that do not support position access to records, 
775
     * it may be slow to retrieve items from the selection. In some data 
776
     * sources it may be necessary to access to this to retrieve each 
777
     * item in the selection.
778
     *
779
     * @return
780
     *         current {@link FeatureSelection}.
781
     *
782
     * @throws DataException
783
     */
784
    public FeatureSelection getFeatureSelection() throws DataException;
785

    
786
    /*
787
     * =============================================================
788
     *
789
     * Lock related services
790
     */
791

    
792
    /**
793
     * Indicates whether this store supports locks.
794
     *
795
     * @return
796
     *         true if this store supports locks, false if not.
797
     */
798
    public boolean isLocksSupported();
799

    
800
    /**
801
     * Returns the set of locked features
802
     *
803
     * @return
804
     *         set of locked features
805
     *
806
     * @throws DataException
807
     */
808
    public FeatureLocks getLocks() throws DataException;
809

    
810
    /*
811
     * =============================================================
812
     * Transforms related services
813
     * =============================================================
814
     */
815

    
816
    /**
817
     * Returns this store transforms
818
     *
819
     * @return
820
     *         this store transforms
821
     */
822
    public FeatureStoreTransforms getTransforms();
823

    
824
    /**
825
     * Returns a new {@link FeatureQuery} associated to this store.
826
     *
827
     * @return
828
     *         a new {@link FeatureQuery} associated to this store.
829
     */
830
    public FeatureQuery createFeatureQuery();
831

    
832
    /**
833
     * Returns featue count of this store.
834
     *
835
     * @return
836
     * @throws DataException
837
     */
838
    public long getFeatureCount() throws DataException;
839

    
840
//    /**
841
//     * Creates a vectorial cache that is used to save and retrieve data.
842
//     *
843
//     * @param name
844
//     *            the cache name.
845
//     * @param parameters
846
//     *            parameters to create the stores used to save data.
847
//     * @throws DataException
848
//     */
849
//    public void createCache(String name, DynObject parameters)
850
//        throws DataException;
851
//
852
//    /**
853
//     * @return the vectorial cache
854
//     */
855
//    public FeatureCache getCache();
856

    
857
    /**
858
     * Return if the provider knows the real envelope of a layer. If not,
859
     * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
860
     * the full envelope.
861
     *
862
     * @return
863
     *         <true> if it knows the real envelope.
864
     */
865
    public boolean isKnownEnvelope();
866

    
867
    /**
868
     * Return if the maximum number of features provided by the
869
     * provider are limited.
870
     *
871
     * @return
872
     *         <true> if there is a limit of features.
873
     */
874
    public boolean hasRetrievedFeaturesLimit();
875

    
876
    /**
877
     * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns
878
     * true,
879
     * it returns the limit of features retrieved from the provider.
880
     *
881
     * @return
882
     *         The limit of the retrieved features.
883
     */
884
    public int getRetrievedFeaturesLimit();
885

    
886
    /**
887
     * Return the associated feature to the dynobject.
888
     * If the dynobject isn't associated to a feature of this store, return null.
889
     *
890
     * @param dynobject
891
     * @return
892
     */
893
    public Feature getFeature(DynObject dynobject);
894

    
895
    public Iterator iterator();
896

    
897
    public ExpressionBuilder createExpressionBuilder();
898

    
899
    /**
900
     * 
901
     * @return 
902
     * @deprecated use createExpressionBuilder
903
     */
904
    public ExpressionBuilder createExpression();
905

    
906
    public void createCache(String name, DynObject parameters)
907
        throws DataException;
908

    
909
    public FeatureCache getCache();
910

    
911
    public boolean isBroken();
912

    
913
        public Throwable getBreakingsCause();
914

    
915
    /**
916
     * @param index
917
     * @return
918
     */
919
    public SpatialIndex wrapSpatialIndex(SpatialIndex index);
920
    
921
    public FeatureReference getFeatureReference(String code);
922

    
923
    /**
924
     * Devuelbe el numero de operaciones pendientes de guardar en una sesion
925
     * de edicion. Es un valor orientativo.
926
     * Las operaciones pendientes son la suma de operaciones de borrado, insercion
927
     * o modificacion de las features en una sesion de edicion.
928
     * 
929
     * Retorna 0 si no esta en edicion.
930
     * 
931
     * @return numero de operaciones pendientes. 
932
     */
933
    public long getPendingChangesCount();
934
    
935
    public ResourcesStorage getResourcesStorage();
936
    
937
    public StoresRepository getStoresRepository();
938
    
939
}