Revision 23879 branches/v2_0_0_prep/libraries/libFMap_data/src/org/gvsig/fmap/data/feature/impl/DefaultFeatureStore.java
DefaultFeatureStore.java | ||
---|---|---|
13 | 13 |
import org.gvsig.fmap.data.DataSet; |
14 | 14 |
import org.gvsig.fmap.data.DataStoreNotification; |
15 | 15 |
import org.gvsig.fmap.data.DataStoreParameters; |
16 |
import org.gvsig.fmap.data.Resource; |
|
17 |
import org.gvsig.fmap.data.ResourceNotification; |
|
18 | 16 |
import org.gvsig.fmap.data.exceptions.CloseException; |
19 | 17 |
import org.gvsig.fmap.data.exceptions.DataException; |
20 | 18 |
import org.gvsig.fmap.data.exceptions.InitializeException; |
... | ... | |
22 | 20 |
import org.gvsig.fmap.data.exceptions.ReadException; |
23 | 21 |
import org.gvsig.fmap.data.feature.Command; |
24 | 22 |
import org.gvsig.fmap.data.feature.CommandsRecord; |
25 |
import org.gvsig.fmap.data.feature.DataIndex; |
|
26 |
import org.gvsig.fmap.data.feature.DataIndexes; |
|
27 | 23 |
import org.gvsig.fmap.data.feature.EditableFeature; |
28 | 24 |
import org.gvsig.fmap.data.feature.EditableFeatureType; |
29 | 25 |
import org.gvsig.fmap.data.feature.Feature; |
... | ... | |
38 | 34 |
import org.gvsig.fmap.data.feature.exceptions.ConcurrentDataModificationException; |
39 | 35 |
import org.gvsig.fmap.data.feature.exceptions.CreateFeatureException; |
40 | 36 |
import org.gvsig.fmap.data.feature.exceptions.DataExportException; |
41 |
import org.gvsig.fmap.data.feature.exceptions.DataIndexException; |
|
42 | 37 |
import org.gvsig.fmap.data.feature.exceptions.FeatureNotAllowedForThisStoreException; |
43 | 38 |
import org.gvsig.fmap.data.feature.exceptions.FeatureTypeNotAllowedForThisStoreException; |
44 | 39 |
import org.gvsig.fmap.data.feature.exceptions.FinishEditingException; |
... | ... | |
67 | 62 |
import org.gvsig.fmap.data.feature.spi.FeatureLocks; |
68 | 63 |
import org.gvsig.fmap.data.feature.spi.FeatureSelection; |
69 | 64 |
import org.gvsig.fmap.data.feature.spi.FeatureStoreProvider; |
65 |
import org.gvsig.fmap.data.feature.spi.FeatureStoreProviderServices; |
|
70 | 66 |
import org.gvsig.fmap.data.feature.spi.TemporaryContainer; |
71 | 67 |
import org.gvsig.fmap.data.impl.DefaultDataManager; |
72 |
import org.gvsig.fmap.data.spi.AbstractResource; |
|
68 |
import org.gvsig.fmap.data.index.Index; |
|
69 |
import org.gvsig.fmap.data.index.IndexException; |
|
70 |
import org.gvsig.fmap.data.resource.ResourceNotification; |
|
73 | 71 |
import org.gvsig.fmap.geom.primitive.Envelope; |
74 | 72 |
import org.gvsig.metadata.Metadata; |
75 | 73 |
import org.gvsig.tools.exception.BaseException; |
... | ... | |
80 | 78 |
import org.gvsig.tools.operations.OperationContext; |
81 | 79 |
import org.gvsig.tools.operations.OperationException; |
82 | 80 |
import org.gvsig.tools.operations.OperationNotSupportedException; |
81 |
import org.slf4j.Logger; |
|
82 |
import org.slf4j.LoggerFactory; |
|
83 | 83 |
|
84 | 84 |
import com.iver.utiles.XMLEntity; |
85 | 85 |
import com.iver.utiles.XMLException; |
86 | 86 |
|
87 | 87 |
final public class DefaultFeatureStore implements |
88 |
org.gvsig.fmap.data.feature.spi.FeatureStoreProviderServices, Observer { |
|
88 |
FeatureStoreProviderServices, |
|
89 |
Observer { |
|
89 | 90 |
|
90 | 91 |
private DataStoreParameters parameters = null; |
91 | 92 |
private FeatureSelection selection; |
... | ... | |
111 | 112 |
|
112 | 113 |
private FeatureStoreProvider provider = null; |
113 | 114 |
|
115 |
private Logger logger = null; |
|
116 |
|
|
114 | 117 |
/* |
115 | 118 |
* TODO: |
116 | 119 |
* |
... | ... | |
272 | 275 |
|
273 | 276 |
public FeatureData createDefaultFeatureData(FeatureType type) |
274 | 277 |
throws DataException { |
275 |
return new DefaultFeatureData((DefaultFeatureType) type);
|
|
278 |
return new DefaultFeatureData(type); |
|
276 | 279 |
} |
277 | 280 |
|
278 | 281 |
// |
... | ... | |
462 | 465 |
|
463 | 466 |
// |
464 | 467 |
// ==================================================================== |
465 |
// Gestion de recursos |
|
466 |
// |
|
467 |
|
|
468 |
public void removeAllResources() { |
|
469 |
Iterator iter = this.resources.iterator(); |
|
470 |
while (iter.hasNext()) { |
|
471 |
((AbstractResource) iter.next()).deleteObserver(this); |
|
472 |
} |
|
473 |
this.resources.clear(); |
|
474 |
} |
|
475 |
|
|
476 |
public Resource addResource(Resource resource) throws DataException { |
|
477 |
Resource finalResource = this.getManager().getResourceManager() |
|
478 |
.addResource(resource, this); |
|
479 |
if (!this.resources.contains(finalResource)) { |
|
480 |
((AbstractResource) finalResource).addObserver(this); |
|
481 |
this.resources.add(finalResource); |
|
482 |
} |
|
483 |
return finalResource; |
|
484 |
|
|
485 |
|
|
486 |
} |
|
487 |
|
|
488 |
// |
|
489 |
// ==================================================================== |
|
490 | 468 |
// Gestion de observers |
491 | 469 |
// |
492 | 470 |
|
... | ... | |
1047 | 1025 |
} |
1048 | 1026 |
} |
1049 | 1027 |
|
1050 |
public Feature createFeature(FeatureType type, FeatureData data)
|
|
1028 |
public Feature createFeature(FeatureData data) |
|
1051 | 1029 |
throws DataException { |
1052 | 1030 |
DefaultFeature feature = new DefaultFeature(this, data); |
1053 | 1031 |
return feature; |
1054 | 1032 |
} |
1055 | 1033 |
|
1034 |
/** |
|
1035 |
* @deprecated |
|
1036 |
*/ |
|
1037 |
public Feature createFeature(FeatureType type, FeatureData data) |
|
1038 |
throws DataException { |
|
1039 |
// FIXME: falta por implementar |
|
1040 |
// Comprobar si es un subtipo del feature de data |
|
1041 |
// y construir un feature usando el subtipo. |
|
1042 |
// Probablemente requiera generar una copia del data. |
|
1043 |
return null; |
|
1044 |
} |
|
1045 |
|
|
1056 | 1046 |
public EditableFeature createFeature(FeatureType type, |
1057 | 1047 |
Feature defaultValues) |
1058 | 1048 |
throws DataException { |
... | ... | |
1094 | 1084 |
return this.createFeature(this.getDefaultFeatureType(), true); |
1095 | 1085 |
} |
1096 | 1086 |
|
1097 |
public EditableFeatureType createFeatureType() { |
|
1098 |
return new DefaultEditableFeatureType(); |
|
1099 |
} |
|
1100 |
|
|
1101 |
public boolean isLocksSupported() { |
|
1102 |
return this.provider.isLocksSupported(); |
|
1103 |
} |
|
1104 |
|
|
1105 |
public DataIndex createDataIndex(FeatureType featureType, |
|
1106 |
String attributeName, String indexName) throws DataIndexException { |
|
1087 |
public Index createIndex(FeatureType type, |
|
1088 |
String colName) throws IndexException { |
|
1107 | 1089 |
// TODO Auto-generated method stub |
1108 | 1090 |
return null; |
1109 | 1091 |
} |
1110 | 1092 |
|
1111 |
public DataIndexes getDataIndexes() {
|
|
1093 |
public boolean hasIndex(FeatureType type, String attributeName) {
|
|
1112 | 1094 |
// TODO Auto-generated method stub |
1113 |
return null;
|
|
1095 |
return false;
|
|
1114 | 1096 |
} |
1115 | 1097 |
|
1116 |
public boolean hasDataIndex(FeatureType featureType, String attributeName) { |
|
1117 |
// TODO Auto-generated method stub |
|
1118 |
return false; |
|
1098 |
public EditableFeatureType createFeatureType() { |
|
1099 |
return new DefaultEditableFeatureType(); |
|
1119 | 1100 |
} |
1120 | 1101 |
|
1102 |
public boolean isLocksSupported() { |
|
1103 |
return this.provider.isLocksSupported(); |
|
1104 |
} |
|
1105 |
|
|
1106 |
public Logger getLogger() { |
|
1107 |
if (this.logger == null) { |
|
1108 |
this.logger = LoggerFactory.getLogger(this.getClass()); |
|
1109 |
} |
|
1110 |
return this.logger; |
|
1111 |
} |
|
1121 | 1112 |
} |
Also available in: Unified diff