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 40559 jjdelcerro
/**
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 40435 jjdelcerro
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 44023 jjdelcerro
import org.gvsig.expressionevaluator.Expression;
31 44042 jjdelcerro
import org.gvsig.expressionevaluator.ExpressionBuilder;
32 40435 jjdelcerro
33
import org.gvsig.fmap.dal.DataServerExplorer;
34
import org.gvsig.fmap.dal.DataStore;
35
import org.gvsig.fmap.dal.DataStoreParameters;
36 44259 jjdelcerro
import org.gvsig.fmap.dal.StoresRepository;
37 40435 jjdelcerro
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 43371 fdiaz
import org.gvsig.fmap.geom.SpatialIndex;
43 40435 jjdelcerro
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 44253 jjdelcerro
import org.gvsig.tools.util.ResourcesStorage;
50 40435 jjdelcerro
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 41818 fdiaz
 *
58 40435 jjdelcerro
 * <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 41818 fdiaz
 *
77 40435 jjdelcerro
 */
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 41818 fdiaz
     *
94 40435 jjdelcerro
     * information related services
95
     */
96
97
    /**
98
     * Indicates whether this store allows writing.
99 41818 fdiaz
     *
100 40435 jjdelcerro
     * @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 41818 fdiaz
     *
108 40435 jjdelcerro
     * @return
109
     *         this store's default {@link FeatureType}.
110 41818 fdiaz
     *
111 40435 jjdelcerro
     * @throws DataException
112
     */
113
    public FeatureType getDefaultFeatureType() throws DataException;
114
115
    /**
116
     * Returns this store's featureType {@link FeatureType} matches with
117
     * featureTypeId.
118 41818 fdiaz
     *
119 40435 jjdelcerro
     * @param featureTypeId
120 41818 fdiaz
     *
121 40435 jjdelcerro
     * @return this store's default {@link FeatureType}.
122 41818 fdiaz
     *
123 40435 jjdelcerro
     * @throws DataException
124
     */
125
    public FeatureType getFeatureType(String featureTypeId)
126
        throws DataException;
127
128
    /**
129
     * Returns this store's {@link FeatureType}(s).
130 41818 fdiaz
     *
131 40435 jjdelcerro
     * @return a list with this store's {@link FeatureType}(s).
132 41818 fdiaz
     *
133 40435 jjdelcerro
     * @throws DataException
134
     */
135
    public List getFeatureTypes() throws DataException;
136
137
    /**
138
     * Returns this store's parameters.
139 41818 fdiaz
     *
140 40435 jjdelcerro
     * @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 41818 fdiaz
     *
154 40435 jjdelcerro
     * @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 41818 fdiaz
     *
161 40435 jjdelcerro
     * @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 41818 fdiaz
     *
170 40435 jjdelcerro
     * @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 41818 fdiaz
     *
176 40435 jjdelcerro
     * @throws DataException
177 41818 fdiaz
     *
178 40435 jjdelcerro
     * @Deprecated this method is unstable
179
     */
180
    public void export(DataServerExplorer explorer, String provider,
181
        NewFeatureStoreParameters params) throws DataException;
182
183
    /*
184
     * =============================================================
185 41818 fdiaz
     *
186 40435 jjdelcerro
     * Query related services
187
     */
188
189
    /**
190
     * Returns all available features in the store.
191
     * <p>
192
     * <em>
193 41818 fdiaz
     * <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 40435 jjdelcerro
     * get the features.
200
     * </em>
201
     * </p>
202 41818 fdiaz
     *
203 40435 jjdelcerro
     * @see #accept(org.gvsig.tools.visitor.Visitor)
204 41818 fdiaz
     *
205 40435 jjdelcerro
     * @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 43533 jjdelcerro
    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 44023 jjdelcerro
    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 40435 jjdelcerro
    /**
223
     * Returns a subset of features taking into account the properties and
224
     * restrictions of the FeatureQuery.
225
     * <p>
226
     * <em>
227 41818 fdiaz
     * <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 40435 jjdelcerro
     * get the features.
234
     * </em>
235
     * </p>
236 41818 fdiaz
     *
237 40435 jjdelcerro
     * @see #accept(org.gvsig.tools.visitor.Visitor,
238
     *      org.gvsig.fmap.dal.DataQuery)
239 41818 fdiaz
     *
240 40435 jjdelcerro
     * @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 41818 fdiaz
     *
253 40435 jjdelcerro
     * @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 41818 fdiaz
     *
267 40435 jjdelcerro
     * @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 42925 jjdelcerro
     * Return a paginated list of Features filtered by the query.
276 43371 fdiaz
     *
277 42925 jjdelcerro
     * The returned List of Features is paginated, and the page size
278
     * used is "pageSize".
279 43371 fdiaz
     *
280 42925 jjdelcerro
     * @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 43371 fdiaz
286 43550 jjdelcerro
    public List<Feature> getFeatures(FeatureQuery query);
287
288 43020 jjdelcerro
    public List<Feature> getFeatures();
289 43371 fdiaz
290 43628 jjdelcerro
    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 44023 jjdelcerro
    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 44100 jjdelcerro
    public Feature first() throws DataException;
303
304 43628 jjdelcerro
    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 44023 jjdelcerro
    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 42925 jjdelcerro
    /**
317 40435 jjdelcerro
     * Returns the feature given its reference.
318 41818 fdiaz
     *
319 40435 jjdelcerro
     * @param reference
320
     *            a unique FeatureReference
321
     * @return
322
     *         The Feature
323 41818 fdiaz
     *
324 40435 jjdelcerro
     * @throws DataException
325 41818 fdiaz
     *
326 40435 jjdelcerro
     */
