Statistics
| Revision:

svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.api / src / main / java / org / gvsig / fmap / dal / feature / FeatureStore.java @ 45521

History | View | Annotate | Download (50.3 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.GetItemWithSizeAndIterator64;
50
import org.gvsig.tools.util.GetItemWithSizeIsEmptyAndIterator64;
51
import org.gvsig.tools.util.PropertiesSupport;
52
import org.gvsig.tools.util.Size64;
53
import org.gvsig.tools.util.UnmodifiableBasicList64;
54

    
55
/**
56
 * <p>
57
 * A FeatureStore is a type of store whose data consists on sets of
58
 * {@link Feature}(s). {@link Feature}(s) from the same FeatureStore can be of
59
 * different {@link FeatureType}(s) (as in GML format for instance).
60
 * </p>
61
 *
62
 * <p>
63
 * FeatureStore allows:
64
 * </p>
65
 * <ul>
66
 * <li>Obtaining the default {@link FeatureType}. A FeatureStore always has one
67
 * and only one default FeatureType.
68
 * <li>Obtaining the list of {@link FeatureType}(s) defined in the FeatureStore.
69
 * <li>Obtaining, filtering and sorting subsets of data ({@link FeatureSet})
70
 * through {@link FeatureQuery}, as well as background loading.
71
 * <li>Obtaining the total {@link Envelope} (AKA bounding box or extent) of the
72
 * store.
73
 * <li>Support for editing {@link FeatureType}(s).
74
 * <li>Obtaining information about contained {@link Geometry} types.
75
 * <li>Exporting to another store.
76
 * <li>Indexing.
77
 * <li>Selection.
78
 * <li>Locks management.
79
 * </ul>
80
 *
81
 */
82
public interface FeatureStore extends 
83
        DataStore, UndoRedoStack, Cloneable, Iterable<Feature>, 
84
        PropertiesSupport,
85
        Size64 {
86

    
87
    public static final String METADATA_DEFINITION_NAME = "FeatureStore";
88

    
89
    /** Indicates that this store is in query mode */
90
    final static int MODE_QUERY = 0;
91

    
92
    /** Indicates that this store is in full edit mode */
93
    final static int MODE_FULLEDIT = 1;
94

    
95
    /** Indicates that this store is in append mode */
96
    final static int MODE_APPEND = 2;
97
    
98
    final static int MODE_PASS_THROUGH = 3;
99

    
100
    /*
101
     * =============================================================
102
     *
103
     * information related services
104
     */
105

    
106
    /**
107
     * Indicates whether this store allows writing.
108
     *
109
     * @return
110
     *         true if this store can be written, false if not.
111
     */
112
    public boolean allowWrite();
113

    
114
    /**
115
     * Returns this store's default {@link FeatureType}.
116
     *
117
     * @return
118
     *         this store's default {@link FeatureType}.
119
     *
120
     * @throws DataException
121
     */
122
    public FeatureType getDefaultFeatureType() throws DataException;
123
    
124
    public FeatureType getDefaultFeatureTypeQuietly();
125

    
126
    /**
127
     * Returns this store's featureType {@link FeatureType} matches with
128
     * featureTypeId.
129
     *
130
     * @param featureTypeId
131
     *
132
     * @return this store's default {@link FeatureType}.
133
     *
134
     * @throws DataException
135
     */
136
    public FeatureType getFeatureType(String featureTypeId)
137
        throws DataException;
138

    
139
    /**
140
     * Returns this store's {@link FeatureType}(s).
141
     *
142
     * @return a list with this store's {@link FeatureType}(s).
143
     *
144
     * @throws DataException
145
     */
146
    public List getFeatureTypes() throws DataException;
147

    
148
    /**
149
     * Returns this store's parameters.
150
     *
151
     * @return
152
     *         {@link DataStoreParameters} containing this store's parameters
153
     */
154
    public DataStoreParameters getParameters();
155

    
156
    /**
157
     * @param gvSIGgeometryType
158
     * @return 
159
     * @throws DataException
160
     * @deprecated Mirar de cambiarlo a metadatos
161
     */
162
    public boolean canWriteGeometry(int gvSIGgeometryType) throws DataException;
163

    
164
    /**
165
     * Returns this store's total envelope (extent).
166
     *
167
     * @return this store's total envelope (extent) or <code>null</code> if
168
     *         store not have geometry information
169
     * @throws org.gvsig.fmap.dal.exception.DataException
170
     */
171
    public Envelope getEnvelope() throws DataException;
172

    
173
    /**
174
     *
175
     * @deprecated use getDefaultFeatureType().getDefaultSRS()
176
     * @return
177
     * @throws DataException
178
     */
179
    public IProjection getSRSDefaultGeometry() throws DataException;
180

    
181
    /**
182
     * Exports this store to another store.
183
     *
184
     * @param explorer
185
     *            {@link DataServerExplorer} target
186
     * @param provider
187
     * @param params
188
     *            New parameters of this store that will be used on the target
189
     *            explorer
190
     *
191
     * @throws DataException
192
     *
193
     * @Deprecated this method is unstable
194
     */
195
    public void export(DataServerExplorer explorer, String provider,
196
        NewFeatureStoreParameters params, String name) throws DataException;
197

    
198
    public void copyTo(FeatureStore target);
199

    
200
    /*
201
     * =============================================================
202
     *
203
     * Query related services
204
     */
205
    
206
    /** 
207
     * Create a {@link FeatureQuery} with the restrictions indicateds.
208
     * 
209
     * "filter" will be null or a valid filter expression for the store.
210
     * 
211
     * "sortBy" can be null to use the store's default order.
212
     * 
213
     * The parameter sortBy can be an attribute name or a comma separated list. 
214
     * Each attribute name can be preceded or followed by "+" or "-" to indicate 
215
     * the order to use to sort by that attribute. 
216
     * 
217
     * If no "+" or "-" is indicated, the "asc" parameter will be used to 
218
     * determine if the order is ascending, "true" or decent, "false".
219
     * 
220
     * @param filter an {@link String} expression used to filter the features in the store.
221
     * @param sortBy Attribute names separated by commas used to sort the list to return.
222
     * @param asc use order ascending, true, or descending, false.
223
     * @return a {@link FeatureQuery} with the restrictions.
224
     * @see {@link FeatureQuery}
225
     */
226
    public FeatureQuery createFeatureQuery(String filter, String sortBy, boolean asc);
227
    public FeatureQuery createFeatureQuery(String filter);
228
    public FeatureQuery createFeatureQuery(Expression filter);
229

    
230
    /** 
231
     * Create a {@link FeatureQuery} with the restrictions indicateds.
232
     * 
233
     * "filter" will be null or {@link Expression} valid for the store.
234
     * 
235
     * "sortBy" can be null to use the store's default order.
236
     * 
237
     * The parameter sortBy can be an attribute name or a comma separated list. 
238
     * Each attribute name can be preceded or followed by "+" or "-" to indicate 
239
     * the order to use to sort by that attribute. 
240
     * 
241
     * If no "+" or "-" is indicated, the "asc" parameter will be used to 
242
     * determine if the order is ascending, "true" or decent, "false".
243
     * 
244
     * @param filter an {@link String} expression used to filter the features in the store.
245
     * @param sortBy Attribute names separated by commas used to sort the list to return.
246
     * @param asc use order ascending, true, or descending, false.
247
     * @return a {@link FeatureQuery} with the restrictions.
248
     * @see {@link FeatureQuery}
249
     */
250
    public FeatureQuery createFeatureQuery(Expression filter, String sortBy, boolean asc);
251
        
252
    /** 
253
     * Create a {@link FeatureQuery} with the restrictions indicateds.
254
     * 
255
     * "filter" will be null or {@link Expression} valid for the store.
256
     * 
257
     * "sortBy" can be null to use the store's default order.
258
     * 
259
     * The parameter sortBy can be an attribute name or a comma separated list. 
260
     * Each attribute name can be preceded or followed by "+" or "-" to indicate 
261
     * the order to use to sort by that attribute. 
262
     * 
263
     * If no "+" or "-" is indicated, the "asc" parameter will be used to 
264
     * determine if the order is ascending, "true" or decent, "false".
265
     * 
266
     * @param filter an {@link String} expression used to filter the features in the store.
267
     * @param sortBy expression used to order the features in the store.
268
     * @param asc use order ascending, true, or descending, false.
269
     * @return a {@link FeatureQuery} with the restrictions.
270
     * @see {@link FeatureQuery}
271
     */
272
    public FeatureQuery createFeatureQuery(Expression filter, Expression sortBy, boolean asc);
273
    
274
    /** 
275
     * Create a {@link FeatureQuery} with the restrictions indicateds.
276
     * 
277
     * "filter" will be null or {@link Expression} valid for the store.
278
     * 
279
     * "sortBy" can be null to use the store's default order.
280
     * 
281
     * The parameter sortBy can be an attribute name or a comma separated list. 
282
     * Each attribute name can be preceded or followed by "+" or "-" to indicate 
283
     * the order to use to sort by that attribute. 
284
     * 
285
     * If no "+" or "-" is indicated, the "asc" parameter will be used to 
286
     * determine if the order is ascending, "true" or decent, "false".
287
     * 
288
     * @param filter an {@link String} expression used to filter the features in the store.
289
     * @param sortBy expression used to order the features in the store.
290
     * @param asc use order ascending, true, or descending, false.
291
     * @return a {@link FeatureQuery} with the restrictions.
292
     * @see {@link FeatureQuery}
293
     */
294
    public FeatureQuery createFeatureQuery(String filter, Expression sortBy, boolean asc);
295

    
296
    
297
    
298
    /**
299
     * Returns all available features in the store.
300
     *
301
     * It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
302
     * 
303
     * @return the {@link FeatureSet} 
304
     * @throws ReadException if there is any error while reading the features
305
     * @see {@link #accept(org.gvsig.tools.visitor.Visitor)}, {@link #getFeatureSet(FeatureQuery)}
306
     */
307
    FeatureSet getFeatureSet() throws DataException;
308

    
309
    /**
310
     * Return a subset of features.
311
     * 
312
     * It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
313
     * 
314
     * @param filter an {@link String} expression used to filter the features in the store.
315
     * @return the {@link FeatureSet} 
316
     * @throws ReadException if there is any error while reading the features
317
     * @see {@link #createFeatureQuery(Expression,String,boolean)}, {@link #getFeatureSet(FeatureQuery)}
318
     */
319
    FeatureSet getFeatureSet(String filter) throws DataException;
320

    
321
    /**
322
     * Return a subset of features.
323
     * 
324
     * It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
325
     * 
326
     * The sort order used is ascending.
327
     * 
328
     * @param filter an {@link String} expression used to filter the features in the store.
329
     * @param sortBy Attribute names separated by commas used to sort the list to return.
330
     * @return the {@link FeatureSet} 
331
     * @throws ReadException if there is any error while reading the features
332
     * @see {@link #createFeatureQuery(Expression,String,boolean)}, {@link #getFeatureSet(FeatureQuery)}
333
     */
334
    FeatureSet getFeatureSet(String filter, String sortBy) throws DataException;
335

    
336
    /**
337
     * Return a subset of features.
338
     * 
339
     * It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
340
     * 
341
     * @param filter an {@link String} expression used to filter the features in the store.
342
     * @param sortBy Attribute names separated by commas used to sort the list to return.
343
     * @param asc use order ascending, true, or descending, false.
344
     * @return the {@link FeatureSet} 
345
     * @throws ReadException if there is any error while reading the features
346
     * @see {@link #createFeatureQuery(Expression,String,boolean)}, {@link #getFeatureSet(FeatureQuery)}
347
     */
348
    FeatureSet getFeatureSet(String filter, String sortBy, boolean asc) throws DataException;
349

    
350
    /**
351
     * Return a subset of features.
352
     * 
353
     * It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
354
     * 
355
     * @param filter an {@link Expression} used to filter the features in the store.
356
     * @return the {@link FeatureSet} 
357
     * @throws DataException 
358
     * @see {@link #createFeatureQuery(Expression,String,boolean)}, {@link #getFeatureSet(FeatureQuery)}
359
     */
360
    FeatureSet getFeatureSet(Expression filter) throws DataException;
361

    
362
    /**
363
     * Return a subset of features.
364
     * 
365
     * It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
366
     * 
367
     * The sort order used is ascending.
368
     * 
369
     * @param filter an {@link Expression} used to filter the features in the store.
370
     * @param sortBy Attribute names separated by commas used to sort the list to return.
371
     * @return the {@link FeatureSet} 
372
     * @throws ReadException if there is any error while reading the features
373
     * @see {@link #createFeatureQuery(Expression,String,boolean)}, {@link #getFeatureSet(FeatureQuery)}
374
     */
375
    FeatureSet getFeatureSet(Expression filter, String sortBy) throws DataException;
376

    
377
    /**
378
     * Return a subset of features.
379
     * 
380
     * It is a utility method that calls {@link #getFeatureSet(FeatureQuery)}
381
     * 
382
     * @param filter an {@link Expression} used to filter the features in the store.
383
     * @param sortBy Attribute names separated by commas used to sort the list to return.
384
     * @param asc use order ascending, true, or descending, false.
385
     * @return the {@link FeatureSet} 
386
     * @throws DataException 
387
     * @see {@link #createFeatureQuery(Expression,String,boolean)}, {@link #getFeatureSet(FeatureQuery)}
388
     */
389
    FeatureSet getFeatureSet(Expression filter, String sortBy, boolean asc) throws DataException;
390

    
391
    /**
392
     * Returns a subset of features taking into account the properties and
393
     * restrictions of the {@link FeatureQuery}.
394
     * 
395
     * If {@link FeatureQuery} is null, return al features in the store.
396
     * 
397
     * <p>
398
     * <em>
399
     * <strong>NOTE:</strong> if you use this method to get a
400
     * {@link FeatureSet}, you  must get sure it is disposed
401
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an
402
     * error occurs while getting the data. It is recommended to use the
403
     * <code>accept</code> methods instead, which handle everything for you.
404
     * Take into account the accept methods may use a fast iterator to
405
     * get the features.
406
     * </em>
407
     * </p>
408
     *
409
     * @param featureQuery defines the characteristics of the features to return.
410
     * @return the {@link FeatureSet} 
411
     * @throws ReadException if there is any error while reading the features.
412
     * @see #accept(org.gvsig.tools.visitor.Visitor, org.gvsig.fmap.dal.DataQuery)
413
     */
414
    FeatureSet getFeatureSet(FeatureQuery featureQuery) throws DataException;
415

    
416
    /**
417
     * Loads a subset of features taking into account the properties and
418
     * restrictions of the FeatureQuery. 
419
     * When feature loading is finished call the Observer passing the
420
     * {@link FeatureSet}  loaded.
421
     *
422
     * @param featureQuery defines the characteristics of the features to return.
423
     * @param observer to be notified when loading is finished.
424
     * @throws DataException if there is any error while loading the features
425
     */
426
    void getFeatureSet(FeatureQuery featureQuery, Observer observer) throws DataException;
427

    
428
    /**
429
     * Loads all available feature in the store. The loading of Features is
430
     * performed by calling the Observer, once each loaded Feature.
431
     *
432
     * @param observer to be notified of each loaded Feature
433
     * @throws DataException if there is any error while loading the features
434
     */
435
    void getFeatureSet(Observer observer) throws DataException;
436

    
437
    /**
438
     * Return a paginated list of Features filtered by the query.
439
     * 
440
     * If the query  is null, return all features in the store sorteds 
441
     * by default order.
442
     * 
443
     * The return value implements {@link List} and {@link UnmodifiableBasicList64} 
444
     * to support large list of features.
445
     * 
446
     * The returned list of Features is paginated, and the page size
447
     * used is "pageSize". 
448
     * 
449
     * If the page size is less than or equal to 0, the default page size of 
450
     * 100 will be used.
451
     *
452
     * @param query to filter and sort the returned feature list
453
     * @param pageSize the page size of the list
454
     * @return the {@link List}/{@link UnmodifiableBasicList64} of features
455
     */
456
    public List<Feature> getFeatures(FeatureQuery query, int pageSize);
457

    
458
    /**
459
     * Return a paginated list of Features.
460
     * 
461
     * It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
462
     * using the default page size.
463
     * 
464
     * @param query to filter and sort the returned feature list
465
     * @return the {@link List}/{@link UnmodifiableBasicList64} of features
466
     * @see {@link #getFeatures(FeatureQuery, int)}
467
     */
468
    public List<Feature> getFeatures(FeatureQuery query);
469

    
470
    /**
471
     * Return a paginated list with al Features in the store.
472
     * 
473
     * It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
474
     * using the default page size.
475
     * 
476
     * @return the {@link List}/{@link UnmodifiableBasicList64} of features
477
     * @see {@link #getFeatures(FeatureQuery, int)}
478
     */
479
    public List<Feature> getFeatures();
480

    
481
    /**
482
     * Return a paginated list of Features
483
     * 
484
     * It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
485
     * 
486
     * @param filter used to filter the features in the store.
487
     * @return the List of Features
488
     * @see {@link #getFeatures(FeatureQuery, int)}, {@link #createFeatureQuery(String,String,boolean)}
489
     */
490
    public List<Feature> getFeatures(String filter);
491

    
492
    /**
493
     * Return a paginated list of Features.
494
     * 
495
     * It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
496
     * using the default page size.
497
     * 
498
     * @param filter used to filter the features in the store.
499
     * @param sortBy Attribute names separated by commas used to sort the list to return.
500
     * @return the {@link List}/{@link UnmodifiableBasicList64} of features
501
     * @see {@link #getFeatures(FeatureQuery, int)}, {@link #createFeatureQuery(String,String,boolean)}
502
     */
503
    public List<Feature> getFeatures(String filter, String sortBy);
504

    
505
    /**
506
     * Return a paginated list of Features.
507
     *  
508
     * It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
509
     * using the default page size.
510
     * 
511
     * @param filter an {@link String} expression used to filter the features in the store.
512
     * @param sortBy Attribute names separated by commas used to sort the list to return.
513
     * @param asc use order ascending, true, or descending, false.
514
     * @return the {@link List}/{@link UnmodifiableBasicList64} of features
515
     * @see {@link #getFeatures(FeatureQuery, int)}, {@link #createFeatureQuery(String,String,boolean)}
516
     */
517
    public List<Feature> getFeatures(String filter, String sortBy, boolean asc);
518

    
519
    /**
520
     * Return a paginated list of Features
521
     * 
522
     * It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
523
     * using the default page size.
524
     * 
525
     * @param filter an {@link Expression} used to filter the features in the store.
526
     * @return the List of Features
527
     * @see {@link #getFeatures(FeatureQuery, int)}, {@link #createFeatureQuery(Expression,String,boolean)}
528
     */
529
    public List<Feature> getFeatures(Expression filter);
530

    
531
    /**
532
     * Return a paginated list of Features
533
     * 
534
     * It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
535
     * using the default page size.
536
     * 
537
     * @param filter an {@link Expression} used to filter the features in the store.
538
     * @param sortBy Attribute names separated by commas used to sort the list to return.
539
     * @return the {@link List}/{@link UnmodifiableBasicList64} of features
540
     * @see {@link #getFeatures(FeatureQuery, int)}, {@link #createFeatureQuery(Expression,String,boolean)}
541
     */
542
    public List<Feature> getFeatures(Expression filter, String sortBy);
543

    
544
    /**
545
     * Return a paginated list of Features
546
     * 
547
     * It is a utility method that calls {@link #getFeatures(FeatureQuery, int)}
548
     * using the default page size.
549
     * 
550
     * @param filter an {@link Expression} used to filter the features in the store.
551
     * @param sortBy Attribute names separated by commas used to sort the list to return.
552
     * @param asc use order ascending, true, or descending, false.
553
     * @return the {@link List}/{@link UnmodifiableBasicList64} of features
554
     * @see {@link #getFeatures(FeatureQuery, int)}, {@link #createFeatureQuery(Expression,String,boolean)}
555
     */
556
    public List<Feature> getFeatures(Expression filter, String sortBy, boolean asc);
557

    
558
    public GetItemWithSizeIsEmptyAndIterator64<Feature> getFeatures64();
559

    
560
    public GetItemWithSizeIsEmptyAndIterator64<Feature> getFeatures64(String filter);
561
    
562
    public GetItemWithSizeIsEmptyAndIterator64<Feature> getFeatures64(String filter, String sortBy, boolean asc);
563
    
564
    public GetItemWithSizeIsEmptyAndIterator64<Feature> getFeatures64(FeatureQuery query, int pageSize);
565
    
566
    /**
567
     * Return the first {@link Feature} of the store.
568
     * 
569
     * @return the first {@link Feature} or null if the store is empty.
570
     * @throws DataException 
571
     */
572
    public Feature first() throws DataException;
573

    
574
    /**
575
     * Returns the first {@link Feature} that meets the criteria indicated.
576
     * 
577
     * It is a utility method that calls {@link #findFirst(FeatureQuery)}.
578
     * 
579
     * @param filter {@link String} expression used to filter the features.
580
     * @return the first {@link Feature} or null if the filter don't return any feature.
581
     * @throws DataException 
582
     * @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(String,String,boolean)}
583
     */
584
    public Feature findFirst(String filter) throws DataException;
585

    
586
    /**
587
     * Returns the first {@link Feature} that meets the criteria indicated.
588
     * 
589
     * It is a utility method that calls {@link #findFirst(FeatureQuery)}.
590
     * 
591
     * @param filter {@link String} expression used to filter the features.
592
     * @param sortBy Attribute names separated by commas used to sort the list to return.
593
     * @return the first {@link Feature} or null if the filter don't return any feature.
594
     * @throws DataException 
595
     * @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(String,String,boolean)}
596
     */
597
    public Feature findFirst(String filter, String sortBy) throws DataException;
598

    
599
    /**
600
     * Returns the first {@link Feature} that meets the criteria indicated.
601
     * 
602
     * It is a utility method that calls {@link #findFirst(FeatureQuery)}.
603
     * 
604
     * @param filter {@link String} expression used to filter the features.
605
     * @param sortBy Attribute names separated by commas used to sort the list to return.
606
     * @param asc use order ascending, true, or descending, false.
607
     * @return the first {@link Feature} or null if the filter don't return any feature.
608
     * @throws DataException 
609
     * @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(String,String,boolean)}
610
     */
611
    public Feature findFirst(String filter, String sortBy, boolean asc) throws DataException;
612

    
613
    
614
    /**
615
     * Returns the first {@link Feature} that meets the criteria indicated.
616
     * 
617
     * It is a utility method that calls {@link #findFirst(FeatureQuery)}.
618
     * 
619
     * @param filter {@link String} expression used to filter the features.
620
     * @param sortBy Expression
621
     * @param asc use order ascending, true, or descending, false.
622
     * @return the first {@link Feature} or null if the filter don't return any feature.
623
     * @throws DataException 
624
     * @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(String,String,boolean)}
625
     */
626
    public Feature findFirst(String filter, Expression sortBy, boolean asc) throws DataException;
627

    
628
    /**
629
     * Returns the first {@link Feature} that meets the criteria indicated.
630
     * 
631
     * It is a utility method that calls {@link #findFirst(FeatureQuery)}.
632
     * 
633
     * @param filter {@link String} expression used to filter the features.
634
     * @return the first {@link Feature} or null if the filter don't return any feature.
635
     * @throws DataException 
636
     * @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(Expession,String,boolean)}
637
     */
638
    public Feature findFirst(Expression filter) throws DataException;
639

    
640
    /**
641
     * Returns the first {@link Feature} that meets the criteria indicated.
642
     * 
643
     * It is a utility method that calls {@link #findFirst(FeatureQuery)}.
644
     * 
645
     * @param filter {@link String} expression used to filter the features.
646
     * @param sortBy Attribute names separated by commas used to sort the list to return.
647
     * @return the first {@link Feature} or null if the filter don't return any feature.
648
     * @throws DataException 
649
     * @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(Expession,String,boolean)}
650
     */
651
    public Feature findFirst(Expression filter, String sortBy) throws DataException;
652

    
653
    /**
654
     * Returns the first {@link Feature} that meets the criteria indicated.
655
     * 
656
     * It is a utility method that calls {@link #findFirst(FeatureQuery)}.
657
     * 
658
     * @param filter {@link String} expression used to filter the features.
659
     * @param sortBy Attribute names separated by commas used to sort the list to return.
660
     * @param asc use order ascending, true, or descending, false.
661
     * @return the first {@link Feature} or null if the filter don't return any feature.
662
     * @throws DataException 
663
     * @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(Expession,String,boolean)}
664
     */
665
    public Feature findFirst(Expression filter, String sortBy, boolean asc) throws DataException;
666

    
667
    /**
668
     * Returns the first {@link Feature} that meets the criteria indicated.
669
     * 
670
     * It is a utility method that calls {@link #findFirst(FeatureQuery)}.
671
     * 
672
     * @param filter {@link String} expression used to filter the features.
673
     * @param sortBy expression used to sort features
674
     * @param asc use order ascending, true, or descending, false.
675
     * @return the first {@link Feature} or null if the filter don't return any feature.
676
     * @throws DataException 
677
     * @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(Expession,String,boolean)}
678
     */
679
    public Feature findFirst(Expression filter, Expression sortBy, boolean asc) throws DataException;
680

    
681
    /**
682
     * Returns the first {@link Feature} that meets the criteria indicated.
683
     * 
684
     * It is a utility method that calls {@link #findFirst(FeatureQuery)}.
685
     * 
686
     * @param query to filter and sort the returned feature list
687
     * @return the first {@link Feature} or null if the filter don't return any feature.
688
     * @throws DataException 
689
     * @see {@link #findFirst(FeatureQuery)}, {@link #createFeatureQuery(Expession,String,boolean)}
690
     */
691
    public Feature findFirst(FeatureQuery query) throws DataException;
692

    
693
    /**
694
     * Returns the feature given its reference.
695
     *
696
     * @param reference a unique FeatureReference
697
     * @return 
698
     * @returnThe Feature
699
     * @throws DataException
700
     *
701
     */
702
    public Feature getFeatureByReference(FeatureReference reference) throws DataException;
703

    
704
    /**
705
     * Returns the feature given its reference and feature type.
706
     *
707
     * @param reference
708
     *            a unique FeatureReference
709
     *
710
     * @param featureType
711
     *            FeatureType to which the requested Feature belongs
712
     *
713
     * @return
714
     *         The Feature
715
     *
716
     * @throws DataException
717
     *
718
     */
719
    public Feature getFeatureByReference(FeatureReference reference,
720
        FeatureType featureType) throws DataException;
721

    
722
    /*
723
     * =============================================================
724
     *
725
     * Editing related services
726
     */
727

    
728
    /**
729
     * Enters editing state.
730
     * @throws org.gvsig.fmap.dal.exception.DataException
731
     */
732
    public void edit() throws DataException;
733

    
734
    /**
735
     * Enters editing state specifying the editing mode.
736
     *
737
     * @param mode
738
     *
739
     * @throws DataException
740
     */
741
    public void edit(int mode) throws DataException;
742
    
743
    public int getMode();
744

    
745
    /**
746
     * Cancels all editing since the last edit().
747
     *
748
     * @throws DataException
749
     */
750
    public void cancelEditing() throws DataException;
751

    
752
    public boolean cancelEditingQuietly();
753

    
754
    public static boolean cancelEditingQuietly(FeatureStore store) {
755
        if( store==null ) {
756
            return true;
757
        }
758
        return store.cancelEditingQuietly();
759
    }
760
    
761
    /**
762
     * Exits editing state.
763
     *
764
     * @throws DataException
765
     */
766
    public void finishEditing() throws DataException;
767

    
768
    public boolean finishEditingQuietly();
769
    
770
    public static boolean finishEditingQuietly(FeatureStore store) {
771
        if( store==null ) {
772
            return true;
773
        }
774
        return store.finishEditingQuietly();
775
    }
776

    
777
    /**
778
     * Save changes in the provider without leaving the edit mode.
779
     * Do not call observers to communicate a change of ediding mode.
780
     * The operation's history is eliminated to prevent inconsistencies
781
     * in the data.
782
     *
783
     * @throws DataException
784
     */
785
    public void commitChanges() throws DataException ;
786

    
787
    /**
788
     *
789
     * Returns true if you can call CommitChanges method.
790
     * If not in editing or changes have been made in the structure
791
     * return false.
792
     *
793
     * @return true if can call commitChanges
794
     * @throws DataException
795
     */
796
    public boolean canCommitChanges() throws DataException;
797

    
798

    
799
    /**
800
     * Indicates whether this store is in editing state.
801
     *
802
     * @return
803
     *         true if this store is in editing state, false if not.
804
     */
805
    public boolean isEditing();
806

    
807
    /**
808
     * Indicates whether this store is in appending state. In this state the new
809
     * features are automatically inserted at the end of the {@link FeatureSet}.
810
     *
811
     * @return true if this store is in appending state.
812
     */
813
    public boolean isAppending();
814

    
815
    /**
816
     * Updates a {@link FeatureType} in the store with the changes in the
817
     * {@link EditableFeatureType}.<br>
818
     *
819
     * Any {@link FeatureSet} from this store that are used will be invalidated.
820
     *
821
     * @param featureType
822
     *            an {@link EditableFeatureType} with the changes.
823
     *
824
     * @throws DataException
825
     */
826
    public void update(EditableFeatureType featureType) throws DataException;
827

    
828
    /**
829
     * Updates a {@link Feature} in the store with the changes in the
830
     * {@link EditableFeature}.<br>
831
     *
832
     * Any {@link FeatureSet} from this store that was still in use will be
833
     * invalidated. You can override this using
834
     * {@link FeatureSet#update(EditableFeature)}.
835
     *
836
     * @param feature
837
     *            the feature to be updated
838
     *
839
     * @throws DataException
840
     */
841
    public void update(EditableFeature feature) throws DataException;
842

    
843
    public void update(Object... parameters) throws DataException;
844

    
845
    /**
846
     * Deletes a {@link Feature} from the store.<br>
847
     *
848
     * Any {@link FeatureSet} from this store that was still in use will be
849
     * invalidated. You can override this using {@link Iterator#remove()} from
850
     * {@link FeatureSet}.
851
     *
852
     * @param feature
853
     *            The feature to be deleted.
854
     *
855
     * @throws DataException
856
     */
857
    public void delete(Feature feature) throws DataException;
858
    
859
    public void delete(String filter);
860
    
861
    public void delete(Expression filter);
862

    
863
    /**
864
     * Inserts a {@link Feature} in the store.<br>
865
     *
866
     * Any {@link FeatureSet} from this store that was still in use will be
867
     * invalidated. You can override this using
868
     * {@link FeatureSet#insert(EditableFeature)}.
869
     *
870
     * @param feature
871
     *            The feature to be inserted
872
     *
873
     * @throws DataException
874
     */
875
    public void insert(EditableFeature feature) throws DataException;
876

    
877
    /**
878
     * Inserts a set of {@link Feature} in the store.
879
     * 
880
     * The attributes of the feature are copied from the features of the set 
881
     * by name, forcing the conversion of types if necessary.
882
     *
883
     * Any {@link FeatureSet} from this store that was still in use will be
884
     * invalidated.
885
     *
886
     * @param set, set with the source features.
887
     * @throws DataException
888
     */
889
    public void insert(FeatureSet set) throws DataException;
890
    
891
    /**
892
     * Creates a new feature using the default feature type and returns it as an
893
     * {@link EditableFeature}
894
     *
895
     * @return a new feature in editable state
896
     *
897
     * @throws DataException
898
     */
899
    public EditableFeature createNewFeature() throws DataException;
900

    
901
    /**
902
     * Creates a new feature of the given {@link FeatureType} and uses the given
903
     * {@link Feature} as default values to initialize it.
904
     *
905
     * @param type
906
     *            the new feature's feature type
907
     *
908
     * @param defaultValues
909
     *            a feature whose values are used as default values for the new
910
     *            feature.
911
     *
912
     * @return the new feature.
913
     *
914
     * @throws DataException
915
     */
916
    public EditableFeature createNewFeature(FeatureType type,
917
        Feature defaultValues) throws DataException;
918

    
919
    /**
920
     * Creates a new feature of the given {@link FeatureType}. The flag
921
     * defaultValues is used to indicate whether the new feature should be
922
     * initialized with default values or not.
923
     *
924
     * @param type
925
     *            the new feature's feature type
926
     *
927
     * @param defaultValues
928
     *            if true the new feature is initialized with each attribute's
929
     *            default value.
930
     *
931
     * @return
932
     *         the new feature
933
     *
934
     * @throws DataException
935
     */
936
    public EditableFeature createNewFeature(FeatureType type,
937
        boolean defaultValues) throws DataException;
938

    
939
    /**
940
     * Creates a new feature of default {@link FeatureType}. The flag
941
     * defaultValues is used to indicate whether the new feature should be
942
     * initialized with default values or not.
943
     *
944
     * @param defaultValues
945
     *            if true the new feature is initialized with each attribute's
946
     *            default value.
947
     *
948
     * @return
949
     *         the new feature
950
     *
951
     * @throws DataException
952
     */
953
    public EditableFeature createNewFeature(boolean defaultValues)
954
        throws DataException;
955

    
956
    /**
957
     * Creates a new feature of default {@link FeatureType}.
958
     * The new feature should be initialized with the values of the feature
959
     * passed as parameter.
960
     * Values are inicialiced by name from the feature specified. Error in
961
     * value assignement are ignoreds.
962
     *
963
     * @param defaultValues the values to initialize the new feature.
964
     * @return the new feature
965
     * @throws DataException
966
     */
967
    public EditableFeature createNewFeature(Feature defaultValues)
968
        throws DataException;
969

    
970
    public EditableFeature createNewFeature(JsonObject defaultValues)
971
        throws DataException;
972

    
973
    /**
974
     * Applies the validation rules associated to the given mode to the active
975
     * {@link FeatureSet}.
976
     *
977
     * @param mode
978
     *            can be one of {MODE_QUERY, MODE_FULLEDIT, MODE_APPEND}
979
     *
980
     * @throws DataException
981
     */
982
    public void validateFeatures(int mode) throws DataException;
983

    
984
    /**
985
     * Indicates whether this store supports append mode.
986
     *
987
     * @return
988
     *         true if this store supports append mode.
989
     */
990
    public boolean isAppendModeSupported();
991

    
992
    /**
993
     * Initiates an editing group. This is typically used to group series of
994
     * store editing operations.
995
     *
996
     * @param description
997
     *            Description of the editing group.
998
     *
999
     * @throws NeedEditingModeException
1000
     */
1001
    public void beginEditingGroup(String description)
1002
        throws NeedEditingModeException;
1003

    
1004
    /**
1005
     * Finishes an editing group.
1006
     *
1007
     * @throws NeedEditingModeException
1008
     */
1009
    public void endEditingGroup() throws NeedEditingModeException;
1010

    
1011
    /*
1012
     * =============================================================
1013
     *
1014
     * Index related services
1015
     */
1016

    
1017
    /**
1018
     * Creates an index which will be applied to the features of the given type,
1019
     * by using the data of the given attribute.
1020
     *
1021
     * @param featureType
1022
     *            The FeatureType to which the indexed attribute belongs.
1023
     *
1024
     * @param attributeName
1025
     *            The name of the attributed to be indexed
1026
     *
1027
     * @param indexName
1028
     *            The index name
1029
     *
1030
     * @return the resulting {@link FeatureIndex}
1031
     *
1032
     *
1033
     * @throws FeatureIndexException
1034
     *             if there is an error creating the index
1035
     */
1036
    public FeatureIndex createIndex(FeatureType featureType,
1037
        String attributeName, String indexName) throws DataException;
1038

    
1039
    /**
1040
     * Creates an index which will be applied to the features of the given type,
1041
     * by using the data of the given attribute.
1042
     *
1043
     * @param indexTypeName
1044
     *            the type of the index to be created. That name is
1045
     *            related to one of the registered index providers
1046
     * @param featureType
1047
     *            The FeatureType to which the indexed attribute belongs.
1048
     *
1049
     * @param attributeName
1050
     *            The name of the attributed to be indexed
1051
     *
1052
     * @param indexName
1053
     *            The index name
1054
     *
1055
     * @return the resulting {@link FeatureIndex}
1056
     *
1057
     *
1058
     * @throws FeatureIndexException
1059
     *             if there is an error creating the index
1060
     */
1061
    public FeatureIndex createIndex(String indexTypeName,
1062
        FeatureType featureType, String attributeName, String indexName)
1063
        throws DataException;
1064

    
1065
    /**
1066
     * Creates an index which will be applied to the features of the given type,
1067
     * by using the data of the given attribute. This method will return without
1068
     * waiting for the index to be filled, as that will be performed in
1069
     * background. An optional {@link Observer} parameter is provided to be
1070
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
1071
     * when the index has finished filling with data and is available to be
1072
     * used.
1073
     *
1074
     * @param featureType
1075
     *            The FeatureType to which the indexed attribute belongs.
1076
     *
1077
     * @param attributeName
1078
     *            The name of the attributed to be indexed
1079
     *
1080
     * @param indexName
1081
     *            The index name
1082
     *
1083
     * @param observer
1084
     *            to notify to when the created index has finished filling
1085
     *            with data and is available to be used. The observer will
1086
     *            receive then a
1087
     *            {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
1088
     *            notification, with the index object if it has finished
1089
     *            successfully, or a
1090
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
1091
     *            notification with the exception object if there has been
1092
     *            any error in the process. Optional.
1093
     *
1094
     * @return the resulting {@link FeatureIndex}
1095
     *
1096
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
1097
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
1098
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
1099
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
1100
     *
1101
     * @throws FeatureIndexException
1102
     *             if there is an error creating the index
1103
     */
1104
    public FeatureIndex createIndex(FeatureType featureType,
1105
        String attributeName, String indexName, Observer observer)
1106
        throws DataException;
1107

    
1108
    /**
1109
     * Creates an index which will be applied to the features of the given type,
1110
     * by using the data of the given attribute. This method will return without
1111
     * waiting for the index to be filled, as that will be performed in
1112
     * background. An optional {@link Observer} parameter is provided to be
1113
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
1114
     * when the index has finished filling with data and is available to be
1115
     * used.
1116
     *
1117
     * @param indexTypeName
1118
     *            the type of the index to be created. That name is
1119
     *            related to one of the registered index providers
1120
     * @param featureType
1121
     *            The FeatureType to which the indexed attribute belongs.
1122
     *
1123
     * @param attributeName
1124
     *            The name of the attributed to be indexed
1125
     *
1126
     * @param indexName
1127
     *            The index name
1128
     *
1129
     * @param observer
1130
     *            to notify to when the created index has finished filling
1131
     *            with data and is available to be used. The observer will
1132
     *            receive then a
1133
     *            {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS}
1134
     *            notification, with the index object if it has finished
1135
     *            successfully, or a
1136
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
1137
     *            notification with the exception object if there has been
1138
     *            any error in the process. Optional.
1139
     *
1140
     * @return the resulting {@link FeatureIndex}
1141
     *
1142
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
1143
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
1144
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
1145
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
1146
     *
1147
     * @throws FeatureIndexException
1148
     *             if there is an error creating the index
1149
     */
1150
    public FeatureIndex createIndex(String indexTypeName,
1151
        FeatureType featureType, String attributeName, String indexName,
1152
        Observer observer) throws DataException;
1153

    
1154
    /**
1155
     * Returns a FeatureIndexes structure containing all available indexes in
1156
     * the store.
1157
     *
1158
     * @return
1159
     */
1160
    public FeatureIndexes getIndexes();
1161

    
1162
    /*
1163
     * =============================================================
1164
     *
1165
     * Selection related services
1166
     */
1167

    
1168
    /**
1169
     * Sets the selection to the passed {@link FeatureSet}
1170
     *
1171
     * @param selection
1172
     *            A {@link FeatureSet} with the requested selection
1173
     * @throws org.gvsig.fmap.dal.exception.DataException
1174
     */
1175
    public void setSelection(FeatureSet selection) throws DataException;
1176

    
1177
    /**
1178
     * Creates a {@link FeatureSelection}
1179
     *
1180
     * @return
1181
     *         a {@link FeatureSelection}
1182
     *
1183
     * @throws DataException
1184
     */
1185
    public FeatureSelection createFeatureSelection() throws DataException;
1186
    
1187
    public FeatureSelection createLargeFeatureSelection() throws DataException;
1188
            
1189
    /**
1190
     * Creates a {@link FeatureSelection}
1191
     *
1192
     * @return
1193
     *         a {@link FeatureSelection}
1194
     *
1195
     * @throws DataException
1196
     */
1197
    public FeatureSelection createMemoryFeatureSelection() throws DataException;
1198

    
1199

    
1200
    /**
1201
     * Returns the current {@link FeatureSelection}.
1202
     * Create a empty selection if not exits.
1203
     * 
1204
     * Manage of the selection can be slow on some data sources. 
1205
     * Use with care.
1206
     * In data sources that do not support position access to records, 
1207
     * it may be slow to retrieve items from the selection. In some data 
1208
     * sources it may be necessary to access to this to retrieve each 
1209
     * item in the selection.
1210
     *
1211
     * @return
1212
     *         current {@link FeatureSelection}.
1213
     *
1214
     * @throws DataException
1215
     */
1216
    public FeatureSelection getFeatureSelection() throws DataException;
1217

    
1218
    /*
1219
     * =============================================================
1220
     *
1221
     * Lock related services
1222
     */
1223

    
1224
    /**
1225
     * Indicates whether this store supports locks.
1226
     *
1227
     * @return
1228
     *         true if this store supports locks, false if not.
1229
     */
1230
    public boolean isLocksSupported();
1231

    
1232
    /**
1233
     * Returns the set of locked features
1234
     *
1235
     * @return
1236
     *         set of locked features
1237
     *
1238
     * @throws DataException
1239
     */
1240
    public FeatureLocks getLocks() throws DataException;
1241

    
1242
    /*
1243
     * =============================================================
1244
     * Transforms related services
1245
     * =============================================================
1246
     */
1247

    
1248
    /**
1249
     * Returns this store transforms
1250
     *
1251
     * @return
1252
     *         this store transforms
1253
     */
1254
    public FeatureStoreTransforms getTransforms();
1255

    
1256
    /**
1257
     * Returns a new {@link FeatureQuery} associated to this store.
1258
     *
1259
     * @return
1260
     *         a new {@link FeatureQuery} associated to this store.
1261
     */
1262
    public FeatureQuery createFeatureQuery();
1263

    
1264
    /**
1265
     * Returns featue count of this store.
1266
     *
1267
     * @return
1268
     * @throws DataException
1269
     */
1270
    public long getFeatureCount() throws DataException;
1271

    
1272
//    /**
1273
//     * Creates a vectorial cache that is used to save and retrieve data.
1274
//     *
1275
//     * @param name
1276
//     *            the cache name.
1277
//     * @param parameters
1278
//     *            parameters to create the stores used to save data.
1279
//     * @throws DataException
1280
//     */
1281
//    public void createCache(String name, DynObject parameters)
1282
//        throws DataException;
1283
//
1284
//    /**
1285
//     * @return the vectorial cache
1286
//     */
1287
//    public FeatureCache getCache();
1288

    
1289
    /**
1290
     * Return if the provider knows the real envelope of a layer. If not,
1291
     * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
1292
     * the full envelope.
1293
     *
1294
     * @return true if it knows the real envelope.
1295
     */
1296
    public boolean isKnownEnvelope();
1297

    
1298
    /**
1299
     * Return if the maximum number of features provided by the
1300
     * provider are limited.
1301
     *
1302
     * @return true if there is a limit of features.
1303
     */
1304
    public boolean hasRetrievedFeaturesLimit();
1305

    
1306
    /**
1307
     * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns
1308
     * true,
1309
     * it returns the limit of features retrieved from the provider.
1310
     *
1311
     * @return
1312
     *         The limit of the retrieved features.
1313
     */
1314
    public int getRetrievedFeaturesLimit();
1315

    
1316
    /**
1317
     * Return the associated feature to the dynobject.
1318
     * If the dynobject isn't associated to a feature of this store, return null.
1319
     *
1320
     * @param dynobject
1321
     * @return
1322
     */
1323
    public Feature getFeature(DynObject dynobject);
1324

    
1325

    
1326
    public ExpressionBuilder createExpressionBuilder();
1327

    
1328
    /**
1329
     * 
1330
     * @return 
1331
     * @deprecated use createExpressionBuilder
1332
     */
1333
    public ExpressionBuilder createExpression();
1334

    
1335
    public void createCache(String name, DynObject parameters)
1336
        throws DataException;
1337

    
1338
    @Override
1339
    public FeatureCache getCache();
1340

    
1341
    public boolean isBroken();
1342

    
1343
    public Throwable getBreakingsCause();
1344

    
1345
    /**
1346
     * Indicates if the storage is temporary.
1347
     * There is no guarantee that a temporary store can be recovered from 
1348
     * its parameters. In general these will not be persistent.
1349
     * 
1350
     * @return true if the store is temporary, otherwise false.
1351
     */
1352
    public boolean isTemporary();
1353
    
1354
    /**
1355
     * @param index
1356
     * @return
1357
     */
1358
    public SpatialIndex wrapSpatialIndex(SpatialIndex index);
1359
    
1360
    public FeatureReference getFeatureReference(String code);
1361

    
1362
    /**
1363
     * Devuelbe el numero de operaciones pendientes de guardar en una sesion
1364
     * de edicion. Es un valor orientativo.
1365
     * Las operaciones pendientes son la suma de operaciones de borrado, insercion
1366
     * o modificacion de las features en una sesion de edicion.
1367
     * 
1368
     * Retorna 0 si no esta en edicion.
1369
     * 
1370
     * @return numero de operaciones pendientes. 
1371
     */
1372
    public long getPendingChangesCount();
1373
    
1374
    public Feature getSampleFeature();
1375
    
1376
    /**
1377
     * Return true when the default feature type of the store 
1378
     * support references.
1379
     * 
1380
     * @return true when support references.
1381
     */
1382
    public boolean supportReferences();
1383
    
1384
    public Feature getOriginalFeature(FeatureReference id);
1385

    
1386
    public Feature getOriginalFeature(Feature feature);
1387
    
1388
    public boolean isFeatureModified(FeatureReference id);
1389

    
1390
    public boolean isFeatureModified(Feature feature);
1391

    
1392
}