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

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