327
    public Feature getFeatureByReference(FeatureReference reference)
328
        throws DataException;
329
330
    /**
331
     * Returns the feature given its reference and feature type.
332 41818 fdiaz
     *
333 40435 jjdelcerro
     * @param reference
334
     *            a unique FeatureReference
335 41818 fdiaz
     *
336 40435 jjdelcerro
     * @param featureType
337
     *            FeatureType to which the requested Feature belongs
338 41818 fdiaz
     *
339 40435 jjdelcerro
     * @return
340
     *         The Feature
341 41818 fdiaz
     *
342 40435 jjdelcerro
     * @throws DataException
343 41818 fdiaz
     *
344 40435 jjdelcerro
     */
345
    public Feature getFeatureByReference(FeatureReference reference,
346
        FeatureType featureType) throws DataException;
347
348
    /*
349
     * =============================================================
350 41818 fdiaz
     *
351 40435 jjdelcerro
     * 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 41818 fdiaz
     *
362 40435 jjdelcerro
     * @param mode
363 41818 fdiaz
     *
364 40435 jjdelcerro
     * @throws DataException
365
     */
366
    public void edit(int mode) throws DataException;
367
368
    /**
369
     * Cancels all editing since the last edit().
370 41818 fdiaz
     *
371 40435 jjdelcerro
     * @throws DataException
372
     */
373
    public void cancelEditing() throws DataException;
374
375
    /**
376
     * Exits editing state.
377 41818 fdiaz
     *
378 40435 jjdelcerro
     * @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 41818 fdiaz
     *
398 40435 jjdelcerro
     * @return true if can call commitChanges
399 41818 fdiaz
     * @throws DataException
400 40435 jjdelcerro
     */
401
    public boolean canCommitChanges() throws DataException;
402
403 41818 fdiaz
404 40435 jjdelcerro
    /**
405
     * Indicates whether this store is in editing state.
406 41818 fdiaz
     *
407 40435 jjdelcerro
     * @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 41818 fdiaz
     *
416 40435 jjdelcerro
     * @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 41818 fdiaz
     *
424 40435 jjdelcerro
     * Any {@link FeatureSet} from this store that are used will be invalidated.
425 41818 fdiaz
     *
426 40435 jjdelcerro
     * @param featureType
427
     *            an {@link EditableFeatureType} with the changes.
428 41818 fdiaz
     *
429 40435 jjdelcerro
     * @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 41818 fdiaz
     *
437 40435 jjdelcerro
     * 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 41818 fdiaz
     *
441 40435 jjdelcerro
     * @param feature
442
     *            the feature to be updated
443 41818 fdiaz
     *
444 40435 jjdelcerro
     * @throws DataException
445
     */
446
    public void update(EditableFeature feature) throws DataException;
447
448
    /**
449
     * Deletes a {@link Feature} from the store.<br>
450 41818 fdiaz
     *
451 40435 jjdelcerro
     * 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 41818 fdiaz
     *
455 40435 jjdelcerro
     * @param feature
456
     *            The feature to be deleted.
457 41818 fdiaz
     *
458 40435 jjdelcerro
     * @throws DataException
459
     */
460
    public void delete(Feature feature) throws DataException;
