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

History | View | Annotate | Download (29.5 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
import org.gvsig.fmap.dal.exception.DataException;
37
import org.gvsig.fmap.dal.exception.ReadException;
38
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException;
39
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException;
40
import org.gvsig.fmap.geom.Geometry;
41 43371 fdiaz
import org.gvsig.fmap.geom.SpatialIndex;
42 40435 jjdelcerro
import org.gvsig.fmap.geom.primitive.Envelope;
43
import org.gvsig.tools.dispose.DisposableIterator;
44
import org.gvsig.tools.dynobject.DynObject;
45
import org.gvsig.tools.lang.Cloneable;
46
import org.gvsig.tools.observer.Observer;
47
import org.gvsig.tools.undo.UndoRedoStack;
48
49
/**
50
 * <p>
51
 * A FeatureStore is a type of store whose data consists on sets of
52
 * {@link Feature}(s). {@link Feature}(s) from the same FeatureStore can be of
53
 * different {@link FeatureType}(s) (as in GML format for instance).
54
 * </p>
55 41818 fdiaz
 *
56 40435 jjdelcerro
 * <p>
57
 * FeatureStore allows:
58
 * </p>
59
 * <ul>
60
 * <li>Obtaining the default {@link FeatureType}. A FeatureStore always has one
61
 * and only one default FeatureType.
62
 * <li>Obtaining the list of {@link FeatureType}(s) defined in the FeatureStore.
63
 * <li>Obtaining, filtering and sorting subsets of data ({@link FeatureSet})
64
 * through {@link FeatureQuery}, as well as background loading.
65
 * <li>Obtaining the total {@link Envelope} (AKA bounding box or extent) of the
66
 * store.
67
 * <li>Support for editing {@link FeatureType}(s).
68
 * <li>Obtaining information about contained {@link Geometry} types.
69
 * <li>Exporting to another store.
70
 * <li>Indexing.
71
 * <li>Selection.
72
 * <li>Locks management.
73
 * </ul>
74 41818 fdiaz
 *
75 40435 jjdelcerro
 */
76
public interface FeatureStore extends DataStore, UndoRedoStack, Cloneable {
77
78
    public static final String METADATA_DEFINITION_NAME = "FeatureStore";
79
80
    /** Indicates that this store is in query mode */
81
    final static int MODE_QUERY = 0;
82
83
    /** Indicates that this store is in full edit mode */
84
    final static int MODE_FULLEDIT = 1;
85
86
    /** Indicates that this store is in append mode */
87
    final static int MODE_APPEND = 2;
88
89
    /*
90
     * =============================================================
91 41818 fdiaz
     *
92 40435 jjdelcerro
     * information related services
93
     */
94
95
    /**
96
     * Indicates whether this store allows writing.
97 41818 fdiaz
     *
98 40435 jjdelcerro
     * @return
99
     *         true if this store can be written, false if not.
100
     */
101
    public boolean allowWrite();
102
103
    /**
104
     * Returns this store's default {@link FeatureType}.
105 41818 fdiaz
     *
106 40435 jjdelcerro
     * @return
107
     *         this store's default {@link FeatureType}.
108 41818 fdiaz
     *
109 40435 jjdelcerro
     * @throws DataException
110
     */
111
    public FeatureType getDefaultFeatureType() throws DataException;
112
113
    /**
114
     * Returns this store's featureType {@link FeatureType} matches with
115
     * featureTypeId.
116 41818 fdiaz
     *
117 40435 jjdelcerro
     * @param featureTypeId
118 41818 fdiaz
     *
119 40435 jjdelcerro
     * @return this store's default {@link FeatureType}.
120 41818 fdiaz
     *
121 40435 jjdelcerro
     * @throws DataException
122
     */
123
    public FeatureType getFeatureType(String featureTypeId)
124
        throws DataException;
125
126
    /**
127
     * Returns this store's {@link FeatureType}(s).
128 41818 fdiaz
     *
129 40435 jjdelcerro
     * @return a list with this store's {@link FeatureType}(s).
130 41818 fdiaz
     *
131 40435 jjdelcerro
     * @throws DataException
132
     */
133
    public List getFeatureTypes() throws DataException;
134
135
    /**
136
     * Returns this store's parameters.
137 41818 fdiaz
     *
138 40435 jjdelcerro
     * @return
139
     *         {@link DataStoreParameters} containing this store's parameters
140
     */
141
    public DataStoreParameters getParameters();
142
143
    /**
144
     *@throws DataException
145
     * @deprecated Mirar de cambiarlo a metadatos
146
     */
147
    public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException;
148
149
    /**
150
     * Returns this store's total envelope (extent).
151 41818 fdiaz
     *
152 40435 jjdelcerro
     * @return this store's total envelope (extent) or <code>null</code> if
153
     *         store not have geometry information
154
     */
155
    public Envelope getEnvelope() throws DataException;
156
157
    /**
158 41818 fdiaz
     *
159 40435 jjdelcerro
     * @deprecated use getDefaultFeatureType().getDefaultSRS()
160
     * @return
161
     * @throws DataException
162
     */
163
    public IProjection getSRSDefaultGeometry() throws DataException;
164
165
    /**
166
     * Exports this store to another store.
167 41818 fdiaz
     *
168 40435 jjdelcerro
     * @param explorer
169
     *            {@link DataServerExplorer} target
170
     * @param params
171
     *            New parameters of this store that will be used on the target
172
     *            explorer
173 41818 fdiaz
     *
174 40435 jjdelcerro
     * @throws DataException
175 41818 fdiaz
     *
176 40435 jjdelcerro
     * @Deprecated this method is unstable
177
     */
178
    public void export(DataServerExplorer explorer, String provider,
179
        NewFeatureStoreParameters params) throws DataException;
180
181
    /*
182
     * =============================================================
183 41818 fdiaz
     *
184 40435 jjdelcerro
     * Query related services
185
     */
186
187
    /**
188
     * Returns all available features in the store.
189
     * <p>
190
     * <em>
191 41818 fdiaz
     * <strong>NOTE:</strong> if you use this method to get a
192
     * {@link FeatureSet}, you  must get sure it is disposed
193
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an
194
     * error occurs while getting the data. It is recommended to use the
195
     * <code>accept</code> methods instead, which handle everything for you.
196
     * Take into account the accept methods may use a fast iterator to
197 40435 jjdelcerro
     * get the features.
198
     * </em>
199
     * </p>
200 41818 fdiaz
     *
201 40435 jjdelcerro
     * @see #accept(org.gvsig.tools.visitor.Visitor)
202 41818 fdiaz
     *
203 40435 jjdelcerro
     * @return a collection of features
204
     * @throws ReadException
205
     *             if there is any error while reading the features
206
     */
207
    FeatureSet getFeatureSet() throws DataException;
208
209 43533 jjdelcerro
    FeatureSet getFeatureSet(String filter) throws DataException;
210
211
    FeatureSet getFeatureSet(String filter, String sortBy) throws DataException;
212
213
    FeatureSet getFeatureSet(String filter, String sortBy, boolean asc) throws DataException;
214
215 44023 jjdelcerro
    FeatureSet getFeatureSet(Expression filter) throws DataException;
216
217
    FeatureSet getFeatureSet(Expression filter, String sortBy) throws DataException;
218
219
    FeatureSet getFeatureSet(Expression filter, String sortBy, boolean asc) throws DataException;
220 40435 jjdelcerro
    /**
221
     * Returns a subset of features taking into account the properties and
222
     * restrictions of the FeatureQuery.
223
     * <p>
224
     * <em>
225 41818 fdiaz
     * <strong>NOTE:</strong> if you use this method to get a
226
     * {@link FeatureSet}, you  must get sure it is disposed
227
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an
228
     * error occurs while getting the data. It is recommended to use the
229
     * <code>accept</code> methods instead, which handle everything for you.
230
     * Take into account the accept methods may use a fast iterator to
231 40435 jjdelcerro
     * get the features.
232
     * </em>
233
     * </p>
234 41818 fdiaz
     *
235 40435 jjdelcerro
     * @see #accept(org.gvsig.tools.visitor.Visitor,
236
     *      org.gvsig.fmap.dal.DataQuery)
237 41818 fdiaz
     *
238 40435 jjdelcerro
     * @param featureQuery
239
     *            defines the characteristics of the features to return
240
     * @return a collection of features
241
     * @throws ReadException
242
     *             if there is any error while reading the features
243
     */
244
    FeatureSet getFeatureSet(FeatureQuery featureQuery) throws DataException;
245
246
    /**
247
     * Loads a subset of features taking into account the properties and
248
     * restrictions of the FeatureQuery. Feature loading is performed by calling
249
     * the Observer, once each loaded Feature.
250 41818 fdiaz
     *
251 40435 jjdelcerro
     * @param featureQuery
252
     *            defines the characteristics of the features to return
253
     * @param observer
254
     *            to be notified of each loaded Feature
255
     * @throws DataException
256
     *             if there is any error while loading the features
257
     */
258
    void getFeatureSet(FeatureQuery featureQuery, Observer observer)
259
        throws DataException;
260
261
    /**
262
     * Loads all available feature in the store. The loading of Features is
263
     * performed by calling the Observer, once each loaded Feature.
264 41818 fdiaz
     *
265 40435 jjdelcerro
     * @param observer
266
     *            to be notified of each loaded Feature
267
     * @throws DataException
268
     *             if there is any error while loading the features
269
     */
270
    void getFeatureSet(Observer observer) throws DataException;
271
272
    /**
273 42925 jjdelcerro
     * Return a paginated list of Features filtered by the query.
274 43371 fdiaz
     *
275 42925 jjdelcerro
     * The returned List of Features is paginated, and the page size
276
     * used is "pageSize".
277 43371 fdiaz
     *
278 42925 jjdelcerro
     * @param query to filter the returned feature list
279
     * @param pageSize the page size of the list
280
     * @return the list of features
281
     */
282
    public List<Feature> getFeatures(FeatureQuery query, int pageSize);
283 43371 fdiaz
284 43550 jjdelcerro
    public List<Feature> getFeatures(FeatureQuery query);
285
286 43020 jjdelcerro
    public List<Feature> getFeatures();
287 43371 fdiaz
288 43628 jjdelcerro
    public List<Feature> getFeatures(String filter);
289
290
    public List<Feature> getFeatures(String filter, String sortBy);
291
292
    public List<Feature> getFeatures(String filter, String sortBy, boolean asc);
293
294 44023 jjdelcerro
    public List<Feature> getFeatures(Expression filter);
295
296
    public List<Feature> getFeatures(Expression filter, String sortBy);
297
298
    public List<Feature> getFeatures(Expression filter, String sortBy, boolean asc);
299
300 43628 jjdelcerro
    public Feature findFirst(String filter) throws DataException;
301
302
    public Feature findFirst(String filter, String sortBy) throws DataException;
303
304
    public Feature findFirst(String filter, String sortBy, boolean asc) throws DataException;
305
306 44023 jjdelcerro
    public Feature findFirst(Expression filter) throws DataException;
307
308
    public Feature findFirst(Expression filter, String sortBy) throws DataException;
309
310
    public Feature findFirst(Expression filter, String sortBy, boolean asc) throws DataException;
311
312 42925 jjdelcerro
    /**
313 40435 jjdelcerro
     * Returns the feature given its reference.
314 41818 fdiaz
     *
315 40435 jjdelcerro
     * @param reference
316
     *            a unique FeatureReference
317
     * @return
318
     *         The Feature
319 41818 fdiaz
     *
320 40435 jjdelcerro
     * @throws DataException
321 41818 fdiaz
     *
322 40435 jjdelcerro
     */
323
    public Feature getFeatureByReference(FeatureReference reference)
324
        throws DataException;
325
326
    /**
327
     * Returns the feature given its reference and feature type.
328 41818 fdiaz
     *
329 40435 jjdelcerro
     * @param reference
330
     *            a unique FeatureReference
331 41818 fdiaz
     *
332 40435 jjdelcerro
     * @param featureType
333
     *            FeatureType to which the requested Feature belongs
334 41818 fdiaz
     *
335 40435 jjdelcerro
     * @return
336
     *         The Feature
337 41818 fdiaz
     *
338 40435 jjdelcerro
     * @throws DataException
339 41818 fdiaz
     *
340 40435 jjdelcerro
     */
341
    public Feature getFeatureByReference(FeatureReference reference,
342
        FeatureType featureType) throws DataException;
343
344
    /*
345
     * =============================================================
346 41818 fdiaz
     *
347 40435 jjdelcerro
     * Editing related services
348
     */
349
350
    /**
351
     * Enters editing state.
352
     */
353
    public void edit() throws DataException;
354
355
    /**
356
     * Enters editing state specifying the editing mode.
357 41818 fdiaz
     *
358 40435 jjdelcerro
     * @param mode
359 41818 fdiaz
     *
360 40435 jjdelcerro
     * @throws DataException
361
     */
362
    public void edit(int mode) throws DataException;
363
364
    /**
365
     * Cancels all editing since the last edit().
366 41818 fdiaz
     *
367 40435 jjdelcerro
     * @throws DataException
368
     */
369
    public void cancelEditing() throws DataException;
370
371
    /**
372
     * Exits editing state.
373 41818 fdiaz
     *
374 40435 jjdelcerro
     * @throws DataException
375
     */
376
    public void finishEditing() throws DataException;
377
378
    /**
379
     * Save changes in the provider without leaving the edit mode.
380
     * Do not call observers to communicate a change of ediding mode.
381
     * The operation's history is eliminated to prevent inconsistencies
382
     * in the data.
383
     *
384
     * @throws DataException
385
     */
386
    public void commitChanges() throws DataException ;
387
388
    /**
389
     *
390
     * Returns true if you can call CommitChanges method.
391
     * If not in editing or changes have been made in the structure
392
     * return false.
393 41818 fdiaz
     *
394 40435 jjdelcerro
     * @return true if can call commitChanges
395 41818 fdiaz
     * @throws DataException
396 40435 jjdelcerro
     */
397
    public boolean canCommitChanges() throws DataException;
398
399 41818 fdiaz
400 40435 jjdelcerro
    /**
401
     * Indicates whether this store is in editing state.
402 41818 fdiaz
     *
403 40435 jjdelcerro
     * @return
404
     *         true if this store is in editing state, false if not.
405
     */
406
    public boolean isEditing();
407
408
    /**
409
     * Indicates whether this store is in appending state. In this state the new
410
     * features are automatically inserted at the end of the {@link FeatureSet}.
411 41818 fdiaz
     *
412 40435 jjdelcerro
     * @return true if this store is in appending state.
413
     */
414
    public boolean isAppending();
415
416
    /**
417
     * Updates a {@link FeatureType} in the store with the changes in the
418
     * {@link EditableFeatureType}.<br>
419 41818 fdiaz
     *
420 40435 jjdelcerro
     * Any {@link FeatureSet} from this store that are used will be invalidated.
421 41818 fdiaz
     *
422 40435 jjdelcerro
     * @param featureType
423
     *            an {@link EditableFeatureType} with the changes.
424 41818 fdiaz
     *
425 40435 jjdelcerro
     * @throws DataException
426
     */
427
    public void update(EditableFeatureType featureType) throws DataException;
428
429
    /**
430
     * Updates a {@link Feature} in the store with the changes in the
431
     * {@link EditableFeature}.<br>
432 41818 fdiaz
     *
433 40435 jjdelcerro
     * Any {@link FeatureSet} from this store that was still in use will be
434
     * invalidated. You can override this using
435
     * {@link FeatureSet#update(EditableFeature)}.
436 41818 fdiaz
     *
437 40435 jjdelcerro
     * @param feature
438
     *            the feature to be updated
439 41818 fdiaz
     *
440 40435 jjdelcerro
     * @throws DataException
441
     */
442
    public void update(EditableFeature feature) throws DataException;
443
444
    /**
445
     * Deletes a {@link Feature} from the store.<br>
446 41818 fdiaz
     *
447 40435 jjdelcerro
     * Any {@link FeatureSet} from this store that was still in use will be
448
     * invalidated. You can override this using {@link Iterator#remove()} from
449
     * {@link FeatureSet}.
450 41818 fdiaz
     *
451 40435 jjdelcerro
     * @param feature
452
     *            The feature to be deleted.
453 41818 fdiaz
     *
454 40435 jjdelcerro
     * @throws DataException
455
     */
456
    public void delete(Feature feature) throws DataException;
457
458
    /**
459
     * Inserts a {@link Feature} in the store.<br>
460 41818 fdiaz
     *
461 40435 jjdelcerro
     * Any {@link FeatureSet} from this store that was still in use will be
462
     * invalidated. You can override this using
463
     * {@link FeatureSet#insert(EditableFeature)}.
464 41818 fdiaz
     *
465 40435 jjdelcerro
     * @param feature
466
     *            The feature to be inserted
467 41818 fdiaz
     *
468 40435 jjdelcerro
     * @throws DataException
469
     */
470
    public void insert(EditableFeature feature) throws DataException;
471
472
    /**
473
     * Creates a new feature using the default feature type and returns it as an
474
     * {@link EditableFeature}
475 41818 fdiaz
     *
476 40435 jjdelcerro
     * @return a new feature in editable state
477 41818 fdiaz
     *
478 40435 jjdelcerro
     * @throws DataException
479
     */
480
    public EditableFeature createNewFeature() throws DataException;
481
482
    /**
483
     * Creates a new feature of the given {@link FeatureType} and uses the given
484
     * {@link Feature} as default values to initialize it.
485 41818 fdiaz
     *
486 40435 jjdelcerro
     * @param type
487
     *            the new feature's feature type
488 41818 fdiaz
     *
489 40435 jjdelcerro
     * @param defaultValues
490
     *            a feature whose values are used as default values for the new
491
     *            feature.
492 41818 fdiaz
     *
493 40435 jjdelcerro
     * @return the new feature.
494 41818 fdiaz
     *
495 40435 jjdelcerro
     * @throws DataException
496
     */
497
    public EditableFeature createNewFeature(FeatureType type,
498
        Feature defaultValues) throws DataException;
499
500
    /**
501
     * Creates a new feature of the given {@link FeatureType}. The flag
502
     * defaultValues is used to indicate whether the new feature should be
503
     * initialized with default values or not.
504 41818 fdiaz
     *
505 40435 jjdelcerro
     * @param type
506
     *            the new feature's feature type
507 41818 fdiaz
     *
508 40435 jjdelcerro
     * @param defaultValues
509
     *            if true the new feature is initialized with each attribute's
510
     *            default value.
511 41818 fdiaz
     *
512 40435 jjdelcerro
     * @return
513
     *         the new feature
514 41818 fdiaz
     *
515 40435 jjdelcerro
     * @throws DataException
516
     */
517
    public EditableFeature createNewFeature(FeatureType type,
518
        boolean defaultValues) throws DataException;
519
520
    /**
521
     * Creates a new feature of default {@link FeatureType}. The flag
522
     * defaultValues is used to indicate whether the new feature should be
523
     * initialized with default values or not.
524 41818 fdiaz
     *
525 40435 jjdelcerro
     * @param defaultValues
526
     *            if true the new feature is initialized with each attribute's
527
     *            default value.
528 41818 fdiaz
     *
529 40435 jjdelcerro
     * @return
530
     *         the new feature
531 41818 fdiaz
     *
532 40435 jjdelcerro
     * @throws DataException
533
     */
534
    public EditableFeature createNewFeature(boolean defaultValues)
535
        throws DataException;
536
537
    /**
538 43371 fdiaz
     * Creates a new feature of default {@link FeatureType}.
539
     * The new feature should be initialized with the values of the feature
540 42293 jjdelcerro
     * passed as parameter.
541
     * Values are inicialiced by name from the feature specified. Error in
542
     * value assignement are ignoreds.
543 43371 fdiaz
     *
544 42293 jjdelcerro
     * @param defaultValues the values to initialize the new feature.
545
     * @return the new feature
546 43371 fdiaz
     * @throws DataException
547 42293 jjdelcerro
     */
548
    public EditableFeature createNewFeature(Feature defaultValues)
549
        throws DataException;
550
551
    /**
552 40435 jjdelcerro
     * Applies the validation rules associated to the given mode to the active
553
     * {@link FeatureSet}.
554 41818 fdiaz
     *
555 40435 jjdelcerro
     * @param mode
556
     *            can be one of {MODE_QUERY, MODE_FULLEDIT, MODE_APPEND}
557 41818 fdiaz
     *
558 40435 jjdelcerro
     * @throws DataException
559
     */
560
    public void validateFeatures(int mode) throws DataException;
561
562
    /**
563
     * Indicates whether this store supports append mode.
564 41818 fdiaz
     *
565 40435 jjdelcerro
     * @return
566
     *         true if this store supports append mode.
567
     */
568
    public boolean isAppendModeSupported();
569
570
    /**
571
     * Initiates an editing group. This is typically used to group series of
572
     * store editing operations.
573 41818 fdiaz
     *
574 40435 jjdelcerro
     * @param description
575
     *            Description of the editing group.
576 41818 fdiaz
     *
577 40435 jjdelcerro
     * @throws NeedEditingModeException
578
     */
579
    public void beginEditingGroup(String description)
580
        throws NeedEditingModeException;
581
582
    /**
583
     * Finishes an editing group.
584 41818 fdiaz
     *
585 40435 jjdelcerro
     * @throws NeedEditingModeException
586
     */
587
    public void endEditingGroup() throws NeedEditingModeException;
588
589
    /*
590
     * =============================================================
591 41818 fdiaz
     *
592 40435 jjdelcerro
     * Index related services
593
     */
594
595
    /**
596
     * Creates an index which will be applied to the features of the given type,
597
     * by using the data of the given attribute.
598 41818 fdiaz
     *
599 40435 jjdelcerro
     * @param featureType
600
     *            The FeatureType to which the indexed attribute belongs.
601 41818 fdiaz
     *
602 40435 jjdelcerro
     * @param attributeName
603
     *            The name of the attributed to be indexed
604 41818 fdiaz
     *
605 40435 jjdelcerro
     * @param indexName
606
     *            The index name
607 41818 fdiaz
     *
608 40435 jjdelcerro
     * @return the resulting {@link FeatureIndex}
609 41818 fdiaz
     *
610
     *
611 40435 jjdelcerro
     * @throws FeatureIndexException
612
     *             if there is an error creating the index
613
     */
614
    public FeatureIndex createIndex(FeatureType featureType,
615
        String attributeName, String indexName) throws DataException;
616
617
    /**
618
     * Creates an index which will be applied to the features of the given type,
619
     * by using the data of the given attribute.
620 41818 fdiaz
     *
621 40435 jjdelcerro
     * @param indexTypeName
622
     *            the type of the index to be created. That name is
623
     *            related to one of the registered index providers
624
     * @param featureType
625
     *            The FeatureType to which the indexed attribute belongs.
626 41818 fdiaz
     *
627 40435 jjdelcerro
     * @param attributeName
628
     *            The name of the attributed to be indexed
629 41818 fdiaz
     *
630 40435 jjdelcerro
     * @param indexName
631
     *            The index name
632 41818 fdiaz
     *
633 40435 jjdelcerro
     * @return the resulting {@link FeatureIndex}
634 41818 fdiaz
     *
635
     *
636 40435 jjdelcerro
     * @throws FeatureIndexException
637
     *             if there is an error creating the index
638
     */
639
    public FeatureIndex createIndex(String indexTypeName,
640
        FeatureType featureType, String attributeName, String indexName)
641
        throws DataException;
642
643
    /**
644
     * Creates an index which will be applied to the features of the given type,
645
     * by using the data of the given attribute. This method will return without
646
     * waiting for the index to be filled, as that will be performed in
647
     * background. An optional {@link Observer} parameter is provided to be
648
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
649
     * when the index has finished filling with data and is available to be
650
     * used.
651 41818 fdiaz
     *
652 40435 jjdelcerro
     * @param featureType
653
     *            The FeatureType to which the indexed attribute belongs.
654 41818 fdiaz
     *
655 40435 jjdelcerro
     * @param attributeName
656
     *            The name of the attributed to be indexed
657 41818 fdiaz
     *
658 40435 jjdelcerro
     * @param indexName
659
     *            The index name
660 41818 fdiaz
     *
661 40435 jjdelcerro
     * @param observer
662
     *            to notify to when the created index has finished filling
663
     *            with data and is available to be used. The observer will
664
     *            receive then a
665
     *            {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
666
     *            notification, with the index object if it has finished
667
     *            successfully, or a
668
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
669
     *            notification with the exception object if there has been
670
     *            any error in the process. Optional.
671 41818 fdiaz
     *
672 40435 jjdelcerro
     * @return the resulting {@link FeatureIndex}
673 41818 fdiaz
     *
674 40435 jjdelcerro
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
675
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
676
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
677
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
678 41818 fdiaz
     *
679 40435 jjdelcerro
     * @throws FeatureIndexException
680
     *             if there is an error creating the index
681
     */
682
    public FeatureIndex createIndex(FeatureType featureType,
683
        String attributeName, String indexName, Observer observer)
684
        throws DataException;
685
686
    /**
687
     * Creates an index which will be applied to the features of the given type,
688
     * by using the data of the given attribute. This method will return without
689
     * waiting for the index to be filled, as that will be performed in
690
     * background. An optional {@link Observer} parameter is provided to be
691
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
692
     * when the index has finished filling with data and is available to be
693
     * used.
694 41818 fdiaz
     *
695 40435 jjdelcerro
     * @param indexTypeName
696
     *            the type of the index to be created. That name is
697
     *            related to one of the registered index providers
698
     * @param featureType
699
     *            The FeatureType to which the indexed attribute belongs.
700 41818 fdiaz
     *
701 40435 jjdelcerro
     * @param attributeName
702
     *            The name of the attributed to be indexed
703 41818 fdiaz
     *
704 40435 jjdelcerro
     * @param indexName
705
     *            The index name
706 41818 fdiaz
     *
707 40435 jjdelcerro
     * @param observer
708
     *            to notify to when the created index has finished filling
709
     *            with data and is available to be used. The observer will
710
     *            receive then a
711
     *            {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
712
     *            notification, with the index object if it has finished
713
     *            successfully, or a
714
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
715
     *            notification with the exception object if there has been
716
     *            any error in the process. Optional.
717 41818 fdiaz
     *
718 40435 jjdelcerro
     * @return the resulting {@link FeatureIndex}
719 41818 fdiaz
     *
720 40435 jjdelcerro
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
721
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
722
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
723
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
724 41818 fdiaz
     *
725 40435 jjdelcerro
     * @throws FeatureIndexException
726
     *             if there is an error creating the index
727
     */
728
    public FeatureIndex createIndex(String indexTypeName,
729
        FeatureType featureType, String attributeName, String indexName,
730
        Observer observer) throws DataException;
731
732
    /**
733
     * Returns a FeatureIndexes structure containing all available indexes in
734
     * the store.
735 41818 fdiaz
     *
736 40435 jjdelcerro
     * @return
737
     */
738
    public FeatureIndexes getIndexes();
739
740
    /*
741
     * =============================================================
742 41818 fdiaz
     *
743 40435 jjdelcerro
     * Selection related services
744
     */
745
746
    /**
747
     * Sets the selection to the passed {@link FeatureSet}
748 41818 fdiaz
     *
749 40435 jjdelcerro
     * @param selection
750
     *            A {@link FeatureSet} with the requested selection
751
     */
752
    public void setSelection(FeatureSet selection) throws DataException;
753
754
    /**
755
     * Creates a {@link FeatureSelection}
756 41818 fdiaz
     *
757 40435 jjdelcerro
     * @return
758
     *         a {@link FeatureSelection}
759 41818 fdiaz
     *
760 40435 jjdelcerro
     * @throws DataException
761
     */
762
    public FeatureSelection createFeatureSelection() throws DataException;
763
764
    /**
765
     * Returns the current {@link FeatureSelection}.
766
     * Create a empty selection if not exits.
767 43358 jjdelcerro
     *
768
     * Manage of the selection can be slow on some data sources.
769
     * Use with care.
770
     * In data sources that do not support position access to records,
771
     * it may be slow to retrieve items from the selection. In some data
772
     * sources it may be necessary to access to this to retrieve each
773
     * item in the selection.
774 41818 fdiaz
     *
775 40435 jjdelcerro
     * @return
776
     *         current {@link FeatureSelection}.
777 41818 fdiaz
     *
778 40435 jjdelcerro
     * @throws DataException
779
     */
780
    public FeatureSelection getFeatureSelection() throws DataException;
781
782
    /*
783
     * =============================================================
784 41818 fdiaz
     *
785 40435 jjdelcerro
     * Lock related services
786
     */
787
788
    /**
789
     * Indicates whether this store supports locks.
790 41818 fdiaz
     *
791 40435 jjdelcerro
     * @return
792
     *         true if this store supports locks, false if not.
793
     */
794
    public boolean isLocksSupported();
795
796
    /**
797
     * Returns the set of locked features
798 41818 fdiaz
     *
799 40435 jjdelcerro
     * @return
800
     *         set of locked features
801 41818 fdiaz
     *
802 40435 jjdelcerro
     * @throws DataException
803
     */
804
    public FeatureLocks getLocks() throws DataException;
805
806
    /*
807
     * =============================================================
808
     * Transforms related services
809
     * =============================================================
810
     */
811
812
    /**
813
     * Returns this store transforms
814 41818 fdiaz
     *
815 40435 jjdelcerro
     * @return
816
     *         this store transforms
817
     */
818
    public FeatureStoreTransforms getTransforms();
819
820
    /**
821
     * Returns a new {@link FeatureQuery} associated to this store.
822 41818 fdiaz
     *
823 40435 jjdelcerro
     * @return
824
     *         a new {@link FeatureQuery} associated to this store.
825
     */
826
    public FeatureQuery createFeatureQuery();
827
828
    /**
829
     * Returns featue count of this store.
830 41818 fdiaz
     *
831 40435 jjdelcerro
     * @return
832
     * @throws DataException
833
     */
834
    public long getFeatureCount() throws DataException;
835
836 43020 jjdelcerro
//    /**
837
//     * Creates a vectorial cache that is used to save and retrieve data.
838
//     *
839
//     * @param name
840
//     *            the cache name.
841
//     * @param parameters
842
//     *            parameters to create the stores used to save data.
843
//     * @throws DataException
844
//     */
845
//    public void createCache(String name, DynObject parameters)
846
//        throws DataException;
847
//
848
//    /**
849
//     * @return the vectorial cache
850
//     */
851
//    public FeatureCache getCache();
852 40435 jjdelcerro
853
    /**
854
     * Return if the provider knows the real envelope of a layer. If not,
855
     * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
856
     * the full envelope.
857 41818 fdiaz
     *
858 40435 jjdelcerro
     * @return
859
     *         <true> if it knows the real envelope.
860
     */
861
    public boolean isKnownEnvelope();
862
863
    /**
864
     * Return if the maximum number of features provided by the
865
     * provider are limited.
866 41818 fdiaz
     *
867 40435 jjdelcerro
     * @return
868
     *         <true> if there is a limit of features.
869
     */
870
    public boolean hasRetrievedFeaturesLimit();
871
872
    /**
873
     * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns
874
     * true,
875
     * it returns the limit of features retrieved from the provider.
876 41818 fdiaz
     *
877 40435 jjdelcerro
     * @return
878
     *         The limit of the retrieved features.
879
     */
880
    public int getRetrievedFeaturesLimit();
881 41818 fdiaz
882
    /**
883
     * Return the associated feature to the dynobject.
884
     * If the dynobject isn't associated to a feature of this store, return null.
885
     *
886
     * @param dynobject
887
     * @return
888
     */
889
    public Feature getFeature(DynObject dynobject);
890 43371 fdiaz
891 42293 jjdelcerro
    public Iterator iterator();
892 43371 fdiaz
893 43521 jjdelcerro
    public ExpressionBuilder createExpressionBuilder();
894 43371 fdiaz
895 43521 jjdelcerro
    /**
896
     *
897
     * @return
898
     * @deprecated use createExpressionBuilder
899
     */
900
    public ExpressionBuilder createExpression();
901
902 43056 jjdelcerro
    public void createCache(String name, DynObject parameters)
903
        throws DataException;
904
905 43371 fdiaz
    public FeatureCache getCache();
906
907 43215 jjdelcerro
    public boolean isBroken();
908 43371 fdiaz
909 43215 jjdelcerro
        public Throwable getBreakingsCause();
910 43371 fdiaz
911
    /**
912
     * @param index
913
     * @return
914
     */
915
    SpatialIndex wrapSpatialIndex(SpatialIndex index);
916 43824 jjdelcerro
917
    public FeatureReference getFeatureReference(String code);
918 40435 jjdelcerro
}