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

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