461
462
    /**
463
     * Inserts a {@link Feature} in the store.<br>
464 41818 fdiaz
     *
465 40435 jjdelcerro
     * 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 41818 fdiaz
     *
469 40435 jjdelcerro
     * @param feature
470
     *            The feature to be inserted
471 41818 fdiaz
     *
472 40435 jjdelcerro
     * @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 41818 fdiaz
     *
480 40435 jjdelcerro
     * @return a new feature in editable state
481 41818 fdiaz
     *
482 40435 jjdelcerro
     * @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 41818 fdiaz
     *
490 40435 jjdelcerro
     * @param type
491
     *            the new feature's feature type
492 41818 fdiaz
     *
493 40435 jjdelcerro
     * @param defaultValues
494
     *            a feature whose values are used as default values for the new
495
     *            feature.
496 41818 fdiaz
     *
497 40435 jjdelcerro
     * @return the new feature.
498 41818 fdiaz
     *
499 40435 jjdelcerro
     * @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 41818 fdiaz
     *
509 40435 jjdelcerro
     * @param type
510
     *            the new feature's feature type
511 41818 fdiaz
     *
512 40435 jjdelcerro
     * @param defaultValues
513
     *            if true the new feature is initialized with each attribute's
514
     *            default value.
515 41818 fdiaz
     *
516 40435 jjdelcerro
     * @return
517
     *         the new feature
518 41818 fdiaz
     *
519 40435 jjdelcerro
     * @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 41818 fdiaz
     *
529 40435 jjdelcerro
     * @param defaultValues
530
     *            if true the new feature is initialized with each attribute's
531
     *            default value.
532 41818 fdiaz
     *
533 40435 jjdelcerro
     * @return
534
     *         the new feature
535 41818 fdiaz
     *
536 40435 jjdelcerro
     * @throws DataException
537
     */
538
    public EditableFeature createNewFeature(boolean defaultValues)
539
        throws DataException;
540
541
    /**
542 43371 fdiaz
     * Creates a new feature of default {@link FeatureType}.
543
     * The new feature should be initialized with the values of the feature
544 42293 jjdelcerro
     * passed as parameter.
545
     * Values are inicialiced by name from the feature specified. Error in
546
     * value assignement are ignoreds.
547 43371 fdiaz
     *
548 42293 jjdelcerro
     * @param defaultValues the values to initialize the new feature.
549
     * @return the new feature
550 43371 fdiaz
     * @throws DataException
551 42293 jjdelcerro
     */
552
    public EditableFeature createNewFeature(Feature defaultValues)
553
        throws DataException;
554
555
    /**
556 40435 jjdelcerro
     * Applies the validation rules associated to the given mode to the active
557
     * {@link FeatureSet}.
558 41818 fdiaz
     *
559 40435 jjdelcerro
     * @param mode
560
     *            can be one of {MODE_QUERY, MODE_FULLEDIT, MODE_APPEND}
561 41818 fdiaz
     *
562 40435 jjdelcerro
     * @throws DataException
563
     */
564
    public void validateFeatures(int mode) throws DataException;
565
566
    /**
567
     * Indicates whether this store supports append mode.
568 41818 fdiaz
     *
569 40435 jjdelcerro
     * @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 41818 fdiaz
     *
578 40435 jjdelcerro
     * @param description
579
     *            Description of the editing group.
580 41818 fdiaz
     *
581 40435 jjdelcerro
     * @throws NeedEditingModeException
582
     */
583
    public void beginEditingGroup(String description)
584
        throws NeedEditingModeException;
585
586
    /**
587
     * Finishes an editing group.
588 41818 fdiaz
     *
589 40435 jjdelcerro
     * @throws NeedEditingModeException
590
     */
591
    public void endEditingGroup() throws NeedEditingModeException;
592
593
    /*
594
     * =============================================================
595 41818 fdiaz
     *
596 40435 jjdelcerro
     * 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 41818 fdiaz
     *
603 40435 jjdelcerro
     * @param featureType
604
     *            The FeatureType to which the indexed attribute belongs.
605 41818 fdiaz
     *
606 40435 jjdelcerro
     * @param attributeName
607
     *            The name of the attributed to be indexed
608 41818 fdiaz
     *
609 40435 jjdelcerro
     * @param indexName
610
     *            The index name
611 41818 fdiaz
     *
612 40435 jjdelcerro
     * @return the resulting {@link FeatureIndex}
613 41818 fdiaz
     *
614
     *
615 40435 jjdelcerro
     * @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 41818 fdiaz
     *
625 40435 jjdelcerro
     * @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 41818 fdiaz
     *
631 40435 jjdelcerro
     * @param attributeName
632
     *            The name of the attributed to be indexed
633 41818 fdiaz
     *
634 40435 jjdelcerro
     * @param indexName
635
     *            The index name
636 41818 fdiaz
     *
637 40435 jjdelcerro
     * @return the resulting {@link FeatureIndex}
638 41818 fdiaz
     *
639
     *
640 40435 jjdelcerro
     * @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 41818 fdiaz
     *
656 40435 jjdelcerro
     * @param featureType
657
     *            The FeatureType to which the indexed attribute belongs.
658 41818 fdiaz
     *
659 40435 jjdelcerro
     * @param attributeName
660
     *            The name of the attributed to be indexed
661 41818 fdiaz
     *
662 40435 jjdelcerro
     * @param indexName
663
     *            The index name
664 41818 fdiaz
     *
665 40435 jjdelcerro
     * @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 41818 fdiaz
     *
676 40435 jjdelcerro
     * @return the resulting {@link FeatureIndex}
677 41818 fdiaz
     *
678 40435 jjdelcerro
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
679
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
680
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
681
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
682 41818 fdiaz
     *
683 40435 jjdelcerro
     * @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 41818 fdiaz
     *
699 40435 jjdelcerro
     * @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 41818 fdiaz
     *
705 40435 jjdelcerro
     * @param attributeName
706
     *            The name of the attributed to be indexed
707 41818 fdiaz
     *
708 40435 jjdelcerro
     * @param indexName
709
     *            The index name
710 41818 fdiaz
     *
711 40435 jjdelcerro
     * @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 41818 fdiaz
     *
722 40435 jjdelcerro
     * @return the resulting {@link FeatureIndex}
723 41818 fdiaz
     *
724 40435 jjdelcerro
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
725
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
726
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
727
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
728 41818 fdiaz
     *
729 40435 jjdelcerro
     * @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 41818 fdiaz
     *
740 40435 jjdelcerro
     * @return
741
     */
