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