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

History | View | Annotate | Download (30.3 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
    public Feature findFirst(FeatureQuery query) throws DataException;
317
    /**
318
     * Returns the feature given its reference.
319
     *
320
     * @param reference
321
     *            a unique FeatureReference
322
     * @return
323
     *         The Feature
324
     *
325
     * @throws DataException
326
     *
327
     */
328
    public Feature getFeatureByReference(FeatureReference reference)
329
        throws DataException;
330

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

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

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

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

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

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

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

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

    
404

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
594
    /*
595
     * =============================================================
596
     *
597
     * Index related services
598
     */
599

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    
896
    public Iterator iterator();
897

    
898
    public ExpressionBuilder createExpressionBuilder();
899

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

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

    
910
    public FeatureCache getCache();
911

    
912
    public boolean isBroken();
913

    
914
        public Throwable getBreakingsCause();
915

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

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