Revision 41818

View differences:

trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/test/java/org/gvsig/fmap/mapcontext/persistence/DummyFileFeatureStore.java
198 198
			// TODO Auto-generated method stub
199 199
			return false;
200 200
		}
201
      
201

  
202 202
        public String getSubtype() {
203 203
            // TODO Auto-generated method stub
204 204
            return null;
......
340 340

  
341 341
        public void validate(Object value) throws DynFieldValidateException {
342 342
            // TODO Auto-generated method stub
343
            
343

  
344 344
        }
345 345

  
346 346
        public Object coerce(Object value) throws CoercionException {
......
411 411
        public void setFeatureAttributeGetter(
412 412
            FeatureAttributeGetter featureAttributeGetter) {
413 413
            // TODO Auto-generated method stub
414
            
414

  
415 415
        }
416 416

  
417 417
        public FeatureAttributeEmulator getFeatureAttributeEmulator() {
......
543 543

  
544 544
        public void removeDynMethod(String name) {
545 545
            // TODO Auto-generated method stub
546
            
546

  
547 547
        }
548 548

  
549 549
        public DynField addDynField(String name) {
......
671 671

  
672 672
        public void extend(DynStruct struct) {
673 673
            // TODO Auto-generated method stub
674
            
674

  
675 675
        }
676 676

  
677 677
        public void extend(String namespace, String structName) {
678 678
            // TODO Auto-generated method stub
679
            
679

  
680 680
        }
681 681

  
682 682
        public void extend(String structName) {
683 683
            // TODO Auto-generated method stub
684
            
684

  
685 685
        }
686 686

  
687 687
        public DynField getDeclaredDynField(String name) {
......
741 741

  
742 742
        public void removeDynField(String name) {
743 743
            // TODO Auto-generated method stub
744
            
744

  
745 745
        }
746 746

  
747 747
        public void setDescription(String description) {
748 748
            // TODO Auto-generated method stub
749
            
749

  
750 750
        }
751 751

  
752 752
        public void setNamespace(String namespace) {
753 753
            // TODO Auto-generated method stub
754
            
754

  
755 755
        }
756 756

  
757 757
        public void validate(DynObject object)
758 758
            throws DynObjectValidateException {
759 759
            // TODO Auto-generated method stub
760
            
760

  
761 761
        }
762 762

  
763 763
        public void addDynMethod(DynMethod dynMethod) {
764 764
            // TODO Auto-generated method stub
765
            
765

  
766 766
        }
767 767

  
768 768
        public DynMethod getDeclaredDynMethod(String name)
......
798 798

  
799 799
		public void extend(DynStruct[] structs) {
800 800
			// TODO Auto-generated method stub
801
			
801

  
802 802
		}
803 803

  
804 804
		public void remove(DynStruct superDynStruct) {
805 805
			// TODO Auto-generated method stub
806
			
806

  
807 807
		}
808 808

  
809 809
		public void removeAll(DynStruct[] superDynStruct) {
810 810
			// TODO Auto-generated method stub
811
			
811

  
812 812
		}
813 813

  
814 814
        public FeatureAttributeDescriptor getDefaultTimeAttribute() {
......
819 819
	}
820 820

  
821 821
	private String name = "[empty]";
822
	
822

  
823 823
	public DummyFileFeatureStore() {
824
		
824

  
825 825
	}
826
	
826

  
827 827
	public DummyFileFeatureStore(String id) {
828 828
		name = "[FILE FEATURE STORE - " + id + "]";
829 829
	}
830
	
830

  
831 831
	public boolean allowWrite() {
832 832
		// TODO Auto-generated method stub
833 833
		return false;
......
1261 1261
		// TODO Auto-generated method stub
1262 1262

  
1263 1263
	}
1264
	
1265
	
1266
	
1264

  
1265

  
1266

  
1267 1267
	public static void registerPersistent() {
1268 1268
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
1269 1269
		DynStruct definition = manager.addDefinition(
1270 1270
				DummyFileFeatureStore.class,
1271 1271
				"DummyFileFeatureStore",
1272 1272
				"DummyFileFeatureStore Persistence definition",
1273
				null, 
1273
				null,
1274 1274
				null
1275 1275
		);
1276 1276
		definition.addDynFieldString("name")
......
1291 1291
	public void createCache(String name, DynObject parameters)
1292 1292
			throws DataException {
1293 1293
		// TODO Auto-generated method stub
1294
		
1294

  
1295 1295
	}
1296 1296

  
1297 1297
	public FeatureCache getCache() {
......
1306 1306
	public void export(DataServerExplorer explorer, String provider,
1307 1307
			NewFeatureStoreParameters params) throws DataException {
1308 1308
		// TODO Auto-generated method stub
1309
		
1309

  
1310 1310
	}
1311 1311

  
1312 1312
	public String getProviderName() {
......
1362 1362
        // TODO Auto-generated method stub
1363 1363
        return null;
1364 1364
    }
1365
    
1365

  
1366 1366
    public Object clone() throws CloneNotSupportedException {
1367 1367
        // TODO Auto-generated method stub
1368 1368
        return super.clone();
......
1373 1373
     */
1374 1374
    public void commitChanges() throws DataException {
1375 1375
        // TODO Auto-generated method stub
1376
        
1376

  
1377 1377
    }
1378 1378

  
1379 1379
    /* (non-Javadoc)
......
1383 1383
        // TODO Auto-generated method stub
1384 1384
        return false;
1385 1385
    }
1386

  
1387
    public Feature getFeature(DynObject dynobject) {
1388
        // TODO Auto-generated method stub
1389
        return null;
1390
    }
1386 1391
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.mapcontext/org.gvsig.fmap.mapcontext.api/src/test/java/org/gvsig/fmap/mapcontext/persistence/DummyDBFeatureStore.java
73 73
	private String name = "[empty]";
74 74

  
75 75
	public DummyDBFeatureStore() {
76
		
76

  
77 77
	}
78
	
78

  
79 79
	public DummyDBFeatureStore(String id) {
80 80
		name = "[DATABASE FEATURE STORE - " + id + "]";
81 81
	}
......
520 520
		// TODO Auto-generated method stub
521 521

  
522 522
	}
523
	
524
	
523

  
524

  
525 525
	public static void registerPersistent() {
526 526
		PersistenceManager manager = ToolsLocator.getPersistenceManager();
527 527
		DynStruct definition = manager.addDefinition(
528 528
				DummyDBFeatureStore.class,
529 529
				"DummyDBFeatureStore",
530 530
				"DummyDBFeatureStore Persistence definition",
531
				null, 
531
				null,
532 532
				null
533 533
		);
534 534
		definition.addDynFieldString("name");
......
548 548
	public void createCache(String name, DynObject parameters)
549 549
			throws DataException {
550 550
		// TODO Auto-generated method stub
551
		
551

  
552 552
	}
553 553

  
554 554
	public FeatureCache getCache() {
......
613 613
        // TODO Auto-generated method stub
614 614
        return null;
615 615
    }
616
    
616

  
617 617
    /* (non-Javadoc)
618 618
     * @see java.lang.Object#clone()
619 619
     */
......
627 627
     */
628 628
    public void commitChanges() throws DataException {
629 629
        // TODO Auto-generated method stub
630
        
630

  
631 631
    }
632 632

  
633 633
    /* (non-Javadoc)
......
637 637
        // TODO Auto-generated method stub
638 638
        return false;
639 639
    }
640

  
641
    public Feature getFeature(DynObject dynobject) {
642
        // TODO Auto-generated method stub
643
        return null;
644
    }
640 645
}
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
49 49
 * {@link Feature}(s). {@link Feature}(s) from the same FeatureStore can be of
50 50
 * different {@link FeatureType}(s) (as in GML format for instance).
51 51
 * </p>
52
 * 
52
 *
53 53
 * <p>
54 54
 * FeatureStore allows:
55 55
 * </p>
......
68 68
 * <li>Selection.
69 69
 * <li>Locks management.
70 70
 * </ul>
71
 * 
71
 *
72 72
 */
73 73
public interface FeatureStore extends DataStore, UndoRedoStack, Cloneable {
74 74

  
......
85 85

  
86 86
    /*
87 87
     * =============================================================
88
     * 
88
     *
89 89
     * information related services
90 90
     */
91 91

  
92 92
    /**
93 93
     * Indicates whether this store allows writing.
94
     * 
94
     *
95 95
     * @return
96 96
     *         true if this store can be written, false if not.
97 97
     */
......
99 99

  
100 100
    /**
101 101
     * Returns this store's default {@link FeatureType}.
102
     * 
102
     *
103 103
     * @return
104 104
     *         this store's default {@link FeatureType}.
105
     * 
105
     *
106 106
     * @throws DataException
107 107
     */
108 108
    public FeatureType getDefaultFeatureType() throws DataException;
......
110 110
    /**
111 111
     * Returns this store's featureType {@link FeatureType} matches with
112 112
     * featureTypeId.
113
     * 
113
     *
114 114
     * @param featureTypeId
115
     * 
115
     *
116 116
     * @return this store's default {@link FeatureType}.
117
     * 
117
     *
118 118
     * @throws DataException
119 119
     */
120 120
    public FeatureType getFeatureType(String featureTypeId)
......
122 122

  
123 123
    /**
124 124
     * Returns this store's {@link FeatureType}(s).
125
     * 
125
     *
126 126
     * @return a list with this store's {@link FeatureType}(s).
127
     * 
127
     *
128 128
     * @throws DataException
129 129
     */
130 130
    public List getFeatureTypes() throws DataException;
131 131

  
132 132
    /**
133 133
     * Returns this store's parameters.
134
     * 
134
     *
135 135
     * @return
136 136
     *         {@link DataStoreParameters} containing this store's parameters
137 137
     */
......
145 145

  
146 146
    /**
147 147
     * Returns this store's total envelope (extent).
148
     * 
148
     *
149 149
     * @return this store's total envelope (extent) or <code>null</code> if
150 150
     *         store not have geometry information
151 151
     */
152 152
    public Envelope getEnvelope() throws DataException;
153 153

  
154 154
    /**
155
     * 
155
     *
156 156
     * @deprecated use getDefaultFeatureType().getDefaultSRS()
157 157
     * @return
158 158
     * @throws DataException
......
161 161

  
162 162
    /**
163 163
     * Exports this store to another store.
164
     * 
164
     *
165 165
     * @param explorer
166 166
     *            {@link DataServerExplorer} target
167 167
     * @param params
168 168
     *            New parameters of this store that will be used on the target
169 169
     *            explorer
170
     * 
170
     *
171 171
     * @throws DataException
172
     * 
172
     *
173 173
     * @Deprecated this method is unstable
174 174
     */
175 175
    public void export(DataServerExplorer explorer, String provider,
......
177 177

  
178 178
    /*
179 179
     * =============================================================
180
     * 
180
     *
181 181
     * Query related services
182 182
     */
183 183

  
......
185 185
     * Returns all available features in the store.
186 186
     * <p>
187 187
     * <em>
188
     * <strong>NOTE:</strong> if you use this method to get a 
189
     * {@link FeatureSet}, you  must get sure it is disposed 
190
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an 
191
     * error occurs while getting the data. It is recommended to use the 
192
     * <code>accept</code> methods instead, which handle everything for you. 
193
     * Take into account the accept methods may use a fast iterator to 
188
     * <strong>NOTE:</strong> if you use this method to get a
189
     * {@link FeatureSet}, you  must get sure it is disposed
190
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an
191
     * error occurs while getting the data. It is recommended to use the
192
     * <code>accept</code> methods instead, which handle everything for you.
193
     * Take into account the accept methods may use a fast iterator to
194 194
     * get the features.
195 195
     * </em>
196 196
     * </p>
197
     * 
197
     *
198 198
     * @see #accept(org.gvsig.tools.visitor.Visitor)
199
     * 
199
     *
200 200
     * @return a collection of features
201 201
     * @throws ReadException
202 202
     *             if there is any error while reading the features
......
208 208
     * restrictions of the FeatureQuery.
209 209
     * <p>
210 210
     * <em>
211
     * <strong>NOTE:</strong> if you use this method to get a 
212
     * {@link FeatureSet}, you  must get sure it is disposed 
213
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an 
214
     * error occurs while getting the data. It is recommended to use the 
215
     * <code>accept</code> methods instead, which handle everything for you. 
216
     * Take into account the accept methods may use a fast iterator to 
211
     * <strong>NOTE:</strong> if you use this method to get a
212
     * {@link FeatureSet}, you  must get sure it is disposed
213
     * (@see {@link DisposableIterator#dispose()}) in any case, even if an
214
     * error occurs while getting the data. It is recommended to use the
215
     * <code>accept</code> methods instead, which handle everything for you.
216
     * Take into account the accept methods may use a fast iterator to
217 217
     * get the features.
218 218
     * </em>
219 219
     * </p>
220
     * 
220
     *
221 221
     * @see #accept(org.gvsig.tools.visitor.Visitor,
222 222
     *      org.gvsig.fmap.dal.DataQuery)
223
     * 
223
     *
224 224
     * @param featureQuery
225 225
     *            defines the characteristics of the features to return
226 226
     * @return a collection of features
......
233 233
     * Loads a subset of features taking into account the properties and
234 234
     * restrictions of the FeatureQuery. Feature loading is performed by calling
235 235
     * the Observer, once each loaded Feature.
236
     * 
236
     *
237 237
     * @param featureQuery
238 238
     *            defines the characteristics of the features to return
239 239
     * @param observer
......
247 247
    /**
248 248
     * Loads all available feature in the store. The loading of Features is
249 249
     * performed by calling the Observer, once each loaded Feature.
250
     * 
250
     *
251 251
     * @param observer
252 252
     *            to be notified of each loaded Feature
253 253
     * @throws DataException
......
257 257

  
258 258
    /**
259 259
     * Returns the feature given its reference.
260
     * 
260
     *
261 261
     * @param reference
262 262
     *            a unique FeatureReference
263 263
     * @return
264 264
     *         The Feature
265
     * 
265
     *
266 266
     * @throws DataException
267
     * 
267
     *
268 268
     */
269 269
    public Feature getFeatureByReference(FeatureReference reference)
270 270
        throws DataException;
271 271

  
272 272
    /**
273 273
     * Returns the feature given its reference and feature type.
274
     * 
274
     *
275 275
     * @param reference
276 276
     *            a unique FeatureReference
277
     * 
277
     *
278 278
     * @param featureType
279 279
     *            FeatureType to which the requested Feature belongs
280
     * 
280
     *
281 281
     * @return
282 282
     *         The Feature
283
     * 
283
     *
284 284
     * @throws DataException
285
     * 
285
     *
286 286
     */
287 287
    public Feature getFeatureByReference(FeatureReference reference,
288 288
        FeatureType featureType) throws DataException;
289 289

  
290 290
    /*
291 291
     * =============================================================
292
     * 
292
     *
293 293
     * Editing related services
294 294
     */
295 295

  
......
300 300

  
301 301
    /**
302 302
     * Enters editing state specifying the editing mode.
303
     * 
303
     *
304 304
     * @param mode
305
     * 
305
     *
306 306
     * @throws DataException
307 307
     */
308 308
    public void edit(int mode) throws DataException;
309 309

  
310 310
    /**
311 311
     * Cancels all editing since the last edit().
312
     * 
312
     *
313 313
     * @throws DataException
314 314
     */
315 315
    public void cancelEditing() throws DataException;
316 316

  
317 317
    /**
318 318
     * Exits editing state.
319
     * 
319
     *
320 320
     * @throws DataException
321 321
     */
322 322
    public void finishEditing() throws DataException;
......
336 336
     * Returns true if you can call CommitChanges method.
337 337
     * If not in editing or changes have been made in the structure
338 338
     * return false.
339
     *  
339
     *
340 340
     * @return true if can call commitChanges
341
     * @throws DataException 
341
     * @throws DataException
342 342
     */
343 343
    public boolean canCommitChanges() throws DataException;
344 344

  
345
    
345

  
346 346
    /**
347 347
     * Indicates whether this store is in editing state.
348
     * 
348
     *
349 349
     * @return
350 350
     *         true if this store is in editing state, false if not.
351 351
     */
......
354 354
    /**
355 355
     * Indicates whether this store is in appending state. In this state the new
356 356
     * features are automatically inserted at the end of the {@link FeatureSet}.
357
     * 
357
     *
358 358
     * @return true if this store is in appending state.
359 359
     */
360 360
    public boolean isAppending();
......
362 362
    /**
363 363
     * Updates a {@link FeatureType} in the store with the changes in the
364 364
     * {@link EditableFeatureType}.<br>
365
     * 
365
     *
366 366
     * Any {@link FeatureSet} from this store that are used will be invalidated.
367
     * 
367
     *
368 368
     * @param featureType
369 369
     *            an {@link EditableFeatureType} with the changes.
370
     * 
370
     *
371 371
     * @throws DataException
372 372
     */
373 373
    public void update(EditableFeatureType featureType) throws DataException;
......
375 375
    /**
376 376
     * Updates a {@link Feature} in the store with the changes in the
377 377
     * {@link EditableFeature}.<br>
378
     * 
378
     *
379 379
     * Any {@link FeatureSet} from this store that was still in use will be
380 380
     * invalidated. You can override this using
381 381
     * {@link FeatureSet#update(EditableFeature)}.
382
     * 
382
     *
383 383
     * @param feature
384 384
     *            the feature to be updated
385
     * 
385
     *
386 386
     * @throws DataException
387 387
     */
388 388
    public void update(EditableFeature feature) throws DataException;
389 389

  
390 390
    /**
391 391
     * Deletes a {@link Feature} from the store.<br>
392
     * 
392
     *
393 393
     * Any {@link FeatureSet} from this store that was still in use will be
394 394
     * invalidated. You can override this using {@link Iterator#remove()} from
395 395
     * {@link FeatureSet}.
396
     * 
396
     *
397 397
     * @param feature
398 398
     *            The feature to be deleted.
399
     * 
399
     *
400 400
     * @throws DataException
401 401
     */
402 402
    public void delete(Feature feature) throws DataException;
403 403

  
404 404
    /**
405 405
     * Inserts a {@link Feature} in the store.<br>
406
     * 
406
     *
407 407
     * Any {@link FeatureSet} from this store that was still in use will be
408 408
     * invalidated. You can override this using
409 409
     * {@link FeatureSet#insert(EditableFeature)}.
410
     * 
410
     *
411 411
     * @param feature
412 412
     *            The feature to be inserted
413
     * 
413
     *
414 414
     * @throws DataException
415 415
     */
416 416
    public void insert(EditableFeature feature) throws DataException;
......
418 418
    /**
419 419
     * Creates a new feature using the default feature type and returns it as an
420 420
     * {@link EditableFeature}
421
     * 
421
     *
422 422
     * @return a new feature in editable state
423
     * 
423
     *
424 424
     * @throws DataException
425 425
     */
426 426
    public EditableFeature createNewFeature() throws DataException;
......
428 428
    /**
429 429
     * Creates a new feature of the given {@link FeatureType} and uses the given
430 430
     * {@link Feature} as default values to initialize it.
431
     * 
431
     *
432 432
     * @param type
433 433
     *            the new feature's feature type
434
     * 
434
     *
435 435
     * @param defaultValues
436 436
     *            a feature whose values are used as default values for the new
437 437
     *            feature.
438
     * 
438
     *
439 439
     * @return the new feature.
440
     * 
440
     *
441 441
     * @throws DataException
442 442
     */
443 443
    public EditableFeature createNewFeature(FeatureType type,
......
447 447
     * Creates a new feature of the given {@link FeatureType}. The flag
448 448
     * defaultValues is used to indicate whether the new feature should be
449 449
     * initialized with default values or not.
450
     * 
450
     *
451 451
     * @param type
452 452
     *            the new feature's feature type
453
     * 
453
     *
454 454
     * @param defaultValues
455 455
     *            if true the new feature is initialized with each attribute's
456 456
     *            default value.
457
     * 
457
     *
458 458
     * @return
459 459
     *         the new feature
460
     * 
460
     *
461 461
     * @throws DataException
462 462
     */
463 463
    public EditableFeature createNewFeature(FeatureType type,
......
467 467
     * Creates a new feature of default {@link FeatureType}. The flag
468 468
     * defaultValues is used to indicate whether the new feature should be
469 469
     * initialized with default values or not.
470
     * 
470
     *
471 471
     * @param defaultValues
472 472
     *            if true the new feature is initialized with each attribute's
473 473
     *            default value.
474
     * 
474
     *
475 475
     * @return
476 476
     *         the new feature
477
     * 
477
     *
478 478
     * @throws DataException
479 479
     */
480 480
    public EditableFeature createNewFeature(boolean defaultValues)
......
483 483
    /**
484 484
     * Applies the validation rules associated to the given mode to the active
485 485
     * {@link FeatureSet}.
486
     * 
486
     *
487 487
     * @param mode
488 488
     *            can be one of {MODE_QUERY, MODE_FULLEDIT, MODE_APPEND}
489
     * 
489
     *
490 490
     * @throws DataException
491 491
     */
492 492
    public void validateFeatures(int mode) throws DataException;
493 493

  
494 494
    /**
495 495
     * Indicates whether this store supports append mode.
496
     * 
496
     *
497 497
     * @return
498 498
     *         true if this store supports append mode.
499 499
     */
......
502 502
    /**
503 503
     * Initiates an editing group. This is typically used to group series of
504 504
     * store editing operations.
505
     * 
505
     *
506 506
     * @param description
507 507
     *            Description of the editing group.
508
     * 
508
     *
509 509
     * @throws NeedEditingModeException
510 510
     */
511 511
    public void beginEditingGroup(String description)
......
513 513

  
514 514
    /**
515 515
     * Finishes an editing group.
516
     * 
516
     *
517 517
     * @throws NeedEditingModeException
518 518
     */
519 519
    public void endEditingGroup() throws NeedEditingModeException;
520 520

  
521 521
    /*
522 522
     * =============================================================
523
     * 
523
     *
524 524
     * Index related services
525 525
     */
526 526

  
527 527
    /**
528 528
     * Creates an index which will be applied to the features of the given type,
529 529
     * by using the data of the given attribute.
530
     * 
530
     *
531 531
     * @param featureType
532 532
     *            The FeatureType to which the indexed attribute belongs.
533
     * 
533
     *
534 534
     * @param attributeName
535 535
     *            The name of the attributed to be indexed
536
     * 
536
     *
537 537
     * @param indexName
538 538
     *            The index name
539
     * 
539
     *
540 540
     * @return the resulting {@link FeatureIndex}
541
     * 
542
     * 
541
     *
542
     *
543 543
     * @throws FeatureIndexException
544 544
     *             if there is an error creating the index
545 545
     */
......
549 549
    /**
550 550
     * Creates an index which will be applied to the features of the given type,
551 551
     * by using the data of the given attribute.
552
     * 
552
     *
553 553
     * @param indexTypeName
554 554
     *            the type of the index to be created. That name is
555 555
     *            related to one of the registered index providers
556 556
     * @param featureType
557 557
     *            The FeatureType to which the indexed attribute belongs.
558
     * 
558
     *
559 559
     * @param attributeName
560 560
     *            The name of the attributed to be indexed
561
     * 
561
     *
562 562
     * @param indexName
563 563
     *            The index name
564
     * 
564
     *
565 565
     * @return the resulting {@link FeatureIndex}
566
     * 
567
     * 
566
     *
567
     *
568 568
     * @throws FeatureIndexException
569 569
     *             if there is an error creating the index
570 570
     */
......
580 580
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
581 581
     * when the index has finished filling with data and is available to be
582 582
     * used.
583
     * 
583
     *
584 584
     * @param featureType
585 585
     *            The FeatureType to which the indexed attribute belongs.
586
     * 
586
     *
587 587
     * @param attributeName
588 588
     *            The name of the attributed to be indexed
589
     * 
589
     *
590 590
     * @param indexName
591 591
     *            The index name
592
     * 
592
     *
593 593
     * @param observer
594 594
     *            to notify to when the created index has finished filling
595 595
     *            with data and is available to be used. The observer will
......
600 600
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
601 601
     *            notification with the exception object if there has been
602 602
     *            any error in the process. Optional.
603
     * 
603
     *
604 604
     * @return the resulting {@link FeatureIndex}
605
     * 
605
     *
606 606
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
607 607
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
608 608
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
609 609
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
610
     * 
610
     *
611 611
     * @throws FeatureIndexException
612 612
     *             if there is an error creating the index
613 613
     */
......
623 623
     * notified ( {@link FeatureStoreNotification#INDEX_FILLING_SUCCESS} )
624 624
     * when the index has finished filling with data and is available to be
625 625
     * used.
626
     * 
626
     *
627 627
     * @param indexTypeName
628 628
     *            the type of the index to be created. That name is
629 629
     *            related to one of the registered index providers
630 630
     * @param featureType
631 631
     *            The FeatureType to which the indexed attribute belongs.
632
     * 
632
     *
633 633
     * @param attributeName
634 634
     *            The name of the attributed to be indexed
635
     * 
635
     *
636 636
     * @param indexName
637 637
     *            The index name
638
     * 
638
     *
639 639
     * @param observer
640 640
     *            to notify to when the created index has finished filling
641 641
     *            with data and is available to be used. The observer will
......
646 646
     *            {@link FeatureStoreNotification#INDEX_FILLING_ERROR}
647 647
     *            notification with the exception object if there has been
648 648
     *            any error in the process. Optional.
649
     * 
649
     *
650 650
     * @return the resulting {@link FeatureIndex}
651
     * 
651
     *
652 652
     * @see FeatureStoreNotification#INDEX_FILLING_STARTED
653 653
     * @see FeatureStoreNotification#INDEX_FILLING_SUCCESS
654 654
     * @see FeatureStoreNotification#INDEX_FILLING_CANCELLED
655 655
     * @see FeatureStoreNotification#INDEX_FILLING_ERROR
656
     * 
656
     *
657 657
     * @throws FeatureIndexException
658 658
     *             if there is an error creating the index
659 659
     */
......
664 664
    /**
665 665
     * Returns a FeatureIndexes structure containing all available indexes in
666 666
     * the store.
667
     * 
667
     *
668 668
     * @return
669 669
     */
670 670
    public FeatureIndexes getIndexes();
671 671

  
672 672
    /*
673 673
     * =============================================================
674
     * 
674
     *
675 675
     * Selection related services
676 676
     */
677 677

  
678 678
    /**
679 679
     * Sets the selection to the passed {@link FeatureSet}
680
     * 
680
     *
681 681
     * @param selection
682 682
     *            A {@link FeatureSet} with the requested selection
683 683
     */
......
685 685

  
686 686
    /**
687 687
     * Creates a {@link FeatureSelection}
688
     * 
688
     *
689 689
     * @return
690 690
     *         a {@link FeatureSelection}
691
     * 
691
     *
692 692
     * @throws DataException
693 693
     */
694 694
    public FeatureSelection createFeatureSelection() throws DataException;
......
696 696
    /**
697 697
     * Returns the current {@link FeatureSelection}.
698 698
     * Create a empty selection if not exits.
699
     * 
699
     *
700 700
     * @return
701 701
     *         current {@link FeatureSelection}.
702
     * 
702
     *
703 703
     * @throws DataException
704 704
     */
705 705
    public FeatureSelection getFeatureSelection() throws DataException;
706 706

  
707 707
    /*
708 708
     * =============================================================
709
     * 
709
     *
710 710
     * Lock related services
711 711
     */
712 712

  
713 713
    /**
714 714
     * Indicates whether this store supports locks.
715
     * 
715
     *
716 716
     * @return
717 717
     *         true if this store supports locks, false if not.
718 718
     */
......
720 720

  
721 721
    /**
722 722
     * Returns the set of locked features
723
     * 
723
     *
724 724
     * @return
725 725
     *         set of locked features
726
     * 
726
     *
727 727
     * @throws DataException
728 728
     */
729 729
    public FeatureLocks getLocks() throws DataException;
......
736 736

  
737 737
    /**
738 738
     * Returns this store transforms
739
     * 
739
     *
740 740
     * @return
741 741
     *         this store transforms
742 742
     */
......
744 744

  
745 745
    /**
746 746
     * Returns a new {@link FeatureQuery} associated to this store.
747
     * 
747
     *
748 748
     * @return
749 749
     *         a new {@link FeatureQuery} associated to this store.
750 750
     */
......
752 752

  
753 753
    /**
754 754
     * Returns featue count of this store.
755
     * 
755
     *
756 756
     * @return
757 757
     * @throws DataException
758 758
     */
......
760 760

  
761 761
    /**
762 762
     * Creates a vectorial cache that is used to save and retrieve data.
763
     * 
763
     *
764 764
     * @param name
765 765
     *            the cache name.
766 766
     * @param parameters
......
779 779
     * Return if the provider knows the real envelope of a layer. If not,
780 780
     * the {@link FeatureStoreProvider#getEnvelope()} method doesn't return
781 781
     * the full envelope.
782
     * 
782
     *
783 783
     * @return
784 784
     *         <true> if it knows the real envelope.
785 785
     */
......
788 788
    /**
789 789
     * Return if the maximum number of features provided by the
790 790
     * provider are limited.
791
     * 
791
     *
792 792
     * @return
793 793
     *         <true> if there is a limit of features.
794 794
     */
......
798 798
     * If the {@link FeatureStoreProvider#hasRetrievedFeaturesLimit()} returns
799 799
     * true,
800 800
     * it returns the limit of features retrieved from the provider.
801
     * 
801
     *
802 802
     * @return
803 803
     *         The limit of the retrieved features.
804 804
     */
805 805
    public int getRetrievedFeaturesLimit();
806

  
807
    /**
808
     * Return the associated feature to the dynobject.
809
     * If the dynobject isn't associated to a feature of this store, return null.
810
     *
811
     * @param dynobject
812
     * @return
813
     */
814
    public Feature getFeature(DynObject dynobject);
806 815
}
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.impl/src/main/java/org/gvsig/fmap/dal/feature/impl/DefaultFeatureStore.java
102 102
import org.gvsig.fmap.dal.feature.exception.WriteNotAllowedException;
103 103
import org.gvsig.fmap.dal.feature.impl.expansionadapter.MemoryExpansionAdapter;
104 104
import org.gvsig.fmap.dal.feature.impl.featureset.DefaultFeatureSet;
105
import org.gvsig.fmap.dal.feature.impl.featureset.DynObjectFeatureFacade;
105 106
import org.gvsig.fmap.dal.feature.impl.undo.DefaultFeatureCommandsStack;
106 107
import org.gvsig.fmap.dal.feature.impl.undo.FeatureCommandsStack;
107 108
import org.gvsig.fmap.dal.feature.spi.DefaultFeatureProvider;
......
181 182
    private DefaultFeatureStoreTransforms transforms;
182 183

  
183 184
    DelegatedDynObject metadata;
184
    
185

  
185 186
    private Set metadataChildren;
186 187

  
187 188
    private Long featureCount = null;
......
192 193

  
193 194
    /*
194 195
     * TODO:
195
     * 
196
     *
196 197
     * - Comprobar que solo se pueden a�adir reglas de validacion sobre un
197 198
     * EditableFeatureType. - Comprobar que solo se puede hacer un update con un
198 199
     * featureType al que se le han cambiado las reglas de validacion cuando
......
334 335
     * // TODO:
335 336
     * // Si el provider devuelbe null habria que ver de construir aqui
336 337
     * // los metadatos basicos, como el Envelope y el SRS.
337
     * 
338
     *
338 339
     * // TODO: Estando en edicion el Envelope deberia de
339 340
     * // actualizarse usando el spatialManager
340 341
     * return this.provider.getMetadata();
......
344 345
    public Envelope getEnvelope() throws DataException {
345 346
        if (this.mode == MODE_FULLEDIT) {
346 347
        	// Just in case another thread tries to write in the store
347
        	synchronized (this) {				
348
        	synchronized (this) {
348 349
        		return this.spatialManager.getEnvelope();
349 350
			}
350 351
        }
......
479 480

  
480 481
            String defFTypeid = state.getString("defaultFeatureTypeId");
481 482
            FeatureType ftype = null;
482
            
483

  
483 484
            if (this.defaultFeatureType == null ||
484 485
                this.defaultFeatureType.getId() == null ||
485 486
                !this.defaultFeatureType.getId().equals(
......
973 974
        }
974 975
    }
975 976

  
976
    public void delete(Feature feature) throws DataException {       
977
    public void delete(Feature feature) throws DataException {
977 978
        this.commands.delete(feature);
978 979
    }
979
    
980

  
980 981
    synchronized public void doDelete(Feature feature) throws DataException {
981 982
        try {
982 983
            checkInEditingMode();
......
984 985
            if (feature instanceof EditableFeature) {
985 986
                throw new StoreDeleteEditableFeatureException(getName());
986 987
            }
987
            notifyChange(FeatureStoreNotification.BEFORE_DELETE, feature);            
988
            
988
            notifyChange(FeatureStoreNotification.BEFORE_DELETE, feature);
989

  
989 990
            //Update the featureManager and the spatialManager
990 991
            featureManager.delete(feature.getReference());
991 992
            spatialManager.deleteFeature(feature);
992
            
993

  
993 994
            newVersionOfUpdate();
994 995
            hasStrongChanges = true;
995 996
            notifyChange(FeatureStoreNotification.AFTER_DELETE, feature);
......
1000 1001

  
1001 1002
    private static EditableFeature lastChangedFeature = null;
1002 1003

  
1003
    public synchronized void insert(EditableFeature feature) 
1004
    public synchronized void insert(EditableFeature feature)
1004 1005
        throws DataException {
1005 1006
        LOG.debug("In editing mode {}, insert feature: {}", new Integer(mode),
1006 1007
            feature);
......
1023 1024
                notifyChange(FeatureStoreNotification.AFTER_INSERT, feature);
1024 1025
                break;
1025 1026

  
1026
            case MODE_FULLEDIT: 
1027
            case MODE_FULLEDIT:
1027 1028
                if (feature.getSource() != null) {
1028 1029
                    throw new NoNewFeatureInsertException(this.getName());
1029 1030
                }
1030
                commands.insert(feature);               
1031
                commands.insert(feature);
1031 1032
            }
1032 1033
        } catch (Exception e) {
1033 1034
            throw new StoreInsertFeatureException(e, this.getName());
1034 1035
        }
1035 1036
    }
1036
    
1037

  
1037 1038
    synchronized public void doInsert(EditableFeature feature)
1038 1039
        throws DataException {
1039 1040
        checkIsOwnFeature(feature);
1040
   
1041

  
1041 1042
        waitForIndexes();
1042 1043

  
1043 1044
        notifyChange(FeatureStoreNotification.BEFORE_INSERT, feature);
......
1051 1052
        //Update the featureManager and the spatialManager
1052 1053
        ((DefaultEditableFeature) feature).setInserted(true);
1053 1054
        DefaultFeature newFeature = (DefaultFeature) feature.getNotEditableCopy();
1054
        
1055
        
1055

  
1056

  
1056 1057
        featureManager.add(newFeature);
1057 1058
        spatialManager.insertFeature(newFeature);
1058
        
1059

  
1059 1060
        hasStrongChanges = true;
1060 1061
        hasInserts = true;
1061
        notifyChange(FeatureStoreNotification.AFTER_INSERT, feature);       
1062
        notifyChange(FeatureStoreNotification.AFTER_INSERT, feature);
1062 1063
    }
1063
    
1064

  
1064 1065
    public void update(EditableFeature feature)
1065
    throws DataException {        
1066
    throws DataException {
1066 1067
        if ((feature).getSource() == null) {
1067 1068
            insert(feature);
1068 1069
            return;
......
1072 1073

  
1073 1074
    synchronized public void doUpdate(EditableFeature feature, Feature oldFeature)
1074 1075
        throws DataException {
1075
        try {          
1076
        try {
1076 1077
            checkInEditingMode();
1077 1078
            checkIsOwnFeature(feature);
1078 1079
            notifyChange(FeatureStoreNotification.BEFORE_UPDATE, feature);
......
1083 1084
                feature.validate(Feature.UPDATE);
1084 1085
                lastChangedFeature = null;
1085 1086
            }
1086
            
1087

  
1087 1088
            //Update the featureManager and the spatialManager
1088 1089
            Feature newf = feature.getNotEditableCopy();
1089 1090
            featureManager.update(newf, oldFeature);
1090 1091
            spatialManager.updateFeature(newf, oldFeature);
1091
   
1092

  
1092 1093
            hasStrongChanges = true;
1093 1094
            notifyChange(FeatureStoreNotification.AFTER_UPDATE, feature);
1094 1095
        } catch (Exception e) {
......
1170 1171
    synchronized public void finishEditing() throws DataException {
1171 1172
        LOG.debug("finish editing of mode: {}", new Integer(mode));
1172 1173
        try {
1173
            
1174

  
1174 1175
            /*
1175 1176
             * Selection needs to be cleared when editing stops
1176 1177
             * to prevent conflicts with selection remaining from
1177 1178
             * editing mode.
1178 1179
             */
1179 1180
            ((FeatureSelection) this.getSelection()).deselectAll();
1180
            
1181

  
1181 1182
            switch (mode) {
1182 1183
            case MODE_QUERY:
1183 1184
                throw new NeedEditingModeException(this.getName());
......
1197 1198
                notifyChange(FeatureStoreNotification.BEFORE_FINISHEDITING);
1198 1199
                if (hasStrongChanges) {
1199 1200
                    validateFeatures(Feature.FINISH_EDITING);
1200
                    
1201

  
1201 1202
                    /*
1202 1203
                     * This will throw a PerformEditingExceptionif the provider
1203 1204
                     * does not accept the changes (for example, an invalid field name)
......
1285 1286
    	default:
1286 1287
        case MODE_QUERY:
1287 1288
        	return false;
1288
        	
1289

  
1289 1290
        case MODE_APPEND:
1290 1291
        	return true;
1291
        
1292

  
1292 1293
        case MODE_FULLEDIT:
1293 1294
            List types = this.getFeatureTypes();
1294 1295
            for( int i=0; i<types.size(); i++ ) {
......
1302 1303
            return true;
1303 1304
    	}
1304 1305
    }
1305
    
1306

  
1306 1307
    public void beginEditingGroup(String description)
1307 1308
        throws NeedEditingModeException {
1308 1309
        checkInEditingMode();
......
1524 1525
                return f;
1525 1526
            }
1526 1527
        }
1527
    
1528
        
1528

  
1529

  
1529 1530
        DefaultFeature feature =
1530 1531
            new DefaultFeature(this,
1531 1532
                this.provider.getFeatureProviderByReference(
......
1645 1646

  
1646 1647
    public FeatureType getDefaultFeatureType() throws DataException {
1647 1648
        try {
1648
            
1649

  
1649 1650
            if (isEditing()) {
1650 1651
                FeatureType auxFeatureType =
1651 1652
                    featureTypeManager.getType(defaultFeatureType.getId());
......
1657 1658
            if (type != null) {
1658 1659
                return avoidEditable(type);
1659 1660
            }
1660
            
1661

  
1661 1662
            return avoidEditable(defaultFeatureType);
1662
            
1663

  
1663 1664
        } catch (Exception e) {
1664 1665
            throw new GetFeatureTypeException(e, getName());
1665 1666
        }
1666 1667
    }
1667
    
1668

  
1668 1669
    private FeatureType avoidEditable(FeatureType ft) {
1669 1670
        if (ft instanceof EditableFeatureType) {
1670 1671
            return ((EditableFeatureType) ft).getNotEditableCopy();
......
1766 1767
                new DefaultEditableFeature(this, data);
1767 1768
            feature.initializeValues(defaultValues);
1768 1769
            data.setNew(true);
1769
            
1770

  
1770 1771
            return feature;
1771 1772
        } catch (Exception e) {
1772 1773
            throw new CreateFeatureException(e, getName());
......
1993 1994

  
1994 1995
    /*
1995 1996
     * (non-Javadoc)
1996
     * 
1997
     *
1997 1998
     * @see org.gvsig.metadata.Metadata#getMetadataChildren()
1998 1999
     */
1999 2000
    public Set getMetadataChildren() {
......
2002 2003

  
2003 2004
    /*
2004 2005
     * (non-Javadoc)
2005
     * 
2006
     *
2006 2007
     * @see org.gvsig.metadata.Metadata#getMetadataName()
2007 2008
     */
2008 2009
    public String getMetadataName() {
......
2101 2102
        return this.provider.getRetrievedFeaturesLimit();
2102 2103
    }
2103 2104

  
2104
    public Interval getInterval() {  
2105
    public Interval getInterval() {
2105 2106
        return this.provider.getInterval();
2106 2107
    }
2107 2108

  
2108
    public Collection getTimes() {      
2109
    public Collection getTimes() {
2109 2110
        return this.provider.getTimes();
2110 2111
    }
2111 2112

  
2112
    public Collection getTimes(Interval interval) {       
2113
    public Collection getTimes(Interval interval) {
2113 2114
        return this.provider.getTimes(interval);
2114 2115
    }
2115
    
2116

  
2116 2117
    /* (non-Javadoc)
2117 2118
     * @see java.lang.Object#clone()
2118 2119
     */
2119 2120
    public Object clone() throws CloneNotSupportedException {
2120
        
2121

  
2121 2122
        DataStoreParameters dsp = getParameters();
2122
        
2123

  
2123 2124
        DefaultFeatureStore cloned_store = null;
2124
        
2125

  
2125 2126
        try {
2126 2127
            cloned_store = (DefaultFeatureStore) DALLocator.getDataManager().
2127 2128
                openStore(this.getProviderName(), dsp);
......
2131 2132
            }
2132 2133
        } catch (Exception e) {
2133 2134
            throw new CloneException(e);
2134
        }   
2135
        }
2135 2136
        return cloned_store;
2136
        
2137

  
2137 2138
    }
2139

  
2140
    public Feature getFeature(DynObject dynobject) {
2141
        if (dynobject instanceof DynObjectFeatureFacade){
2142
            Feature f = ((DynObjectFeatureFacade)dynobject).getFeature();
2143
            return f;
2144
        }
2145
        return null;
2146
    }
2138 2147
}

Also available in: Unified diff