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 @ 45739
History | View | Annotate | Download (50 KB)
1 |
/**
|
---|---|
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 |
package org.gvsig.fmap.dal.feature; |
25 |
|
26 |
import java.util.Iterator; |
27 |
import java.util.List; |
28 |
import javax.json.JsonObject; |
29 |
|
30 |
import org.cresques.cts.IProjection; |
31 |
import org.gvsig.expressionevaluator.Expression; |
32 |
import org.gvsig.expressionevaluator.ExpressionBuilder; |
33 |
|
34 |
import org.gvsig.fmap.dal.DataServerExplorer; |
35 |
import org.gvsig.fmap.dal.DataStore; |
36 |
import org.gvsig.fmap.dal.DataStoreParameters; |
37 |
import org.gvsig.fmap.dal.exception.DataException; |
38 |
import org.gvsig.fmap.dal.exception.ReadException; |
39 |
import org.gvsig.fmap.dal.feature.exception.FeatureIndexException; |
40 |
import org.gvsig.fmap.dal.feature.exception.NeedEditingModeException; |
41 |
import org.gvsig.fmap.geom.Geometry; |
42 |
import org.gvsig.fmap.geom.SpatialIndex; |
43 |
import org.gvsig.fmap.geom.primitive.Envelope; |
44 |
import org.gvsig.tools.dispose.DisposableIterator; |
45 |
import org.gvsig.tools.dynobject.DynObject; |
46 |
import org.gvsig.tools.lang.Cloneable; |
47 |
import org.gvsig.tools.observer.Observer; |
48 |
import org.gvsig.tools.undo.UndoRedoStack; |
49 |
import org.gvsig.tools.util.GetItemWithSizeIsEmptyAndIterator64; |
50 |
import org.gvsig.tools.util.PropertiesSupport; |
51 |
import org.gvsig.tools.util.Size64; |
52 |
import org.gvsig.tools.util.UnmodifiableBasicList64; |
53 |
|
54 |
/**
|
55 |
* <p>
|
56 |
* A FeatureStore is a type of store whose data consists on sets of
|
57 |
* {@link Feature}(s). {@link Feature}(s) from the same FeatureStore can be of
|
58 |
* different {@link FeatureType}(s) (as in GML format for instance).
|
59 |
* </p>
|
60 |
*
|
61 |
* <p>
|
62 |
* FeatureStore allows:
|
63 |
* </p>
|
64 |
* <ul>
|
65 |
* <li>Obtaining the default {@link FeatureType}. A FeatureStore always has one
|
66 |
* and only one default FeatureType.
|
67 |
* <li>Obtaining the list of {@link FeatureType}(s) defined in the FeatureStore.
|
68 |
* <li>Obtaining, filtering and sorting subsets of data ({@link FeatureSet})
|
69 |
* through {@link FeatureQuery}, as well as background loading.
|
70 |
* <li>Obtaining the total {@link Envelope} (AKA bounding box or extent) of the
|
71 |
* store.
|
72 |
* <li>Support for editing {@link FeatureType}(s).
|
73 |
* <li>Obtaining information about contained {@link Geometry} types.
|
74 |
* <li>Exporting to another store.
|
75 |
* <li>Indexing.
|
76 |
* <li>Selection.
|
77 |
* <li>Locks management.
|
78 |
* </ul>
|
79 |
*
|
80 |
*/
|
81 |
public interface FeatureStore extends |
82 |
DataStore, UndoRedoStack, Cloneable, Iterable<Feature>, |
83 |
PropertiesSupport, |
84 |
Size64 { |
85 |
|
86 |
public static final String METADATA_DEFINITION_NAME = "FeatureStore"; |
87 |
|
88 |
final static int MODE_UNKNOWN = -1; |
89 |
|
90 |
/** Indicates that this store is in query mode */
|
91 |
final static int MODE_QUERY = 0; |
92 |
|
93 |
/** Indicates that this store is in full edit mode */
|
94 |
final static int MODE_FULLEDIT = 1; |
95 |
|
96 |
/** Indicates that this store is in append mode */
|
97 |
final static int MODE_APPEND = 2; |
98 |
|
99 |
final static int MODE_PASS_THROUGH = 3; |
100 |
|
101 |
/*
|
102 |
* =============================================================
|
103 |
*
|
104 |
* information related services
|
105 |
*/
|
106 |
|
107 |
/**
|
108 |
* Indicates whether this store allows writing.
|
109 |
*
|
110 |
* @return
|
111 |
* true if this store can be written, false if not.
|
112 |
*/
|
113 |
public boolean allowWrite(); |
114 |
|
115 |
/**
|
116 |
* Returns this store's default {@link FeatureType}.
|
117 |
*
|
118 |
* @return
|
119 |
* this store's default {@link FeatureType}.
|
120 |
*
|
121 |
* @throws DataException
|
122 |
*/
|
123 |
public FeatureType getDefaultFeatureType() throws DataException; |
124 |
|
125 |
public FeatureType getDefaultFeatureTypeQuietly();
|
126 |
|
127 |
/**
|
128 |
* Returns this store's featureType {@link FeatureType} matches with
|
129 |
* featureTypeId.
|
130 |
*
|
131 |
* @param featureTypeId
|
132 |
*
|
133 |
* @return this store's default {@link FeatureType}.
|
134 |
*
|
135 |
* @throws DataException
|
136 |
*/
|
137 |
public FeatureType getFeatureType(String featureTypeId) |
138 |
throws DataException;
|
139 |
|
140 |
/**
|
141 |
* Returns this store's {@link FeatureType}(s).
|
142 |
*
|
143 |
* @return a list with this store's {@link FeatureType}(s).
|
144 |
*
|
145 |
* @throws DataException
|
146 |
*/
|
147 |
public List getFeatureTypes() throws DataException; |
148 |
|
149 |
/**
|
150 |
* Returns this store's parameters.
|
151 |
*
|
152 |
* @return
|
153 |
* {@link DataStoreParameters} containing this store's parameters
|
154 |
*/
|
155 |
public DataStoreParameters getParameters();
|
156 |
|
157 |
/**
|
158 |
* @param gvSIGgeometryType
|
159 |
* @return
|
160 |
* @throws DataException
|
161 |
* @deprecated Mirar de cambiarlo a metadatos
|
162 |
*/
|
163 |
public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException; |
164 |
|
165 |
/**
|
166 |
* Returns this store's total envelope (extent).
|
167 |
*
|
168 |
* @return this store's total envelope (extent) or <code>null</code> if
|
169 |
* store not have geometry information
|
170 |
* @throws org.gvsig.fmap.dal.exception.DataException
|
171 |
*/
|
172 |
public Envelope getEnvelope() throws DataException; |
173 |
|
174 |
/**
|
175 |
*
|
176 |
* @deprecated use getDefaultFeatureType().getDefaultSRS()
|
177 |
* @return
|
178 |
* @throws DataException
|
179 |
*/
|
180 |
public IProjection getSRSDefaultGeometry() throws DataException; |
181 |
|
182 |
/**
|
183 |
* Exports this store to another store.
|
184 |
*
|
185 |
* @param explorer
|
186 |
* {@link DataServerExplorer} target
|
187 |
* @param provider
|
188 |
* @param params
|
189 |
* New parameters of this store that will be used on the target
|
190 |
* explorer
|
191 |
*
|
192 |
* @throws DataException
|
193 |
*
|
194 |
* @Deprecated this method is unstable
|
195 |
*/
|
196 |
public void export(DataServerExplorer explorer, String provider, |
197 |
NewFeatureStoreParameters params, String name) throws DataException; |
198 |
|
199 |
public void copyTo(FeatureStore target); |
200 |
|
201 |
/*
|
202 |
* =============================================================
|
203 |
*
|
204 |
* Query related services
|
205 |
*/
|
206 |
|
207 |
/**
|
208 |
* Create a {@link FeatureQuery} with the restrictions indicateds.
|
209 |
*
|
210 |
* "filter" will be null or a valid filter expression for the store.
|
211 |
*
|
212 |
* "sortBy" can be null to use the store's default order.
|
213 |
*
|
214 |
* The parameter sortBy can be an attribute name or a comma separated list.
|
215 |
* Each attribute name can be preceded or followed by "+" or "-" to indicate
|
216 |
* the order to use to sort by that attribute.
|
217 |
*
|
218 |
* If no "+" or "-" is indicated, the "asc" parameter will be used to
|
219 |
* determine if the order is ascending, "true" or decent, "false".
|
220 |
*
|
221 |
* @param filter an {@link String} expression used to filter the features in the store.
|
222 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
223 |
* @param asc use order ascending, true, or descending, false.
|
224 |
* @return a {@link FeatureQuery} with the restrictions.
|
225 |
* @see {@link FeatureQuery}
|
226 |
*/
|
227 |
public FeatureQuery createFeatureQuery(String filter, String sortBy, boolean asc); |
228 |
public FeatureQuery createFeatureQuery(String filter); |
229 |
public FeatureQuery createFeatureQuery(Expression filter); |
230 |
|
231 |
/**
|
232 |
* Create a {@link FeatureQuery} with the restrictions indicateds.
|
233 |
*
|
234 |
* "filter" will be null or {@link Expression} valid for the store.
|
235 |
*
|
236 |
* "sortBy" can be null to use the store's default order.
|
237 |
*
|
238 |
* The parameter sortBy can be an attribute name or a comma separated list.
|
239 |
* Each attribute name can be preceded or followed by "+" or "-" to indicate
|
240 |
* the order to use to sort by that attribute.
|
241 |
*
|
242 |
* If no "+" or "-" is indicated, the "asc" parameter will be used to
|
243 |
* determine if the order is ascending, "true" or decent, "false".
|
244 |
*
|
245 |
* @param filter an {@link String} expression used to filter the features in the store.
|
246 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
247 |
* @param asc use order ascending, true, or descending, false.
|
248 |
* @return a {@link FeatureQuery} with the restrictions.
|
249 |
* @see {@link FeatureQuery}
|
250 |
*/
|
251 |
public FeatureQuery createFeatureQuery(Expression filter, String sortBy, boolean asc); |
252 |
|
253 |
/**
|
254 |
* Create a {@link FeatureQuery} with the restrictions indicateds.
|
255 |
*
|
256 |
* "filter" will be null or {@link Expression} valid for the store.
|
257 |
*
|
258 |
* "sortBy" can be null to use the store's default order.
|
259 |
*
|
260 |
* The parameter sortBy can be an attribute name or a comma separated list.
|
261 |
* Each attribute name can be preceded or followed by "+" or "-" to indicate
|
262 |
* the order to use to sort by that attribute.
|
263 |
*
|
264 |
* If no "+" or "-" is indicated, the "asc" parameter will be used to
|
265 |
* determine if the order is ascending, "true" or decent, "false".
|
266 |
*
|
267 |
* @param filter an {@link String} expression used to filter the features in the store.
|
268 |
* @param sortBy expression used to order the features in the store.
|
269 |
* @param asc use order ascending, true, or descending, false.
|
270 |
* @return a {@link FeatureQuery} with the restrictions.
|
271 |
* @see {@link FeatureQuery}
|
272 |
*/
|
273 |
public FeatureQuery createFeatureQuery(Expression filter, Expression sortBy, boolean asc); |
274 |
|
275 |
/**
|
276 |
* Create a {@link FeatureQuery} with the restrictions indicateds.
|
277 |
*
|
278 |
* "filter" will be null or {@link Expression} valid for the store.
|
279 |
*
|
280 |
* "sortBy" can be null to use the store's default order.
|
281 |
*
|
282 |
* The parameter sortBy can be an attribute name or a comma separated list.
|
283 |
* Each attribute name can be preceded or followed by "+" or "-" to indicate
|
284 |
* the order to use to sort by that attribute.
|
285 |
*
|
286 |
* If no "+" or "-" is indicated, the "asc" parameter will be used to
|
287 |
* determine if the order is ascending, "true" or decent, "false".
|
288 |
*
|
289 |
* @param filter an {@link String} expression used to filter the features in the store.
|
290 |
* @param sortBy expression used to order the features in the store.
|
291 |
* @param asc use order ascending, true, or descending, false.
|
292 |
* @return a {@link FeatureQuery} with the restrictions.
|
293 |
* @see {@link FeatureQuery}
|
294 |
*/
|
295 |
public FeatureQuery createFeatureQuery(String filter, Expression sortBy, boolean asc); |
296 |
|
297 |
|
298 |
|
299 |
/**
|
300 |
* Returns all available features in the store.
|
301 |
*
|
302 |
* It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
|
303 |
*
|
304 |
* @return the {@link FeatureSet}
|
305 |
* @throws ReadException if there is any error while reading the features
|
306 |
* @see {@link #accept(org.gvsig.tools.visitor.Visitor)}, {@link #getFeatureSet(FeatureQuery)}
|
307 |
*/
|
308 |
FeatureSet getFeatureSet() throws DataException;
|
309 |
|
310 |
/**
|
311 |
* Return a subset of features.
|
312 |
*
|
313 |
* It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
|
314 |
*
|
315 |
* @param filter an {@link String} expression used to filter the features in the store.
|
316 |
* @return the {@link FeatureSet}
|
317 |
* @throws ReadException if there is any error while reading the features
|
318 |
* @see {@link #createFeatureQuery(Expression,String,boolean)}, {@link #getFeatureSet(FeatureQuery)}
|
319 |
*/
|
320 |
FeatureSet getFeatureSet(String filter) throws DataException; |
321 |
|
322 |
/**
|
323 |
* Return a subset of features.
|
324 |
*
|
325 |
* It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
|
326 |
*
|
327 |
* The sort order used is ascending.
|
328 |
*
|
329 |
* @param filter an {@link String} expression used to filter the features in the store.
|
330 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
331 |
* @return the {@link FeatureSet}
|
332 |
* @throws ReadException if there is any error while reading the features
|
333 |
* @see {@link #createFeatureQuery(Expression,String,boolean)}, {@link #getFeatureSet(FeatureQuery)}
|
334 |
*/
|
335 |
FeatureSet getFeatureSet(String filter, String sortBy) throws DataException; |
336 |
|
337 |
/**
|
338 |
* Return a subset of features.
|
339 |
*
|
340 |
* It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
|
341 |
*
|
342 |
* @param filter an {@link String} expression used to filter the features in the store.
|
343 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
344 |
* @param asc use order ascending, true, or descending, false.
|
345 |
* @return the {@link FeatureSet}
|
346 |
* @throws ReadException if there is any error while reading the features
|
347 |
* @see {@link #createFeatureQuery(Expression,String,boolean)}, {@link #getFeatureSet(FeatureQuery)}
|
348 |
*/
|
349 |
FeatureSet getFeatureSet(String filter, String sortBy, boolean asc) throws DataException; |
350 |
|
351 |
/**
|
352 |
* Return a subset of features.
|
353 |
*
|
354 |
* It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
|
355 |
*
|
356 |
* @param filter an {@link Expression} used to filter the features in the store.
|
357 |
* @return the {@link FeatureSet}
|
358 |
* @throws DataException
|
359 |
* @see {@link #createFeatureQuery(Expression,String,boolean)}, {@link #getFeatureSet(FeatureQuery)}
|
360 |
*/
|
361 |
FeatureSet getFeatureSet(Expression filter) throws DataException; |
362 |
|
363 |
/**
|
364 |
* Return a subset of features.
|
365 |
*
|
366 |
* It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
|
367 |
*
|
368 |
* The sort order used is ascending.
|
369 |
*
|
370 |
* @param filter an {@link Expression} used to filter the features in the store.
|
371 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
372 |
* @return the {@link FeatureSet}
|
373 |
* @throws ReadException if there is any error while reading the features
|
374 |
* @see {@link #createFeatureQuery(Expression,String,boolean)}, {@link #getFeatureSet(FeatureQuery)}
|
375 |
*/
|
376 |
FeatureSet getFeatureSet(Expression filter, String sortBy) throws DataException; |
377 |
|
378 |
/**
|
379 |
* Return a subset of features.
|
380 |
*
|
381 |
* It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
|
382 |
*
|
383 |
* @param filter an {@link Expression} used to filter the features in the store.
|
384 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
385 |
* @param asc use order ascending, true, or descending, false.
|
386 |
* @return the {@link FeatureSet}
|
387 |
* @throws DataException
|
388 |
* @see {@link #createFeatureQuery(Expression,String,boolean)}, {@link #getFeatureSet(FeatureQuery)}
|
389 |
*/
|
390 |
FeatureSet getFeatureSet(Expression filter, String sortBy, boolean asc) throws DataException; |
391 |
|
392 |
/**
|
393 |
* Returns a subset of features taking into account the properties and
|
394 |
* restrictions of the {@link FeatureQuery}.
|
395 |
*
|
396 |
* If {@link FeatureQuery} is null, return al features in the store.
|
397 |
*
|
398 |
* <p>
|
399 |
* <em>
|
400 |
* <strong>NOTE:</strong> if you use this method to get a
|
401 |
* {@link FeatureSet}, you must get sure it is disposed
|
402 |
* (@see {@link DisposableIterator#dispose()}) in any case, even if an
|
403 |
* error occurs while getting the data. It is recommended to use the
|
404 |
* <code>accept</code> methods instead, which handle everything for you.
|
405 |
* Take into account the accept methods may use a fast iterator to
|
406 |
* get the features.
|
407 |
* </em>
|
408 |
* </p>
|
409 |
*
|
410 |
* @param featureQuery defines the characteristics of the features to return.
|
411 |
* @return the {@link FeatureSet}
|
412 |
* @throws ReadException if there is any error while reading the features.
|
413 |
* @see #accept(org.gvsig.tools.visitor.Visitor, org.gvsig.fmap.dal.DataQuery)
|
414 |
*/
|
415 |
FeatureSet getFeatureSet(FeatureQuery featureQuery) throws DataException;
|
416 |
|
417 |
/**
|
418 |
* Loads a subset of features taking into account the properties and
|
419 |
* restrictions of the FeatureQuery.
|
420 |
* When feature loading is finished call the Observer passing the
|
421 |
* {@link FeatureSet} loaded.
|
422 |
*
|
423 |
* @param featureQuery defines the characteristics of the features to return.
|
424 |
* @param observer to be notified when loading is finished.
|
425 |
* @throws DataException if there is any error while loading the features
|
426 |
*/
|
427 |
void getFeatureSet(FeatureQuery featureQuery, Observer observer) throws DataException; |
428 |
|
429 |
/**
|
430 |
* Loads all available feature in the store. The loading of Features is
|
431 |
* performed by calling the Observer, once each loaded Feature.
|
432 |
*
|
433 |
* @param observer to be notified of each loaded Feature
|
434 |
* @throws DataException if there is any error while loading the features
|
435 |
*/
|
436 |
void getFeatureSet(Observer observer) throws DataException; |
437 |
|
438 |
/**
|
439 |
* Return a paginated list of Features filtered by the query.
|
440 |
*
|
441 |
* If the query is null, return all features in the store sorteds
|
442 |
* by default order.
|
443 |
*
|
444 |
* The return value implements {@link List} and {@link UnmodifiableBasicList64}
|
445 |
* to support large list of features.
|
446 |
*
|
447 |
* The returned list of Features is paginated, and the page size
|
448 |
* used is "pageSize".
|
449 |
*
|
450 |
* If the page size is less than or equal to 0, the default page size of
|
451 |
* 100 will be used.
|
452 |
*
|
453 |
* @param query to filter and sort the returned feature list
|
454 |
* @param pageSize the page size of the list
|
455 |
* @return the {@link List}/{@link UnmodifiableBasicList64} of features
|
456 |
*/
|
457 |
public List<Feature> getFeatures(FeatureQuery query, int pageSize); |
458 |
|
459 |
/**
|
460 |
* Return a paginated list of Features.
|
461 |
*
|
462 |
* It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
|
463 |
* using the default page size.
|
464 |
*
|
465 |
* @param query to filter and sort the returned feature list
|
466 |
* @return the {@link List}/{@link UnmodifiableBasicList64} of features
|
467 |
* @see {@link #getFeatures(FeatureQuery, int)}
|
468 |
*/
|
469 |
public List<Feature> getFeatures(FeatureQuery query); |
470 |
|
471 |
/**
|
472 |
* Return a paginated list with al Features in the store.
|
473 |
*
|
474 |
* It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
|
475 |
* using the default page size.
|
476 |
*
|
477 |
* @return the {@link List}/{@link UnmodifiableBasicList64} of features
|
478 |
* @see {@link #getFeatures(FeatureQuery, int)}
|
479 |
*/
|
480 |
public List<Feature> getFeatures(); |
481 |
|
482 |
/**
|
483 |
* Return a paginated list of Features
|
484 |
*
|
485 |
* It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
|
486 |
*
|
487 |
* @param filter used to filter the features in the store.
|
488 |
* @return the List of Features
|
489 |
* @see {@link #getFeatures(FeatureQuery, int)}, {@link #createFeatureQuery(String,String,boolean)}
|
490 |
*/
|
491 |
public List<Feature> getFeatures(String filter); |
492 |
|
493 |
/**
|
494 |
* Return a paginated list of Features.
|
495 |
*
|
496 |
* It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
|
497 |
* using the default page size.
|
498 |
*
|
499 |
* @param filter used to filter the features in the store.
|
500 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
501 |
* @return the {@link List}/{@link UnmodifiableBasicList64} of features
|
502 |
* @see {@link #getFeatures(FeatureQuery, int)}, {@link #createFeatureQuery(String,String,boolean)}
|
503 |
*/
|
504 |
public List<Feature> getFeatures(String filter, String sortBy); |
505 |
|
506 |
/**
|
507 |
* Return a paginated list of Features.
|
508 |
*
|
509 |
* It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
|
510 |
* using the default page size.
|
511 |
*
|
512 |
* @param filter an {@link String} expression used to filter the features in the store.
|
513 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
514 |
* @param asc use order ascending, true, or descending, false.
|
515 |
* @return the {@link List}/{@link UnmodifiableBasicList64} of features
|
516 |
* @see {@link #getFeatures(FeatureQuery, int)}, {@link #createFeatureQuery(String,String,boolean)}
|
517 |
*/
|
518 |
public List<Feature> getFeatures(String filter, String sortBy, boolean asc); |
519 |
|
520 |
/**
|
521 |
* Return a paginated list of Features
|
522 |
*
|
523 |
* It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
|
524 |
* using the default page size.
|
525 |
*
|
526 |
* @param filter an {@link Expression} used to filter the features in the store.
|
527 |
* @return the List of Features
|
528 |
* @see {@link #getFeatures(FeatureQuery, int)}, {@link #createFeatureQuery(Expression,String,boolean)}
|
529 |
*/
|
530 |
public List<Feature> getFeatures(Expression filter); |
531 |
|
532 |
/**
|
533 |
* Return a paginated list of Features
|
534 |
*
|
535 |
* It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
|
536 |
* using the default page size.
|
537 |
*
|
538 |
* @param filter an {@link Expression} used to filter the features in the store.
|
539 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
540 |
* @return the {@link List}/{@link UnmodifiableBasicList64} of features
|
541 |
* @see {@link #getFeatures(FeatureQuery, int)}, {@link #createFeatureQuery(Expression,String,boolean)}
|
542 |
*/
|
543 |
public List<Feature> getFeatures(Expression filter, String sortBy); |
544 |
|
545 |
/**
|
546 |
* Return a paginated list of Features
|
547 |
*
|
548 |
* It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
|
549 |
* using the default page size.
|
550 |
*
|
551 |
* @param filter an {@link Expression} used to filter the features in the store.
|
552 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
553 |
* @param asc use order ascending, true, or descending, false.
|
554 |
* @return the {@link List}/{@link UnmodifiableBasicList64} of features
|
555 |
* @see {@link #getFeatures(FeatureQuery, int)}, {@link #createFeatureQuery(Expression,String,boolean)}
|
556 |
*/
|
557 |
public List<Feature> getFeatures(Expression filter, String sortBy, boolean asc); |
558 |
|
559 |
public GetItemWithSizeIsEmptyAndIterator64<Feature> getFeatures64();
|
560 |
|
561 |
public GetItemWithSizeIsEmptyAndIterator64<Feature> getFeatures64(String filter); |
562 |
|
563 |
public GetItemWithSizeIsEmptyAndIterator64<Feature> getFeatures64(String filter, String sortBy, boolean asc); |
564 |
|
565 |
public GetItemWithSizeIsEmptyAndIterator64<Feature> getFeatures64(FeatureQuery query, int pageSize); |
566 |
|
567 |
/**
|
568 |
* Return the first {@link Feature} of the store.
|
569 |
*
|
570 |
* @return the first {@link Feature} or null if the store is empty.
|
571 |
* @throws DataException
|
572 |
*/
|
573 |
public Feature first() throws DataException; |
574 |
|
575 |
/**
|
576 |
* Returns the first {@link Feature} that meets the criteria indicated.
|
577 |
*
|
578 |
* It is a utility method that calls {@link #findFirst(FeatureQuery)}.
|
579 |
*
|
580 |
* @param filter {@link String} expression used to filter the features.
|
581 |
* @return the first {@link Feature} or null if the filter don't return any feature.
|
582 |
* @throws DataException
|
583 |
* @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(String,String,boolean)}
|
584 |
*/
|
585 |
public Feature findFirst(String filter) throws DataException; |
586 |
|
587 |
/**
|
588 |
* Returns the first {@link Feature} that meets the criteria indicated.
|
589 |
*
|
590 |
* It is a utility method that calls {@link #findFirst(FeatureQuery)}.
|
591 |
*
|
592 |
* @param filter {@link String} expression used to filter the features.
|
593 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
594 |
* @return the first {@link Feature} or null if the filter don't return any feature.
|
595 |
* @throws DataException
|
596 |
* @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(String,String,boolean)}
|
597 |
*/
|
598 |
public Feature findFirst(String filter, String sortBy) throws DataException; |
599 |
|
600 |
/**
|
601 |
* Returns the first {@link Feature} that meets the criteria indicated.
|
602 |
*
|
603 |
* It is a utility method that calls {@link #findFirst(FeatureQuery)}.
|
604 |
*
|
605 |
* @param filter {@link String} expression used to filter the features.
|
606 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
607 |
* @param asc use order ascending, true, or descending, false.
|
608 |
* @return the first {@link Feature} or null if the filter don't return any feature.
|
609 |
* @throws DataException
|
610 |
* @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(String,String,boolean)}
|
611 |
*/
|
612 |
public Feature findFirst(String filter, String sortBy, boolean asc) throws DataException; |
613 |
|
614 |
|
615 |
/**
|
616 |
* Returns the first {@link Feature} that meets the criteria indicated.
|
617 |
*
|
618 |
* It is a utility method that calls {@link #findFirst(FeatureQuery)}.
|
619 |
*
|
620 |
* @param filter {@link String} expression used to filter the features.
|
621 |
* @param sortBy Expression
|
622 |
* @param asc use order ascending, true, or descending, false.
|
623 |
* @return the first {@link Feature} or null if the filter don't return any feature.
|
624 |
* @throws DataException
|
625 |
* @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(String,String,boolean)}
|
626 |
*/
|
627 |
public Feature findFirst(String filter, Expression sortBy, boolean asc) throws DataException; |
628 |
|
629 |
/**
|
630 |
* Returns the first {@link Feature} that meets the criteria indicated.
|
631 |
*
|
632 |
* It is a utility method that calls {@link #findFirst(FeatureQuery)}.
|
633 |
*
|
634 |
* @param filter {@link String} expression used to filter the features.
|
635 |
* @return the first {@link Feature} or null if the filter don't return any feature.
|
636 |
* @throws DataException
|
637 |
* @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(Expession,String,boolean)}
|
638 |
*/
|
639 |
public Feature findFirst(Expression filter) throws DataException; |
640 |
|
641 |
/**
|
642 |
* Returns the first {@link Feature} that meets the criteria indicated.
|
643 |
*
|
644 |
* It is a utility method that calls {@link #findFirst(FeatureQuery)}.
|
645 |
*
|
646 |
* @param filter {@link String} expression used to filter the features.
|
647 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
648 |
* @return the first {@link Feature} or null if the filter don't return any feature.
|
649 |
* @throws DataException
|
650 |
* @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(Expession,String,boolean)}
|
651 |
*/
|
652 |
public Feature findFirst(Expression filter, String sortBy) throws DataException; |
653 |
|
654 |
/**
|
655 |
* Returns the first {@link Feature} that meets the criteria indicated.
|
656 |
*
|
657 |
* It is a utility method that calls {@link #findFirst(FeatureQuery)}.
|
658 |
*
|
659 |
* @param filter {@link String} expression used to filter the features.
|
660 |
* @param sortBy Attribute names separated by commas used to sort the list to return.
|
661 |
* @param asc use order ascending, true, or descending, false.
|
662 |
* @return the first {@link Feature} or null if the filter don't return any feature.
|
663 |
* @throws DataException
|
664 |
* @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(Expession,String,boolean)}
|
665 |
*/
|
666 |
public Feature findFirst(Expression filter, String sortBy, boolean asc) throws DataException; |
667 |
|
668 |
/**
|
669 |
* Returns the first {@link Feature} that meets the criteria indicated.
|
670 |
*
|
671 |
* It is a utility method that calls {@link #findFirst(FeatureQuery)}.
|
672 |
*
|
673 |
* @param filter {@link String} expression used to filter the features.
|
674 |
* @param sortBy expression used to sort features
|
675 |
* @param asc use order ascending, true, or descending, false.
|
676 |
* @return the first {@link Feature} or null if the filter don't return any feature.
|
677 |
* @throws DataException
|
678 |
* @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(Expession,String,boolean)}
|
679 |
*/
|
680 |
public Feature findFirst(Expression filter, Expression sortBy, boolean asc) throws DataException; |
681 |
|
682 |
/**
|
683 |
* Returns the first {@link Feature} that meets the criteria indicated.
|
684 |
*
|
685 |
* It is a utility method that calls {@link #findFirst(FeatureQuery)}.
|
686 |
*
|
687 |
* @param query to filter and sort the returned feature list
|
688 |
* @return the first {@link Feature} or null if the filter don't return any feature.
|
689 |
* @throws DataException
|
690 |
* @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(Expession,String,boolean)}
|
691 |
*/
|
692 |
public Feature findFirst(FeatureQuery query) throws DataException; |
693 |
|
694 |
/**
|
695 |
* Returns the feature given its reference.
|
696 |
*
|
697 |
* @param reference a unique FeatureReference
|
698 |
* @return
|
699 |
* @returnThe Feature
|
700 |
* @throws DataException
|
701 |
*
|
702 |
*/
|
703 |
public Feature getFeatureByReference(FeatureReference reference) throws DataException; |
704 |
|
705 |
/**
|
706 |
* Returns the feature given its reference and feature type.
|
707 |
*
|
708 |
* @param reference
|
709 |
* a unique FeatureReference
|
710 |
*
|
711 |
* @param featureType
|
712 |
* FeatureType to which the requested Feature belongs
|
713 |
*
|
714 |
* @return
|
715 |
* The Feature
|
716 |
*
|
717 |
* @throws DataException
|
718 |
*
|
719 |
*/
|
720 |
public Feature getFeatureByReference(FeatureReference reference,
|
721 |
FeatureType featureType) throws DataException;
|
722 |
|
723 |
/*
|
724 |
* =============================================================
|
725 |
*
|
726 |
* Editing related services
|
727 |
*/
|
728 |
|
729 |
/**
|
730 |
* Enters editing state.
|
731 |
* @throws org.gvsig.fmap.dal.exception.DataException
|
732 |
*/
|
733 |
public void edit() throws DataException; |
734 |
|
735 |
/**
|
736 |
* Enters editing state specifying the editing mode.
|
737 |
*
|
738 |
* @param mode
|
739 |
*
|
740 |
* @throws DataException
|
741 |
*/
|
742 |
public void edit(int mode) throws DataException; |
743 |
|
744 |
public int getMode(); |
745 |
|
746 |
/**
|
747 |
* Cancels all editing since the last edit().
|
748 |
*
|
749 |
* @throws DataException
|
750 |
*/
|
751 |
public void cancelEditing() throws DataException; |
752 |
|
753 |
public boolean cancelEditingQuietly(); |
754 |
|
755 |
public static boolean cancelEditingQuietly(FeatureStore store) { |
756 |
if( store==null ) { |
757 |
return true; |
758 |
} |
759 |
return store.cancelEditingQuietly();
|
760 |
} |
761 |
|
762 |
/**
|
763 |
* Exits editing state.
|
764 |
*
|
765 |
* @throws DataException
|
766 |
*/
|
767 |
public void finishEditing() throws DataException; |
768 |
|
769 |
public boolean finishEditingQuietly(); |
770 |
|
771 |
public static boolean finishEditingQuietly(FeatureStore store) { |
772 |
if( store==null ) { |
773 |
return true; |
774 |
} |
775 |
return store.finishEditingQuietly();
|
776 |
} |
777 |
|
778 |
/**
|
779 |
* Save changes in the provider without leaving the edit mode.
|
780 |
* Do not call observers to communicate a change of ediding mode.
|
781 |
* The operation's history is eliminated to prevent inconsistencies
|
782 |
* in the data.
|
783 |
*
|
784 |
* @throws DataException
|
785 |
*/
|
786 |
public void commitChanges() throws DataException ; |
787 |
|
788 |
/**
|
789 |
*
|
790 |
* Returns true if you can call CommitChanges method.
|
791 |
* If not in editing or changes have been made in the structure
|
792 |
* return false.
|
793 |
*
|
794 |
* @return true if can call commitChanges
|
795 |
* @throws DataException
|
796 |
*/
|
797 |
public boolean canCommitChanges() throws DataException; |
798 |
|
799 |
|
800 |
/**
|
801 |
* Indicates whether this store is in editing state.
|
802 |
*
|
803 |
* @return
|
804 |
* true if this store is in editing state, false if not.
|
805 |
*/
|
806 |
public boolean isEditing(); |
807 |
|
808 |
/**
|
809 |
* Indicates whether this store is in appending state. In this state the new
|
810 |
* features are automatically inserted at the end of the {@link FeatureSet}.
|
811 |
*
|
812 |
* @return true if this store is in appending state.
|
813 |
*/
|
814 |
public boolean isAppending(); |
815 |
|
816 |
/**
|
817 |
* Updates a {@link FeatureType} in the store with the changes in the
|
818 |
* {@link EditableFeatureType}.<br>
|
819 |
*
|
820 |
* Any {@link FeatureSet} from this store that are used will be invalidated.
|
821 |
*
|
822 |
* @param featureType
|
823 |
* an {@link EditableFeatureType} with the changes.
|
824 |
*
|
825 |
* @throws DataException
|
826 |
*/
|
827 |
public void update(EditableFeatureType featureType) throws DataException; |
828 |
|
829 |
/**
|
830 |
* Updates a {@link Feature} in the store with the changes in the
|
831 |
* {@link EditableFeature}.<br>
|
832 |
*
|
833 |
* Any {@link FeatureSet} from this store that was still in use will be
|
834 |
* invalidated. You can override this using
|
835 |
* {@link FeatureSet#update(EditableFeature)}.
|
836 |
*
|
837 |
* @param feature
|
838 |
* the feature to be updated
|
839 |
*
|
840 |
* @throws DataException
|
841 |
*/
|
842 |
public void update(EditableFeature feature) throws DataException; |
843 |
|
844 |
public void update(Object... parameters) throws DataException; |
845 |
|
846 |
/**
|
847 |
* Deletes a {@link Feature} from the store.<br>
|
848 |
*
|
849 |
* Any {@link FeatureSet} from this store that was still in use will be
|
850 |
* invalidated. You can override this using {@link Iterator#remove()} from
|
851 |
* {@link FeatureSet}.
|
852 |
*
|
853 |
* @param feature
|
854 |
* The feature to be deleted.
|
855 |
*
|
856 |
* @throws DataException
|
857 |
*/
|
858 |
public void delete(Feature feature) throws DataException; |
859 |
|
860 |
public void delete(String filter); |
861 |
|
862 |
public void delete(Expression filter); |
863 |
|
864 |
/**
|
865 |
* Inserts a {@link Feature} in the store.<br>
|
866 |
*
|
867 |
* Any {@link FeatureSet} from this store that was still in use will be
|
868 |
* invalidated. You can override this using
|
869 |
* {@link FeatureSet#insert(EditableFeature)}.
|
870 |
*
|
871 |
* @param feature
|
872 |
* The feature to be inserted
|
873 |
*
|
874 |
* @throws DataException
|
875 |
*/
|
876 |
public void insert(EditableFeature feature) throws DataException; |
877 |
|
878 |
/**
|
879 |
* Inserts a set of {@link Feature} in the store.
|
880 |
*
|
881 |
* The attributes of the feature are copied from the features of the set
|
882 |
* by name, forcing the conversion of types if necessary.
|
883 |
*
|
884 |
* Any {@link FeatureSet} from this store that was still in use will be
|
885 |
* invalidated.
|
886 |
*
|
887 |
* @param set, set with the source features.
|
888 |
* @throws DataException
|
889 |
*/
|
890 |
public void insert(FeatureSet set) throws DataException; |
891 |
|
892 |
/**
|
893 |
* Creates a new feature using the default feature type and returns it as an
|
894 |
* {@link EditableFeature}
|
895 |
*
|
896 |
* @return a new feature in editable state
|
897 |
*
|
898 |
* @throws DataException
|
899 |
*/
|
900 |
public EditableFeature createNewFeature() throws DataException; |
901 |
|
902 |
/**
|
903 |
* Creates a new feature of the given {@link FeatureType} and uses the given
|
904 |
* {@link Feature} as default values to initialize it.
|
905 |
*
|
906 |
* @param type
|
907 |
* the new feature's feature type
|
908 |
*
|
909 |
* @param defaultValues
|
910 |
* a feature whose values are used as default values for the new
|
911 |
* feature.
|
912 |
*
|
913 |
* @return the new feature.
|
914 |
*
|
915 |
* @throws DataException
|
916 |
*/
|
917 |
public EditableFeature createNewFeature(FeatureType type,
|
918 |
Feature defaultValues) throws DataException;
|
919 |
|
920 |
/**
|
921 |
* Creates a new feature of the given {@link FeatureType}. The flag
|
922 |
* defaultValues is used to indicate whether the new feature should be
|
923 |
* initialized with default values or not.
|
924 |
*
|
925 |
* @param type
|
926 |
* the new feature's feature type
|
927 |
*
|
928 |
* @param defaultValues
|
929 |
* if true the new feature is initialized with each attribute's
|
930 |
* default value.
|
931 |
*
|
932 |
* @return
|
933 |
* the new feature
|
934 |
*
|
935 |
* @throws DataException
|
936 |
*/
|
937 |
public EditableFeature createNewFeature(FeatureType type,
|
938 |
boolean defaultValues) throws DataException; |
939 |
|
940 |
/**
|
941 |
* Creates a new feature of default {@link FeatureType}. The flag
|
942 |
* defaultValues is used to indicate whether the new feature should be
|
943 |
* initialized with default values or not.
|
944 |
*
|
945 |
* @param defaultValues
|
946 |
* if true the new feature is initialized with each attribute's
|
947 |
* default value.
|
948 |
*
|
949 |
* @return
|
950 |
* the new feature
|
951 |
*
|
952 |
* @throws DataException
|
953 |
*/
|
954 |
public EditableFeature createNewFeature(boolean defaultValues) |
955 |
throws DataException;
|
956 |
|
957 |
/**
|
958 |
* Creates a new feature of default {@link FeatureType}.
|
959 |
* The new feature should be initialized with the values of the feature
|
960 |
* passed as parameter.
|
961 |
* Values are inicialiced by name from the feature specified. Error in
|
962 |
* value assignement are ignoreds.
|
963 |
*
|
964 |
* @param defaultValues the values to initialize the new feature.
|
965 |
* @return the new feature
|
966 |
* @throws DataException
|
967 |
*/
|
968 |
public EditableFeature createNewFeature(Feature defaultValues)
|
969 |
throws DataException;
|
970 |
|
971 |
public EditableFeature createNewFeature(JsonObject defaultValues)
|
972 |
throws DataException;
|
973 |
|
974 |
/**
|
975 |
* Indicates whether this store supports append mode.
|
976 |
*
|
977 |
* @return
|
978 |
* true if this store supports append mode.
|
979 |
*/
|
980 |
public boolean isAppendModeSupported(); |
981 |
|
982 |
/**
|
983 |
* Initiates an editing group. This is typically used to group series of
|
984 |
* store editing operations.
|
985 |
*
|
986 |
* @param description
|
987 |
* Description of the editing group.
|
988 |
*
|
989 |
* @throws NeedEditingModeException
|
990 |
*/
|
991 |
public void beginEditingGroup(String description) |
992 |
throws NeedEditingModeException;
|
993 |
|
994 |
/**
|
995 |
* Finishes an editing group.
|
996 |
*
|
997 |
* @throws NeedEditingModeException
|
998 |
*/
|
999 |
public void endEditingGroup() throws NeedEditingModeException; |
1000 |
|
1001 |
/*
|
1002 |
* =============================================================
|
1003 |
*
|
1004 |
* Index related services
|
1005 |
*/
|
1006 |
|
1007 |
/**
|
1008 |
* Creates an index which will be applied to the features of the given type,
|
1009 |
* by using the data of the given attribute.
|
1010 |
*
|
1011 |
* @param featureType
|
1012 |
* The FeatureType to which the indexed attribute belongs.
|
1013 |
*
|
1014 |
* @param attributeName
|
1015 |
* The name of the attributed to be indexed
|
1016 |
*
|
1017 |
* @param indexName
|
1018 |
* The index name
|
1019 |
*
|
1020 |
* @return the resulting {@link FeatureIndex}
|
1021 |
*
|
1022 |
*
|
1023 |
* @throws FeatureIndexException
|
1024 |
* if there is an error creating the index
|
1025 |
*/
|
1026 |
public FeatureIndex createIndex(FeatureType featureType,
|
1027 |
String attributeName, String indexName) throws DataException; |
1028 |
|
1029 |
/**
|
1030 |
* Creates an index which will be applied to the features of the given type,
|
1031 |
* by using the data of the given attribute.
|
1032 |
*
|
1033 |
* @param indexTypeName
|
1034 |
* the type of the index to be created. That name is
|
1035 |
* related to one of the registered index providers
|
1036 |
* @param featureType
|
1037 |
* The FeatureType to which the indexed attribute belongs.
|
1038 |
*
|
1039 |
* @param attributeName
|
1040 |
* The name of the attributed to be indexed
|
1041 |
*
|
1042 |
* @param indexName
|
1043 |
* The index name
|
1044 |
*
|
1045 |
* @return the resulting {@link FeatureIndex}
|
1046 |
*
|
1047 |
*
|
1048 |
* @throws FeatureIndexException
|
1049 |
* if there is an error creating the index
|
1050 |
*/
|
1051 |
public FeatureIndex createIndex(String indexTypeName, |
1052 |
FeatureType featureType, String attributeName, String indexName) |
1053 |
throws DataException;
|
1054 |
|
1055 |
/**
|
1056 |
* Creates an index which will be applied to the features of the given type,
|
1057 |
* by using the data of the given attribute. This method will return without
|
1058 |
* waiting for the index to be filled, as that will be performed in
|
1059 |
* background. An optional {@link Observer} parameter is provided to be
|
1060 |
* notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
|
1061 |
* when the index has finished filling with data and is available to be
|
1062 |
* used.
|
1063 |
*
|
1064 |
* @param featureType
|
1065 |
* The FeatureType to which the indexed attribute belongs.
|
1066 |
*
|
1067 |
* @param attributeName
|
1068 |
* The name of the attributed to be indexed
|
1069 |
*
|
1070 |
* @param indexName
|
1071 |
* The index name
|
1072 |
*
|
1073 |
* @param observer
|
1074 |
* to notify to when the created index has finished filling
|
1075 |
* with data and is available to be used. The observer will
|
1076 |
* receive then a
|
1077 |
* {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
|
1078 |
* notification, with the index object if it has finished
|
1079 |
* successfully, or a
|
1080 |
* {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
|
1081 |
* notification with the exception object if there has been
|
1082 |
* any error in the process. Optional.
|
1083 |
*
|
1084 |
* @return the resulting {@link FeatureIndex}
|
1085 |
*
|
1086 |
* @see FeatureStoreNotification#INDEX_FILLING_STARTED
|
1087 |
* @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
|
1088 |
* @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
|
1089 |
* @see FeatureStoreNotification#INDEX_FILLING_ERROR
|
1090 |
*
|
1091 |
* @throws FeatureIndexException
|
1092 |
* if there is an error creating the index
|
1093 |
*/
|
1094 |
public FeatureIndex createIndex(FeatureType featureType,
|
1095 |
String attributeName, String indexName, Observer observer) |
1096 |
throws DataException;
|
1097 |
|
1098 |
/**
|
1099 |
* Creates an index which will be applied to the features of the given type,
|
1100 |
* by using the data of the given attribute. This method will return without
|
1101 |
* waiting for the index to be filled, as that will be performed in
|
1102 |
* background. An optional {@link Observer} parameter is provided to be
|
1103 |
* notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
|
1104 |
* when the index has finished filling with data and is available to be
|
1105 |
* used.
|
1106 |
*
|
1107 |
* @param indexTypeName
|
1108 |
* the type of the index to be created. That name is
|
1109 |
* related to one of the registered index providers
|
1110 |
* @param featureType
|
1111 |
* The FeatureType to which the indexed attribute belongs.
|
1112 |
*
|
1113 |
* @param attributeName
|
1114 |
* The name of the attributed to be indexed
|
1115 |
*
|
1116 |
* @param indexName
|
1117 |
* The index name
|
1118 |
*
|
1119 |
* @param observer
|
1120 |
* to notify to when the created index has finished filling
|
1121 |
* with data and is available to be used. The observer will
|
1122 |
* receive then a
|
1123 |
* {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
|
1124 |
* notification, with the index object if it has finished
|
1125 |
* successfully, or a
|
1126 |
* {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
|
1127 |
* notification with the exception object if there has been
|
1128 |
* any error in the process. Optional.
|
1129 |
*
|
1130 |
* @return the resulting {@link FeatureIndex}
|
1131 |
*
|
1132 |
* @see FeatureStoreNotification#INDEX_FILLING_STARTED
|
1133 |
* @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
|
1134 |
* @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
|
1135 |
* @see FeatureStoreNotification#INDEX_FILLING_ERROR
|
1136 |
*
|
1137 |
* @throws FeatureIndexException
|
1138 |
* if there is an error creating the index
|
1139 |
*/
|
1140 |
public FeatureIndex createIndex(String indexTypeName, |
1141 |
FeatureType featureType, String attributeName, String indexName, |
1142 |
Observer observer) throws DataException; |
1143 |
|
1144 |
/**
|
1145 |
* Returns a FeatureIndexes structure containing all available indexes in
|
1146 |
* the store.
|
1147 |
*
|
1148 |
* @return
|
1149 |
*/
|
1150 |
public FeatureIndexes getIndexes();
|
1151 |
|
1152 |
/*
|
1153 |
* =============================================================
|
1154 |
*
|
1155 |
* Selection related services
|
1156 |
*/
|
1157 |
|
1158 |
/**
|
1159 |
* Sets the selection to the passed {@link FeatureSet}
|
1160 |
*
|
1161 |
* @param selection
|
1162 |
* A {@link FeatureSet} with the requested selection
|
1163 |
* @throws org.gvsig.fmap.dal.exception.DataException
|
1164 |
*/
|
1165 |
public void setSelection(FeatureSet selection) throws DataException; |
1166 |
|
1167 |
/**
|
1168 |
* Creates a {@link FeatureSelection}
|
1169 |
*
|
1170 |
* @return
|
1171 |
* a {@link FeatureSelection}
|
1172 |
*
|
1173 |
* @throws DataException
|
1174 |
*/
|
1175 |
public FeatureSelection createFeatureSelection() throws DataException; |
1176 |
|
1177 |
public FeatureSelection createLargeFeatureSelection() throws DataException; |
1178 |
|
1179 |
/**
|
1180 |
* Creates a {@link FeatureSelection}
|
1181 |
*
|
1182 |
* @return
|
1183 |
* a {@link FeatureSelection}
|
1184 |
*
|
1185 |
* @throws DataException
|
1186 |
*/
|
1187 |
public FeatureSelection createMemoryFeatureSelection() throws DataException; |
1188 |
|
1189 |
|
1190 |
/**
|
1191 |
* Returns the current {@link FeatureSelection}.
|
1192 |
* Create a empty selection if not exits.
|
1193 |
*
|
1194 |
* Manage of the selection can be slow on some data sources.
|
1195 |
* Use with care.
|
1196 |
* In data sources that do not support position access to records,
|
1197 |
* it may be slow to retrieve items from the selection. In some data
|
1198 |
* sources it may be necessary to access to this to retrieve each
|
1199 |
* item in the selection.
|
1200 |
*
|
1201 |
* @return
|
1202 |
* current {@link FeatureSelection}.
|
1203 |
*
|
1204 |
* @throws DataException
|
1205 |
*/
|
1206 |
public FeatureSelection getFeatureSelection() throws DataException; |
1207 |
|
1208 |
/*
|
1209 |
* =============================================================
|
1210 |
*
|
1211 |
* Lock related services
|
1212 |
*/
|
1213 |
|
1214 |
/**
|
1215 |
* Indicates whether this store supports locks.
|
1216 |
*
|
1217 |
* @return
|
1218 |
* true if this store supports locks, false if not.
|
1219 |
*/
|
1220 |
public boolean isLocksSupported(); |
1221 |
|
1222 |
/**
|
1223 |
* Returns the set of locked features
|
1224 |
*
|
1225 |
* @return
|
1226 |
* set of locked features
|
1227 |
*
|
1228 |
* @throws DataException
|
1229 |
*/
|
1230 |
public FeatureLocks getLocks() throws DataException; |
1231 |
|
1232 |
/*
|
1233 |
* =============================================================
|
1234 |
* Transforms related services
|
1235 |
* =============================================================
|
1236 |
*/
|
1237 |
|
1238 |
/**
|
1239 |
* Returns this store transforms
|
1240 |
*
|
1241 |
* @return
|
1242 |
* this store transforms
|
1243 |
*/
|
1244 |
public FeatureStoreTransforms getTransforms();
|
1245 |
|
1246 |
/**
|
1247 |
* Returns a new {@link FeatureQuery} associated to this store.
|
1248 |
*
|
1249 |
* @return
|
1250 |
* a new {@link FeatureQuery} associated to this store.
|
1251 |
*/
|
1252 |
public FeatureQuery createFeatureQuery();
|
1253 |
|
1254 |
/**
|
1255 |
* Returns featue count of this store.
|
1256 |
*
|
1257 |
* @return
|
1258 |
* @throws DataException
|
1259 |
*/
|
1260 |
public long getFeatureCount() throws DataException; |
1261 |
|
1262 |
// /**
|
1263 |
// * Creates a vectorial cache that is used to save and retrieve data.
|
1264 |
// *
|
1265 |
// * @param name
|
1266 |
// * the cache name.
|
1267 |
// * @param parameters
|
1268 |
// * parameters to create the stores used to save data.
|
1269 |
// * @throws DataException
|
1270 |
// */
|
1271 |
// public void createCache(String name, DynObject parameters)
|
1272 |
// throws DataException;
|
1273 |
//
|
1274 |
// /**
|
1275 |
// * @return the vectorial cache
|
1276 |
// */
|
1277 |
// public FeatureCache getCache();
|
1278 |
|
1279 |
/**
|
1280 |
* Return if the provider knows the real envelope of a layer. If not,
|
1281 |
* the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
|
1282 |
* the full envelope.
|
1283 |
*
|
1284 |
* @return true if it knows the real envelope.
|
1285 |
*/
|
1286 |
public boolean isKnownEnvelope(); |
1287 |
|
1288 |
/**
|
1289 |
* Return if the maximum number of features provided by the
|
1290 |
* provider are limited.
|
1291 |
*
|
1292 |
* @return true if there is a limit of features.
|
1293 |
*/
|
1294 |
public boolean hasRetrievedFeaturesLimit(); |
1295 |
|
1296 |
/**
|
1297 |
* If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns
|
1298 |
* true,
|
1299 |
* it returns the limit of features retrieved from the provider.
|
1300 |
*
|
1301 |
* @return
|
1302 |
* The limit of the retrieved features.
|
1303 |
*/
|
1304 |
public int getRetrievedFeaturesLimit(); |
1305 |
|
1306 |
/**
|
1307 |
* Return the associated feature to the dynobject.
|
1308 |
* If the dynobject isn't associated to a feature of this store, return null.
|
1309 |
*
|
1310 |
* @param dynobject
|
1311 |
* @return
|
1312 |
*/
|
1313 |
public Feature getFeature(DynObject dynobject);
|
1314 |
|
1315 |
|
1316 |
public ExpressionBuilder createExpressionBuilder();
|
1317 |
|
1318 |
/**
|
1319 |
*
|
1320 |
* @return
|
1321 |
* @deprecated use createExpressionBuilder
|
1322 |
*/
|
1323 |
public ExpressionBuilder createExpression();
|
1324 |
|
1325 |
public void createCache(String name, DynObject parameters) |
1326 |
throws DataException;
|
1327 |
|
1328 |
@Override
|
1329 |
public FeatureCache getCache();
|
1330 |
|
1331 |
public boolean isBroken(); |
1332 |
|
1333 |
public Throwable getBreakingsCause(); |
1334 |
|
1335 |
/**
|
1336 |
* Indicates if the storage is temporary.
|
1337 |
* There is no guarantee that a temporary store can be recovered from
|
1338 |
* its parameters. In general these will not be persistent.
|
1339 |
*
|
1340 |
* @return true if the store is temporary, otherwise false.
|
1341 |
*/
|
1342 |
public boolean isTemporary(); |
1343 |
|
1344 |
/**
|
1345 |
* @param index
|
1346 |
* @return
|
1347 |
*/
|
1348 |
public SpatialIndex wrapSpatialIndex(SpatialIndex index);
|
1349 |
|
1350 |
public FeatureReference getFeatureReference(String code); |
1351 |
|
1352 |
/**
|
1353 |
* Devuelbe el numero de operaciones pendientes de guardar en una sesion
|
1354 |
* de edicion. Es un valor orientativo.
|
1355 |
* Las operaciones pendientes son la suma de operaciones de borrado, insercion
|
1356 |
* o modificacion de las features en una sesion de edicion.
|
1357 |
*
|
1358 |
* Retorna 0 si no esta en edicion.
|
1359 |
*
|
1360 |
* @return numero de operaciones pendientes.
|
1361 |
*/
|
1362 |
public long getPendingChangesCount(); |
1363 |
|
1364 |
public Feature getSampleFeature();
|
1365 |
|
1366 |
/**
|
1367 |
* Return true when the default feature type of the store
|
1368 |
* support references.
|
1369 |
*
|
1370 |
* @return true when support references.
|
1371 |
*/
|
1372 |
public boolean supportReferences(); |
1373 |
|
1374 |
public Feature getOriginalFeature(FeatureReference id);
|
1375 |
|
1376 |
public Feature getOriginalFeature(Feature feature);
|
1377 |
|
1378 |
public boolean isFeatureModified(FeatureReference id); |
1379 |
|
1380 |
public boolean isFeatureModified(Feature feature); |
1381 |
|
1382 |
public String getEditingSession(); |
1383 |
} |