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

History | View | Annotate | Download (28.2 KB)

1 40559 jjdelcerro
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright (C) 2007-2013 gvSIG Association.
5
 *
6
 * This program is free software; you can redistribute it and/or
7
 * modify it under the terms of the GNU General Public License
8
 * as published by the Free Software Foundation; either version 3
9
 * of the License, or (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program; if not, write to the Free Software
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 * For any additional information, do not hesitate to contact us
22
 * at info AT gvsig.com, or visit our website www.gvsig.com.
23
 */
24 40435 jjdelcerro
package org.gvsig.fmap.dal.feature;
25
26
import java.util.Iterator;
27
import java.util.List;
28
29
import org.cresques.cts.IProjection;
30
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 43371 fdiaz
import org.gvsig.fmap.geom.SpatialIndex;
41 40435 jjdelcerro
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 43533 jjdelcerro
    FeatureSet getFeatureSet(String filter) throws DataException;
209
210
    FeatureSet getFeatureSet(String filter, String sortBy) throws DataException;
211
212
    FeatureSet getFeatureSet(String filter, String sortBy, boolean asc) throws DataException;
213
214 40435 jjdelcerro
    /**
215
     * Returns a subset of features taking into account the properties and
216
     * restrictions of the FeatureQuery.
217
     * <p>
218
     * <em>
219 41818 fdiaz
     * <strong>NOTE:</strong> if you use this method to get a
220
     * {@link FeatureSet}, you  must get sure it is disposed
221
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an
222
     * error occurs while getting the data. It is recommended to use the
223
     * <code>accept</code> methods instead, which handle everything for you.
224
     * Take into account the accept methods may use a fast iterator to
225 40435 jjdelcerro
     * get the features.
226
     * </em>
227
     * </p>
228 41818 fdiaz
     *
229 40435 jjdelcerro
     * @see #accept(org.gvsig.tools.visitor.Visitor,
230
     *      org.gvsig.fmap.dal.DataQuery)
231 41818 fdiaz
     *
232 40435 jjdelcerro
     * @param featureQuery
233
     *            defines the characteristics of the features to return
234
     * @return a collection of features
235
     * @throws ReadException
236
     *             if there is any error while reading the features
237
     */
238
    FeatureSet getFeatureSet(FeatureQuery featureQuery) throws DataException;
239
240
    /**
241
     * Loads a subset of features taking into account the properties and
242
     * restrictions of the FeatureQuery. Feature loading is performed by calling
243
     * the Observer, once each loaded Feature.
244 41818 fdiaz
     *
245 40435 jjdelcerro
     * @param featureQuery
246
     *            defines the characteristics of the features to return
247
     * @param observer
248
     *            to be notified of each loaded Feature
249
     * @throws DataException
250
     *             if there is any error while loading the features
251
     */
252
    void getFeatureSet(FeatureQuery featureQuery, Observer observer)
253
        throws DataException;
254
255
    /**
256
     * Loads all available feature in the store. The loading of Features is
257
     * performed by calling the Observer, once each loaded Feature.
258 41818 fdiaz
     *
259 40435 jjdelcerro
     * @param observer
260
     *            to be notified of each loaded Feature
261
     * @throws DataException
262
     *             if there is any error while loading the features
263
     */
264
    void getFeatureSet(Observer observer) throws DataException;
265
266
    /**
267 42925 jjdelcerro
     * Return a paginated list of Features filtered by the query.
268 43371 fdiaz
     *
269 42925 jjdelcerro
     * The returned List of Features is paginated, and the page size
270
     * used is "pageSize".
271 43371 fdiaz
     *
272 42925 jjdelcerro
     * @param query to filter the returned feature list
273
     * @param pageSize the page size of the list
274
     * @return the list of features
275
     */
276
    public List<Feature> getFeatures(FeatureQuery query, int pageSize);
277 43371 fdiaz
278 43550 jjdelcerro
    public List<Feature> getFeatures(FeatureQuery query);
279
280 43020 jjdelcerro
    public List<Feature> getFeatures();
281 43371 fdiaz
282 42925 jjdelcerro
    /**
283 40435 jjdelcerro
     * Returns the feature given its reference.
284 41818 fdiaz
     *
285 40435 jjdelcerro
     * @param reference
286
     *            a unique FeatureReference
287
     * @return
288
     *         The Feature
289 41818 fdiaz
     *
290 40435 jjdelcerro
     * @throws DataException
291 41818 fdiaz
     *
292 40435 jjdelcerro
     */
293
    public Feature getFeatureByReference(FeatureReference reference)
294
        throws DataException;
295
296
    /**
297
     * Returns the feature given its reference and feature type.
298 41818 fdiaz
     *
299 40435 jjdelcerro
     * @param reference
300
     *            a unique FeatureReference
301 41818 fdiaz
     *
302 40435 jjdelcerro
     * @param featureType
303
     *            FeatureType to which the requested Feature belongs
304 41818 fdiaz
     *
305 40435 jjdelcerro
     * @return
306
     *         The Feature
307 41818 fdiaz
     *
308 40435 jjdelcerro
     * @throws DataException
309 41818 fdiaz
     *
310 40435 jjdelcerro
     */
311
    public Feature getFeatureByReference(FeatureReference reference,
312
        FeatureType featureType) throws DataException;
313
314
    /*
315
     * =============================================================
316 41818 fdiaz
     *
317 40435 jjdelcerro
     * Editing related services
318
     */
319
320
    /**
321
     * Enters editing state.
322
     */
323
    public void edit() throws DataException;
324
325
    /**
326
     * Enters editing state specifying the editing mode.
327 41818 fdiaz
     *
328 40435 jjdelcerro
     * @param mode
329 41818 fdiaz
     *
330 40435 jjdelcerro
     * @throws DataException
331
     */
332
    public void edit(int mode) throws DataException;
333
334
    /**
335
     * Cancels all editing since the last edit().
336 41818 fdiaz
     *
337 40435 jjdelcerro
     * @throws DataException
338
     */
339
    public void cancelEditing() throws DataException;
340
341
    /**
342
     * Exits editing state.
343 41818 fdiaz
     *
344 40435 jjdelcerro
     * @throws DataException
345
     */
346
    public void finishEditing() throws DataException;
347
348
    /**
349
     * Save changes in the provider without leaving the edit mode.
350
     * Do not call observers to communicate a change of ediding mode.
351
     * The operation's history is eliminated to prevent inconsistencies
352
     * in the data.
353
     *
354
     * @throws DataException
355
     */
356
    public void commitChanges() throws DataException ;
357
358
    /**
359
     *
360
     * Returns true if you can call CommitChanges method.
361
     * If not in editing or changes have been made in the structure
362
     * return false.
363 41818 fdiaz
     *
364 40435 jjdelcerro
     * @return true if can call commitChanges
365 41818 fdiaz
     * @throws DataException
366 40435 jjdelcerro
     */
367
    public boolean canCommitChanges() throws DataException;
368
369 41818 fdiaz
370 40435 jjdelcerro
    /**
371
     * Indicates whether this store is in editing state.
372 41818 fdiaz
     *
373 40435 jjdelcerro
     * @return
374
     *         true if this store is in editing state, false if not.
375
     */
376
    public boolean isEditing();
377
378
    /**
379
     * Indicates whether this store is in appending state. In this state the new
380
     * features are automatically inserted at the end of the {@link FeatureSet}.
381 41818 fdiaz
     *
382 40435 jjdelcerro
     * @return true if this store is in appending state.
383
     */
384
    public boolean isAppending();
385
386
    /**
387
     * Updates a {@link FeatureType} in the store with the changes in the
388
     * {@link EditableFeatureType}.<br>
389 41818 fdiaz
     *
390 40435 jjdelcerro
     * Any {@link FeatureSet} from this store that are used will be invalidated.
391 41818 fdiaz
     *
392 40435 jjdelcerro
     * @param featureType
393
     *            an {@link EditableFeatureType} with the changes.
394 41818 fdiaz
     *
395 40435 jjdelcerro
     * @throws DataException
396
     */
397
    public void update(EditableFeatureType featureType) throws DataException;
398
399
    /**
400
     * Updates a {@link Feature} in the store with the changes in the
401
     * {@link EditableFeature}.<br>
402 41818 fdiaz
     *
403 40435 jjdelcerro
     * Any {@link FeatureSet} from this store that was still in use will be
404
     * invalidated. You can override this using
405
     * {@link FeatureSet#update(EditableFeature)}.
406 41818 fdiaz
     *
407 40435 jjdelcerro
     * @param feature
408
     *            the feature to be updated
409 41818 fdiaz
     *
410 40435 jjdelcerro
     * @throws DataException
411
     */
412
    public void update(EditableFeature feature) throws DataException;
413
414
    /**
415
     * Deletes a {@link Feature} from the store.<br>
416 41818 fdiaz
     *
417 40435 jjdelcerro
     * Any {@link FeatureSet} from this store that was still in use will be
418
     * invalidated. You can override this using {@link Iterator#remove()} from
419
     * {@link FeatureSet}.
420 41818 fdiaz
     *
421 40435 jjdelcerro
     * @param feature
422
     *            The feature to be deleted.
423 41818 fdiaz
     *
424 40435 jjdelcerro
     * @throws DataException
425
     */
426
    public void delete(Feature feature) throws DataException;
427
428
    /**
429
     * Inserts a {@link Feature} in the store.<br>
430 41818 fdiaz
     *
431 40435 jjdelcerro
     * Any {@link FeatureSet} from this store that was still in use will be
432
     * invalidated. You can override this using
433
     * {@link FeatureSet#insert(EditableFeature)}.
434 41818 fdiaz
     *
435 40435 jjdelcerro
     * @param feature
436
     *            The feature to be inserted
437 41818 fdiaz
     *
438 40435 jjdelcerro
     * @throws DataException
439
     */
440
    public void insert(EditableFeature feature) throws DataException;
441
442
    /**
443
     * Creates a new feature using the default feature type and returns it as an
444
     * {@link EditableFeature}
445 41818 fdiaz
     *
446 40435 jjdelcerro
     * @return a new feature in editable state
447 41818 fdiaz
     *
448 40435 jjdelcerro
     * @throws DataException
449
     */
450
    public EditableFeature createNewFeature() throws DataException;
451
452
    /**
453
     * Creates a new feature of the given {@link FeatureType} and uses the given
454
     * {@link Feature} as default values to initialize it.
455 41818 fdiaz
     *
456 40435 jjdelcerro
     * @param type
457
     *            the new feature's feature type
458 41818 fdiaz
     *
459 40435 jjdelcerro
     * @param defaultValues
460
     *            a feature whose values are used as default values for the new
461
     *            feature.
462 41818 fdiaz
     *
463 40435 jjdelcerro
     * @return the new feature.
464 41818 fdiaz
     *
465 40435 jjdelcerro
     * @throws DataException
466
     */
467
    public EditableFeature createNewFeature(FeatureType type,
468
        Feature defaultValues) throws DataException;
469
470
    /**
471
     * Creates a new feature of the given {@link FeatureType}. The flag
472
     * defaultValues is used to indicate whether the new feature should be
473
     * initialized with default values or not.
474 41818 fdiaz
     *
475 40435 jjdelcerro
     * @param type
476
     *            the new feature's feature type
477 41818 fdiaz
     *
478 40435 jjdelcerro
     * @param defaultValues
479
     *            if true the new feature is initialized with each attribute's
480
     *            default value.
481 41818 fdiaz
     *
482 40435 jjdelcerro
     * @return
483
     *         the new feature
484 41818 fdiaz
     *
485 40435 jjdelcerro
     * @throws DataException
486
     */
487
    public EditableFeature createNewFeature(FeatureType type,
488
        boolean defaultValues) throws DataException;
489
490
    /**
491
     * Creates a new feature of default {@link FeatureType}. The flag
492
     * defaultValues is used to indicate whether the new feature should be
493
     * initialized with default values or not.
494 41818 fdiaz
     *
495 40435 jjdelcerro
     * @param defaultValues
496
     *            if true the new feature is initialized with each attribute's
497
     *            default value.
498 41818 fdiaz
     *
499 40435 jjdelcerro
     * @return
500
     *         the new feature
501 41818 fdiaz
     *
502 40435 jjdelcerro
     * @throws DataException
503
     */
504
    public EditableFeature createNewFeature(boolean defaultValues)
505
        throws DataException;
506
507
    /**
508 43371 fdiaz
     * Creates a new feature of default {@link FeatureType}.
509
     * The new feature should be initialized with the values of the feature
510 42293 jjdelcerro
     * passed as parameter.
511
     * Values are inicialiced by name from the feature specified. Error in
512
     * value assignement are ignoreds.
513 43371 fdiaz
     *
514 42293 jjdelcerro
     * @param defaultValues the values to initialize the new feature.
515
     * @return the new feature
516 43371 fdiaz
     * @throws DataException
517 42293 jjdelcerro
     */
518
    public EditableFeature createNewFeature(Feature defaultValues)
519
        throws DataException;
520
521
    /**
522 40435 jjdelcerro
     * Applies the validation rules associated to the given mode to the active
523
     * {@link FeatureSet}.
524 41818 fdiaz
     *
525 40435 jjdelcerro
     * @param mode
526
     *            can be one of {MODE_QUERY, MODE_FULLEDIT, MODE_APPEND}
527 41818 fdiaz
     *
528 40435 jjdelcerro
     * @throws DataException
529
     */
530
    public void validateFeatures(int mode) throws DataException;
531
532
    /**
533
     * Indicates whether this store supports append mode.
534 41818 fdiaz
     *
535 40435 jjdelcerro
     * @return
536
     *         true if this store supports append mode.
537
     */
538
    public boolean isAppendModeSupported();
539
540
    /**
541
     * Initiates an editing group. This is typically used to group series of
542
     * store editing operations.
543 41818 fdiaz
     *
544 40435 jjdelcerro
     * @param description
545
     *            Description of the editing group.
546 41818 fdiaz
     *
547 40435 jjdelcerro
     * @throws NeedEditingModeException
548
     */
549
    public void beginEditingGroup(String description)
550
        throws NeedEditingModeException;
551
552
    /**
553
     * Finishes an editing group.
554 41818 fdiaz
     *
555 40435 jjdelcerro
     * @throws NeedEditingModeException
556
     */
557
    public void endEditingGroup() throws NeedEditingModeException;
558
559
    /*
560
     * =============================================================
561 41818 fdiaz
     *
562 40435 jjdelcerro
     * Index related services
563
     */
564
565
    /**
566
     * Creates an index which will be applied to the features of the given type,
567
     * by using the data of the given attribute.
568 41818 fdiaz
     *
569 40435 jjdelcerro
     * @param featureType
570
     *            The FeatureType to which the indexed attribute belongs.
571 41818 fdiaz
     *
572 40435 jjdelcerro
     * @param attributeName
573
     *            The name of the attributed to be indexed
574 41818 fdiaz
     *
575 40435 jjdelcerro
     * @param indexName
576
     *            The index name
577 41818 fdiaz
     *
578 40435 jjdelcerro
     * @return the resulting {@link FeatureIndex}
579 41818 fdiaz
     *
580
     *
581 40435 jjdelcerro
     * @throws FeatureIndexException
582
     *             if there is an error creating the index
583
     */
584
    public FeatureIndex createIndex(FeatureType featureType,
585
        String attributeName, String indexName) throws DataException;
586
587
    /**
588
     * Creates an index which will be applied to the features of the given type,
589
     * by using the data of the given attribute.
590 41818 fdiaz
     *
591 40435 jjdelcerro
     * @param indexTypeName
592
     *            the type of the index to be created. That name is
593
     *            related to one of the registered index providers
594
     * @param featureType
595
     *            The FeatureType to which the indexed attribute belongs.
596 41818 fdiaz
     *
597 40435 jjdelcerro
     * @param attributeName
598
     *            The name of the attributed to be indexed
599 41818 fdiaz
     *
600 40435 jjdelcerro
     * @param indexName
601
     *            The index name
602 41818 fdiaz
     *
603 40435 jjdelcerro
     * @return the resulting {@link FeatureIndex}
604 41818 fdiaz
     *
605
     *
606 40435 jjdelcerro
     * @throws FeatureIndexException
607
     *             if there is an error creating the index
608
     */
609
    public FeatureIndex createIndex(String indexTypeName,
610
        FeatureType featureType, String attributeName, String indexName)
611
        throws DataException;
612
613
    /**
614
     * Creates an index which will be applied to the features of the given type,
615
     * by using the data of the given attribute. This method will return without
616
     * waiting for the index to be filled, as that will be performed in
617
     * background. An optional {@link Observer} parameter is provided to be
618
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
619
     * when the index has finished filling with data and is available to be
620
     * used.
621 41818 fdiaz
     *
622 40435 jjdelcerro
     * @param featureType
623
     *            The FeatureType to which the indexed attribute belongs.
624 41818 fdiaz
     *
625 40435 jjdelcerro
     * @param attributeName
626
     *            The name of the attributed to be indexed
627 41818 fdiaz
     *
628 40435 jjdelcerro
     * @param indexName
629
     *            The index name
630 41818 fdiaz
     *
631 40435 jjdelcerro
     * @param observer
632
     *            to notify to when the created index has finished filling
633
     *            with data and is available to be used. The observer will
634
     *            receive then a
635
     *            {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
636
     *            notification, with the index object if it has finished
637
     *            successfully, or a
638
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
639
     *            notification with the exception object if there has been
640
     *            any error in the process. Optional.
641 41818 fdiaz
     *
642 40435 jjdelcerro
     * @return the resulting {@link FeatureIndex}
643 41818 fdiaz
     *
644 40435 jjdelcerro
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
645
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
646
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
647
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
648 41818 fdiaz
     *
649 40435 jjdelcerro
     * @throws FeatureIndexException
650
     *             if there is an error creating the index
651
     */
652
    public FeatureIndex createIndex(FeatureType featureType,
653
        String attributeName, String indexName, Observer observer)
654
        throws DataException;
655
656
    /**
657
     * Creates an index which will be applied to the features of the given type,
658
     * by using the data of the given attribute. This method will return without
659
     * waiting for the index to be filled, as that will be performed in
660
     * background. An optional {@link Observer} parameter is provided to be
661
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
662
     * when the index has finished filling with data and is available to be
663
     * used.
664 41818 fdiaz
     *
665 40435 jjdelcerro
     * @param indexTypeName
666
     *            the type of the index to be created. That name is
667
     *            related to one of the registered index providers
668
     * @param featureType
669
     *            The FeatureType to which the indexed attribute belongs.
670 41818 fdiaz
     *
671 40435 jjdelcerro
     * @param attributeName
672
     *            The name of the attributed to be indexed
673 41818 fdiaz
     *
674 40435 jjdelcerro
     * @param indexName
675
     *            The index name
676 41818 fdiaz
     *
677 40435 jjdelcerro
     * @param observer
678
     *            to notify to when the created index has finished filling
679
     *            with data and is available to be used. The observer will
680
     *            receive then a
681
     *            {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
682
     *            notification, with the index object if it has finished
683
     *            successfully, or a
684
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
685
     *            notification with the exception object if there has been
686
     *            any error in the process. Optional.
687 41818 fdiaz
     *
688 40435 jjdelcerro
     * @return the resulting {@link FeatureIndex}
689 41818 fdiaz
     *
690 40435 jjdelcerro
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
691
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
692
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
693
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
694 41818 fdiaz
     *
695 40435 jjdelcerro
     * @throws FeatureIndexException
696
     *             if there is an error creating the index
697
     */
698
    public FeatureIndex createIndex(String indexTypeName,
699
        FeatureType featureType, String attributeName, String indexName,
700
        Observer observer) throws DataException;
701
702
    /**
703
     * Returns a FeatureIndexes structure containing all available indexes in
704
     * the store.
705 41818 fdiaz
     *
706 40435 jjdelcerro
     * @return
707
     */
708
    public FeatureIndexes getIndexes();
709
710
    /*
711
     * =============================================================
712 41818 fdiaz
     *
713 40435 jjdelcerro
     * Selection related services
714
     */
715
716
    /**
717
     * Sets the selection to the passed {@link FeatureSet}
718 41818 fdiaz
     *
719 40435 jjdelcerro
     * @param selection
720
     *            A {@link FeatureSet} with the requested selection
721
     */
722
    public void setSelection(FeatureSet selection) throws DataException;
723
724
    /**
725
     * Creates a {@link FeatureSelection}
726 41818 fdiaz
     *
727 40435 jjdelcerro
     * @return
728
     *         a {@link FeatureSelection}
729 41818 fdiaz
     *
730 40435 jjdelcerro
     * @throws DataException
731
     */
732
    public FeatureSelection createFeatureSelection() throws DataException;
733
734
    /**
735
     * Returns the current {@link FeatureSelection}.
736
     * Create a empty selection if not exits.
737 43358 jjdelcerro
     *
738
     * Manage of the selection can be slow on some data sources.
739
     * Use with care.
740
     * In data sources that do not support position access to records,
741
     * it may be slow to retrieve items from the selection. In some data
742
     * sources it may be necessary to access to this to retrieve each
743
     * item in the selection.
744 41818 fdiaz
     *
745 40435 jjdelcerro
     * @return
746
     *         current {@link FeatureSelection}.
747 41818 fdiaz
     *
748 40435 jjdelcerro
     * @throws DataException
749
     */
750
    public FeatureSelection getFeatureSelection() throws DataException;
751
752
    /*
753
     * =============================================================
754 41818 fdiaz
     *
755 40435 jjdelcerro
     * Lock related services
756
     */
757
758
    /**
759
     * Indicates whether this store supports locks.
760 41818 fdiaz
     *
761 40435 jjdelcerro
     * @return
762
     *         true if this store supports locks, false if not.
763
     */
764
    public boolean isLocksSupported();
765
766
    /**
767
     * Returns the set of locked features
768 41818 fdiaz
     *
769 40435 jjdelcerro
     * @return
770
     *         set of locked features
771 41818 fdiaz
     *
772 40435 jjdelcerro
     * @throws DataException
773
     */
774
    public FeatureLocks getLocks() throws DataException;
775
776
    /*
777
     * =============================================================
778
     * Transforms related services
779
     * =============================================================
780
     */
781
782
    /**
783
     * Returns this store transforms
784 41818 fdiaz
     *
785 40435 jjdelcerro
     * @return
786
     *         this store transforms
787
     */
788
    public FeatureStoreTransforms getTransforms();
789
790
    /**
791
     * Returns a new {@link FeatureQuery} associated to this store.
792 41818 fdiaz
     *
793 40435 jjdelcerro
     * @return
794
     *         a new {@link FeatureQuery} associated to this store.
795
     */
796
    public FeatureQuery createFeatureQuery();
797
798
    /**
799
     * Returns featue count of this store.
800 41818 fdiaz
     *
801 40435 jjdelcerro
     * @return
802
     * @throws DataException
803
     */
804
    public long getFeatureCount() throws DataException;
805
806 43020 jjdelcerro
//    /**
807
//     * Creates a vectorial cache that is used to save and retrieve data.
808
//     *
809
//     * @param name
810
//     *            the cache name.
811
//     * @param parameters
812
//     *            parameters to create the stores used to save data.
813
//     * @throws DataException
814
//     */
815
//    public void createCache(String name, DynObject parameters)
816
//        throws DataException;
817
//
818
//    /**
819
//     * @return the vectorial cache
820
//     */
821
//    public FeatureCache getCache();
822 40435 jjdelcerro
823
    /**
824
     * Return if the provider knows the real envelope of a layer. If not,
825
     * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
826
     * the full envelope.
827 41818 fdiaz
     *
828 40435 jjdelcerro
     * @return
829
     *         <true> if it knows the real envelope.
830
     */
831
    public boolean isKnownEnvelope();
832
833
    /**
834
     * Return if the maximum number of features provided by the
835
     * provider are limited.
836 41818 fdiaz
     *
837 40435 jjdelcerro
     * @return
838
     *         <true> if there is a limit of features.
839
     */
840
    public boolean hasRetrievedFeaturesLimit();
841
842
    /**
843
     * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns
844
     * true,
845
     * it returns the limit of features retrieved from the provider.
846 41818 fdiaz
     *
847 40435 jjdelcerro
     * @return
848
     *         The limit of the retrieved features.
849
     */
850
    public int getRetrievedFeaturesLimit();
851 41818 fdiaz
852
    /**
853
     * Return the associated feature to the dynobject.
854
     * If the dynobject isn't associated to a feature of this store, return null.
855
     *
856
     * @param dynobject
857
     * @return
858
     */
859
    public Feature getFeature(DynObject dynobject);
860 43371 fdiaz
861 42293 jjdelcerro
    public Iterator iterator();
862 43371 fdiaz
863 43521 jjdelcerro
    public ExpressionBuilder createExpressionBuilder();
864 43371 fdiaz
865 43521 jjdelcerro
    /**
866
     *
867
     * @return
868
     * @deprecated use createExpressionBuilder
869
     */
870
    public ExpressionBuilder createExpression();
871
872 43056 jjdelcerro
    public void createCache(String name, DynObject parameters)
873
        throws DataException;
874
875 43371 fdiaz
    public FeatureCache getCache();
876
877 43215 jjdelcerro
    public boolean isBroken();
878 43371 fdiaz
879 43215 jjdelcerro
        public Throwable getBreakingsCause();
880 43371 fdiaz
881
    /**
882
     * @param index
883
     * @return
884
     */
885
    SpatialIndex wrapSpatialIndex(SpatialIndex index);
886 40435 jjdelcerro
}