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