Revision 44328 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/impl/DefaultDataManager.java
DefaultDataManager.java | ||
---|---|---|
10 | 10 |
import java.util.HashMap; |
11 | 11 |
import java.util.List; |
12 | 12 |
import java.util.Map; |
13 |
import org.apache.commons.io.IOUtils; |
|
13 | 14 |
import org.apache.commons.lang3.StringUtils; |
14 | 15 |
import org.gvsig.expressionevaluator.Expression; |
15 | 16 |
import org.gvsig.expressionevaluator.ExpressionBuilder; |
... | ... | |
47 | 48 |
import org.gvsig.fmap.dal.feature.FeatureQuery; |
48 | 49 |
import org.gvsig.fmap.dal.feature.FeatureStore; |
49 | 50 |
import org.gvsig.fmap.dal.feature.FeatureType; |
51 |
import org.gvsig.fmap.dal.feature.impl.DALFile; |
|
50 | 52 |
import org.gvsig.fmap.dal.feature.impl.DefaultEditableFeatureType; |
51 | 53 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureIndex; |
54 |
import org.gvsig.fmap.dal.feature.impl.DefaultFeatureStore; |
|
52 | 55 |
import org.gvsig.fmap.dal.feature.impl.FeatureStoreFactory; |
53 | 56 |
import org.gvsig.fmap.dal.feature.paging.FeaturePagingHelper; |
54 | 57 |
import org.gvsig.fmap.dal.feature.paging.impl.FeaturePagingHelperImpl; |
... | ... | |
84 | 87 |
import org.gvsig.tools.identitymanagement.SimpleIdentityManager; |
85 | 88 |
import org.gvsig.tools.identitymanagement.UnauthorizedException; |
86 | 89 |
import org.gvsig.tools.persistence.PersistenceManager; |
90 |
import org.gvsig.tools.resourcesstorage.ResourcesStorage; |
|
87 | 91 |
import org.gvsig.tools.service.spi.Services; |
88 | 92 |
import org.slf4j.Logger; |
89 | 93 |
import org.slf4j.LoggerFactory; |
... | ... | |
1026 | 1030 |
DatabaseWorkspaceManager workspace = new DefaultDatabaseWorkspaceManager(connection); |
1027 | 1031 |
return workspace; |
1028 | 1032 |
} |
1033 |
|
|
1034 |
@Override |
|
1035 |
public void writeDALResource(ResourcesStorage resources, DataStore store) { |
|
1036 |
ResourcesStorage.Resource resource = null; |
|
1037 |
try { |
|
1038 |
if( resources == null || resources.isReadOnly() ) { |
|
1039 |
return; |
|
1040 |
} |
|
1041 |
resource = resources.getResource("dal"); |
|
1042 |
if( resource == null || resource.isReadOnly() ) { |
|
1043 |
return; |
|
1044 |
} |
|
1045 |
DALFile dalFile = DALFile.getDALFile(); |
|
1046 |
dalFile.setStore((DefaultFeatureStore) store); |
|
1047 |
if( !dalFile.isEmpty() ) { |
|
1048 |
dalFile.write(resource); |
|
1049 |
} |
|
1050 |
} catch (Throwable ex) { |
|
1051 |
LOGGER.warn("Can't save DAL resource", ex); |
|
1052 |
} finally { |
|
1053 |
IOUtils.closeQuietly(resource); |
|
1054 |
} |
|
1055 |
|
|
1056 |
|
|
1057 |
} |
|
1058 |
|
|
1059 |
@Override |
|
1060 |
public void writeDALResource(ResourcesStorage resources, FeatureType featureType) { |
|
1061 |
ResourcesStorage.Resource resource = null; |
|
1062 |
try { |
|
1063 |
if( resources == null || resources.isReadOnly() ) { |
|
1064 |
return; |
|
1065 |
} |
|
1066 |
resource = resources.getResource("dal"); |
|
1067 |
if( resource == null || resource.isReadOnly() ) { |
|
1068 |
return; |
|
1069 |
} |
|
1070 |
DALFile dalFile = DALFile.getDALFile(); |
|
1071 |
dalFile.setFeatureType(featureType); |
|
1072 |
if( !dalFile.isEmpty() ) { |
|
1073 |
dalFile.write(resource); |
|
1074 |
} |
|
1075 |
} catch (Throwable ex) { |
|
1076 |
LOGGER.warn("Can't save DAL resource", ex); |
|
1077 |
} finally { |
|
1078 |
IOUtils.closeQuietly(resource); |
|
1079 |
} |
|
1080 |
} |
|
1029 | 1081 |
} |
Also available in: Unified diff