742
    public FeatureIndexes getIndexes();
743
744
    /*
745
     * =============================================================
746 41818 fdiaz
     *
747 40435 jjdelcerro
     * Selection related services
748
     */
749
750
    /**
751
     * Sets the selection to the passed {@link FeatureSet}
752 41818 fdiaz
     *
753 40435 jjdelcerro
     * @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 41818 fdiaz
     *
761 40435 jjdelcerro
     * @return
762
     *         a {@link FeatureSelection}
763 41818 fdiaz
     *
764 40435 jjdelcerro
     * @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 43358 jjdelcerro
     *
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 41818 fdiaz
     *
779 40435 jjdelcerro
     * @return
780
     *         current {@link FeatureSelection}.
781 41818 fdiaz
     *
782 40435 jjdelcerro
     * @throws DataException
783
     */
784
    public FeatureSelection getFeatureSelection() throws DataException;
785
786
    /*
787
     * =============================================================
788 41818 fdiaz
     *
789 40435 jjdelcerro
     * Lock related services
790
     */
791
792
    /**
793
     * Indicates whether this store supports locks.
794 41818 fdiaz
     *
795 40435 jjdelcerro
     * @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 41818 fdiaz
     *
803 40435 jjdelcerro
     * @return
804
     *         set of locked features
805 41818 fdiaz
     *
806 40435 jjdelcerro
     * @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 41818 fdiaz
     *
819 40435 jjdelcerro
     * @return
820
     *         this store transforms
821
     */
822
    public FeatureStoreTransforms getTransforms();
823
824
    /**
825
     * Returns a new {@link FeatureQuery} associated to this store.
826 41818 fdiaz
     *
827 40435 jjdelcerro
     * @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 41818 fdiaz
     *
835 40435 jjdelcerro
     * @return
836
     * @throws DataException
837
     */
838
    public long getFeatureCount() throws DataException;
839
840 43020 jjdelcerro
//    /**
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 40435 jjdelcerro
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 41818 fdiaz
     *
862 40435 jjdelcerro
     * @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 41818 fdiaz
     *
871 40435 jjdelcerro
     * @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 41818 fdiaz
     *
881 40435 jjdelcerro
     * @return
882
     *         The limit of the retrieved features.
883
     */
884
    public int getRetrievedFeaturesLimit();
885 41818 fdiaz
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 43371 fdiaz
895 42293 jjdelcerro
    public Iterator iterator();
896 43371 fdiaz
897 43521 jjdelcerro
    public ExpressionBuilder createExpressionBuilder();
898 43371 fdiaz
899 43521 jjdelcerro
    /**
900
     *
901
     * @return
902
     * @deprecated use createExpressionBuilder
903
     */
904
    public ExpressionBuilder createExpression();
905
906 43056 jjdelcerro
    public void createCache(String name, DynObject parameters)
907
        throws DataException;
908
909 43371 fdiaz
    public FeatureCache getCache();
910
911 43215 jjdelcerro
    public boolean isBroken();
912 43371 fdiaz
913 43215 jjdelcerro
        public Throwable getBreakingsCause();
914 43371 fdiaz
915
    /**
916
     * @param index
917
     * @return
918
     */
919 44111 jjdelcerro
    public SpatialIndex wrapSpatialIndex(SpatialIndex index);
920 43824 jjdelcerro
921
    public FeatureReference getFeatureReference(String code);
922 44111 jjdelcerro
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 44253 jjdelcerro
935
    public ResourcesStorage getResourcesStorage();
936
937 44259 jjdelcerro
    public StoresRepository getStoresRepository();
938
939 40435 jjdelcerro
}