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

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.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
    /**
845
     * Updates Features in the store with the values of the parameters.
846
     * Examples:
847
     *      update("field1",value1,"field2",value2);
848
     *      update("field1",value1,"field2",value2,filter);
849
     * 
850
     * filter can be a {@link Expression} or a String
851
     * 
852
     * @param parameters
853
     * @throws DataException 
854
     */
855
    public void update(Object... parameters) throws DataException;
856

    
857
    /**
858
     * Deletes a {@link Feature} from the store.<br>
859
     *
860
     * Any {@link FeatureSet} from this store that was still in use will be
861
     * invalidated. You can override this using {@link Iterator#remove()} from
862
     * {@link FeatureSet}.
863
     *
864
     * @param feature
865
     *            The feature to be deleted.
866
     *
867
     * @throws DataException
868
     */
869
    public void delete(Feature feature) throws DataException;
870
    
871
    public void delete(String filter);
872
    
873
    public void delete(Expression filter);
874

    
875
    /**
876
     * Inserts a {@link Feature} in the store.<br>
877
     *
878
     * Any {@link FeatureSet} from this store that was still in use will be
879
     * invalidated. You can override this using
880
     * {@link FeatureSet#insert(EditableFeature)}.
881
     *
882
     * @param feature
883
     *            The feature to be inserted
884
     *
885
     * @throws DataException
886
     */
887
    public void insert(EditableFeature feature) throws DataException;
888

    
889
    /**
890
     * Inserts a set of {@link Feature} in the store.
891
     * 
892
     * The attributes of the feature are copied from the features of the set 
893
     * by name, forcing the conversion of types if necessary.
894
     *
895
     * Any {@link FeatureSet} from this store that was still in use will be
896
     * invalidated.
897
     *
898
     * @param set, set with the source features.
899
     * @throws DataException
900
     */
901
    public void insert(FeatureSet set) throws DataException;
902
    
903
    /**
904
     * Creates a new feature using the default feature type and returns it as an
905
     * {@link EditableFeature}
906
     *
907
     * @return a new feature in editable state
908
     *
909
     * @throws DataException
910
     */
911
    public EditableFeature createNewFeature() throws DataException;
912

    
913
    /**
914
     * Creates a new feature of the given {@link FeatureType} and uses the given
915
     * {@link Feature} as default values to initialize it.
916
     *
917
     * @param type
918
     *            the new feature's feature type
919
     *
920
     * @param defaultValues
921
     *            a feature whose values are used as default values for the new
922
     *            feature.
923
     *
924
     * @return the new feature.
925
     *
926
     * @throws DataException
927
     */
928
    public EditableFeature createNewFeature(FeatureType type,
929
        Feature defaultValues) throws DataException;
930

    
931
    /**
932
     * Creates a new feature of the given {@link FeatureType}. The flag
933
     * defaultValues is used to indicate whether the new feature should be
934
     * initialized with default values or not.
935
     *
936
     * @param type
937
     *            the new feature's feature type
938
     *
939
     * @param defaultValues
940
     *            if true the new feature is initialized with each attribute's
941
     *            default value.
942
     *
943
     * @return
944
     *         the new feature
945
     *
946
     * @throws DataException
947
     */
948
    public EditableFeature createNewFeature(FeatureType type,
949
        boolean defaultValues) throws DataException;
950

    
951
    /**
952
     * Creates a new feature of default {@link FeatureType}. The flag
953
     * defaultValues is used to indicate whether the new feature should be
954
     * initialized with default values or not.
955
     *
956
     * @param defaultValues
957
     *            if true the new feature is initialized with each attribute's
958
     *            default value.
959
     *
960
     * @return
961
     *         the new feature
962
     *
963
     * @throws DataException
964
     */
965
    public EditableFeature createNewFeature(boolean defaultValues)
966
        throws DataException;
967

    
968
    /**
969
     * Creates a new feature of default {@link FeatureType}.
970
     * The new feature should be initialized with the values of the feature
971
     * passed as parameter.
972
     * Values are inicialiced by name from the feature specified. Error in
973
     * value assignement are ignoreds.
974
     *
975
     * @param defaultValues the values to initialize the new feature.
976
     * @return the new feature
977
     * @throws DataException
978
     */
979
    public EditableFeature createNewFeature(Feature defaultValues)
980
        throws DataException;
981

    
982
    public EditableFeature createNewFeature(JsonObject defaultValues)
983
        throws DataException;
984

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

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

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

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

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

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

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

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

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

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

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

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

    
1200

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

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

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

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

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

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

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

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

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

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

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

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

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

    
1326

    
1327
    public ExpressionBuilder createExpressionBuilder();
1328

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

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

    
1339
    @Override
1340
    public FeatureCache getCache();
1341

    
1342
    public boolean isBroken();
1343

    
1344
    public Throwable getBreakingsCause();
1345

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

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

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

    
1391
    public boolean isFeatureModified(Feature feature);
1392
    
1393
    public String getEditingSession();
1394
}