Revision 43954 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

View differences:

DefaultFeatureStore.java
24 24

  
25 25
package org.gvsig.fmap.dal.feature.impl;
26 26

  
27
import java.io.File;
27 28
import org.gvsig.fmap.dal.feature.impl.editing.memory.SpatialManager;
28 29
import org.gvsig.fmap.dal.feature.impl.editing.memory.FeatureTypeManager;
29 30
import org.gvsig.fmap.dal.feature.impl.editing.memory.FeatureManager;
......
39 40
import java.util.Map;
40 41
import java.util.Map.Entry;
41 42
import java.util.Set;
43
import java.util.logging.Level;
42 44

  
43 45
import org.apache.commons.io.FilenameUtils;
44 46
import org.apache.commons.lang3.StringUtils;
......
351 353
        }
352 354
        this.notifyChange(DataStoreNotification.BEFORE_OPEN);
353 355
        this.provider.open();
356
        loadDALFile();
354 357
        this.notifyChange(DataStoreNotification.AFTER_OPEN);
355 358
    }
356 359

  
......
1465 1468
                        featureManager.getInserted(),
1466 1469
                        featureManager.getUpdated(),
1467 1470
                        featureTypeManager.getFeatureTypesChanged());
1468
                }
1471
                }  
1472
                saveDALFile();
1469 1473
                exitEditingMode();
1470 1474
                updateIndexes();
1471 1475
                notifyChange(FeatureStoreNotification.AFTER_FINISHEDITING);
......
1478 1482
        }
1479 1483
    }
1480 1484

  
1485
    @SuppressWarnings("UseSpecificCatch")
1486
    private void saveDALFile() {       
1487
        try {
1488
            DataServerExplorer explorer = this.getExplorer();
1489
            File f = explorer.getResourcePath(this, "dal");
1490
            if( f == null ) {
1491
                return;
1492
            }
1493
            DALFile dalFile = DALFile.getDALFile();
1494
            dalFile.setStore(this);
1495
            if( !dalFile.isEmpty() ) {
1496
                dalFile.write(f);
1497
            }
1498
        } catch (Exception ex) {
1499
            LOG.warn("Can't save DAL File", ex);
1500
        }
1501
    }
1502
    
1503
    @SuppressWarnings("UseSpecificCatch")
1504
    private void loadDALFile() {
1505
        try {
1506
            DataServerExplorer explorer = this.getExplorer();
1507
            File f = explorer.getResourcePath(this, "dal");
1508
            if( f == null ) {
1509
                return;
1510
            }
1511
            DALFile dalFile = DALFile.getDALFile(f);
1512
            if( !dalFile.isEmpty() ) {
1513
                dalFile.updateStore(this);
1514
            }
1515
        } catch (Exception ex) {
1516
            LOG.warn("Can't load DAL File", ex);
1517
        }
1518
    }
1519
    
1481 1520
    /**
1482 1521
     * Save changes in the provider without leaving the edit mode.
1483 1522
     * Do not call observers to communicate a change of ediding mode.

Also available in: Unified diff