Revision 23754 branches/v2_0_0_prep/libraries/libFMap_dataDB/src/org/gvsig/fmap/data/feature/db/jdbc/h2/H2Store.java
H2Store.java | ||
---|---|---|
7 | 7 |
import java.util.Iterator; |
8 | 8 |
import java.util.Locale; |
9 | 9 |
|
10 |
import org.gvsig.fmap.data.CloseException; |
|
11 | 10 |
import org.gvsig.fmap.data.DataCollection; |
12 |
import org.gvsig.fmap.data.DataException; |
|
13 | 11 |
import org.gvsig.fmap.data.DataExplorer; |
14 | 12 |
import org.gvsig.fmap.data.DataManager; |
15 |
import org.gvsig.fmap.data.InitializeException; |
|
16 |
import org.gvsig.fmap.data.OpenException; |
|
17 |
import org.gvsig.fmap.data.ReadException; |
|
13 |
import org.gvsig.fmap.data.exceptions.CloseException; |
|
14 |
import org.gvsig.fmap.data.exceptions.DataException; |
|
15 |
import org.gvsig.fmap.data.exceptions.InitializeException; |
|
16 |
import org.gvsig.fmap.data.exceptions.OpenException; |
|
17 |
import org.gvsig.fmap.data.exceptions.ReadException; |
|
18 | 18 |
import org.gvsig.fmap.data.feature.Feature; |
19 | 19 |
import org.gvsig.fmap.data.feature.FeatureCollection; |
20 | 20 |
import org.gvsig.fmap.data.feature.FeatureType; |
21 |
import org.gvsig.fmap.data.feature.InitializeWriterException; |
|
22 | 21 |
import org.gvsig.fmap.data.feature.db.DBFeatureType; |
23 | 22 |
import org.gvsig.fmap.data.feature.db.DBResource; |
24 | 23 |
import org.gvsig.fmap.data.feature.db.jdbc.JDBCFeaturesWriter; |
25 | 24 |
import org.gvsig.fmap.data.feature.db.jdbc.JDBCStore; |
26 | 25 |
import org.gvsig.fmap.data.feature.db.jdbc.JDBCStoreParameters; |
26 |
import org.gvsig.fmap.data.feature.exceptions.InitializeWriterException; |
|
27 |
import org.gvsig.fmap.data.impl.DefaultDataManager; |
|
27 | 28 |
import org.gvsig.fmap.geom.Geometry; |
28 | 29 |
import org.gvsig.fmap.geom.primitive.DefaultEnvelope; |
29 | 30 |
import org.gvsig.fmap.geom.primitive.Envelope; |
30 |
import org.gvsig.metadata.IMetadata; |
|
31 |
import org.gvsig.metadata.IMetadataManager; |
|
31 |
import org.gvsig.metadata.Metadata; |
|
32 | 32 |
import org.gvsig.metadata.MetadataManager; |
33 |
import org.gvsig.metadata.DefaultMetadataManager; |
|
33 | 34 |
import org.gvsig.tools.exception.BaseException; |
34 | 35 |
|
35 | 36 |
public class H2Store extends JDBCStore{ |
... | ... | |
68 | 69 |
|
69 | 70 |
} else{ |
70 | 71 |
for (int i=0;i<fieldsID.length;i++){ |
71 |
if (this.getDefaultFeatureType().getFieldIndex(fieldsID[i]) < 0) {
|
|
72 |
if (this.getDefaultFeatureType().getIndex(fieldsID[i]) < 0) { |
|
72 | 73 |
|
73 | 74 |
throw new InitializeException("Field id '"+ fieldsID[i] +"' (id pos "+ (i+1) +") not Found", |
74 | 75 |
this.getName()); |
... | ... | |
174 | 175 |
} |
175 | 176 |
|
176 | 177 |
public DataExplorer getExplorer() throws ReadException { |
177 |
DataManager dm = DataManager.getManager(); |
|
178 |
DataManager dm = DefaultDataManager.getManager();
|
|
178 | 179 |
H2ExplorerParameters explorerParams = (H2ExplorerParameters)dm.createDataExplorerParameters(H2Explorer.DATAEXPLORER_NAME); |
179 | 180 |
explorerParams.putAllDefaultValues(this.getParametersH2()); |
180 | 181 |
return dm.createDataExplorer(explorerParams); |
181 | 182 |
} |
182 | 183 |
|
183 |
public IMetadata getMetadata() throws BaseException{
|
|
184 |
public Metadata getMetadata() throws BaseException{ |
|
184 | 185 |
|
185 | 186 |
if (metadata==null){ |
186 |
IMetadataManager manager=MetadataManager.getManager();
|
|
187 |
MetadataManager manager=DefaultMetadataManager.getManager();
|
|
187 | 188 |
metadata=manager.create(DATASTORE_NAME); |
188 | 189 |
Envelope extent=this.getFullExtent(); |
189 | 190 |
metadata.set("extent",extent); |
... | ... | |
196 | 197 |
if (spatialManager.isFullExtentDirty()){ |
197 | 198 |
if (!featureCollection.isEmpty()){ |
198 | 199 |
Iterator featureIterator=featureCollection.iterator(); |
199 |
extent = ((Feature)featureIterator.next()).getExtent();
|
|
200 |
extent = ((Feature)featureIterator.next()).getDefaultEnvelope();
|
|
200 | 201 |
while(featureIterator.hasNext()){ |
201 | 202 |
Feature feature=(Feature)featureIterator.next(); |
202 |
Envelope boundExtent=feature.getExtent();
|
|
203 |
Envelope boundExtent=feature.getDefaultEnvelope();
|
|
203 | 204 |
if (boundExtent!=null) { |
204 | 205 |
extent.add(boundExtent); |
205 | 206 |
} |
Also available in: Unified diff