Revision 47643
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/csv/CSVFilesystemServerProvider.java | ||
---|---|---|
29 | 29 |
import org.gvsig.fmap.dal.DALLocator; |
30 | 30 |
import org.gvsig.fmap.dal.DataManager; |
31 | 31 |
|
32 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
33 | 32 |
import org.gvsig.fmap.dal.DataStoreParameters; |
34 | 33 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
35 | 34 |
import org.gvsig.fmap.dal.exception.CreateException; |
36 | 35 |
import org.gvsig.fmap.dal.exception.DataException; |
37 |
import org.gvsig.fmap.dal.exception.FileNotFoundException; |
|
38 | 36 |
import org.gvsig.fmap.dal.exception.InitializeException; |
39 |
import org.gvsig.fmap.dal.exception.RemoveException; |
|
40 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
|
41 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
42 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
43 | 37 |
import org.gvsig.fmap.dal.feature.NewFeatureStoreParameters; |
44 | 38 |
import org.gvsig.fmap.dal.resource.ResourceAction; |
45 | 39 |
import org.gvsig.fmap.dal.resource.exception.ResourceExecuteException; |
46 | 40 |
import org.gvsig.fmap.dal.resource.file.FileResource; |
47 |
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer; |
|
48 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
|
49 | 41 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.AbsolutePathRequiredException; |
50 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider; |
|
51 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider; |
|
52 | 42 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices; |
53 |
import org.gvsig.tools.dataTypes.DataTypes;
|
|
43 |
import org.gvsig.fmap.dal.store.simplereader.SimpleReaderFilesystemServerProvider;
|
|
54 | 44 |
import org.supercsv.comment.CommentStartsWith; |
55 | 45 |
import org.supercsv.prefs.CsvPreference; |
56 | 46 |
import org.supercsv.quote.QuoteMode; |
57 | 47 |
|
58 |
public class CSVFilesystemServerProvider extends AbstractFilesystemServerExplorerProvider
|
|
59 |
implements FilesystemServerExplorerProvider, ResourceConsumer {
|
|
48 |
public class CSVFilesystemServerProvider extends |
|
49 |
SimpleReaderFilesystemServerProvider {
|
|
60 | 50 |
|
61 |
protected FilesystemServerExplorerProviderServices serverExplorer; |
|
62 |
|
|
63 | 51 |
@Override |
64 | 52 |
public String getDataStoreProviderName() { |
65 | 53 |
return CSVStoreProvider.NAME; |
66 | 54 |
} |
67 | 55 |
|
68 | 56 |
@Override |
69 |
public int getMode() {
|
|
70 |
return DataServerExplorer.MODE_FEATURE | DataServerExplorer.MODE_GEOMETRY;
|
|
57 |
public String getDescription() {
|
|
58 |
return CSVStoreProvider.DESCRIPTION;
|
|
71 | 59 |
} |
72 | 60 |
|
73 | 61 |
@Override |
74 |
public boolean accept(File file) { |
|
75 |
String pathname = file.getName().toLowerCase(); |
|
76 |
if ( pathname.endsWith(".csv")){ |
|
77 |
return true; |
|
78 |
} |
|
79 |
return false; |
|
62 |
protected String getFileExtension() { |
|
63 |
return ".csv"; |
|
80 | 64 |
} |
81 | 65 |
|
82 | 66 |
@Override |
83 |
public String getDescription() { |
|
84 |
return CSVStoreProvider.DESCRIPTION; |
|
85 |
} |
|
86 |
|
|
87 |
@Override |
|
88 | 67 |
public DataStoreParameters getParameters(File file) throws DataException { |
89 | 68 |
DataManager manager = DALLocator.getDataManager(); |
90 | 69 |
CSVStoreParameters params = (CSVStoreParameters) manager |
... | ... | |
236 | 215 |
.getServerExplorerProviderServices().createNewFeatureType()); |
237 | 216 |
return params; |
238 | 217 |
} |
239 |
|
|
240 |
@Override |
|
241 |
public void initialize(FilesystemServerExplorerProviderServices serverExplorer) { |
|
242 |
this.serverExplorer = serverExplorer; |
|
243 |
|
|
244 |
} |
|
245 |
|
|
246 |
@Override |
|
247 |
public void remove(DataStoreParameters parameters) throws RemoveException { |
|
248 |
CSVStoreParameters params = (CSVStoreParameters) parameters; |
|
249 |
File file = params.getFile(); |
|
250 |
if (!file.exists()) { |
|
251 |
throw new RemoveException(this.getDataStoreProviderName(), |
|
252 |
new FileNotFoundException(params.getFile())); |
|
253 |
} |
|
254 |
if (!file.delete()) { |
|
255 |
throw new RemoveException(this.getDataStoreProviderName(), |
|
256 |
new IOException()); // FIXME Exception |
|
257 |
} |
|
258 |
} |
|
259 |
|
|
260 |
@Override |
|
261 |
public boolean closeResourceRequested(ResourceProvider resource) { |
|
262 |
// while it is using a resource anyone can't close it |
|
263 |
return !(this.equals(resource)); |
|
264 |
} |
|
265 |
|
|
266 |
/* |
|
267 |
* (non-Javadoc) |
|
268 |
* |
|
269 |
* @see |
|
270 |
* org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org. |
|
271 |
* gvsig.fmap.dal.resource.spi.ResourceProvider) |
|
272 |
*/ |
|
273 |
@Override |
|
274 |
public void resourceChanged(ResourceProvider resource) { |
|
275 |
// Do nothing |
|
276 |
} |
|
277 |
|
|
278 |
protected EditableFeatureType fixFeatureType(FeatureType featureType) { |
|
279 |
EditableFeatureType newFeatureType; |
|
280 |
|
|
281 |
if (featureType instanceof EditableFeatureType) { |
|
282 |
newFeatureType = (EditableFeatureType) featureType.getCopy(); |
|
283 |
} else { |
|
284 |
newFeatureType = featureType.getEditable(); |
|
285 |
} |
|
286 |
|
|
287 |
for (int i = 0; i < newFeatureType.size(); i++) { |
|
288 |
EditableFeatureAttributeDescriptor attr = (EditableFeatureAttributeDescriptor) newFeatureType.getAttributeDescriptor(i); |
|
289 |
String s; |
|
290 |
switch (attr.getType()) { |
|
291 |
case DataTypes.INT: |
|
292 |
s = String.valueOf(Integer.MAX_VALUE); |
|
293 |
attr.setSize(18); |
|
294 |
attr.setPrecision(0); |
|
295 |
attr.setScale(0); |
|
296 |
break; |
|
297 |
case DataTypes.LONG: |
|
298 |
s = String.valueOf(Long.MAX_VALUE); |
|
299 |
attr.setSize(18); |
|
300 |
attr.setPrecision(0); |
|
301 |
attr.setScale(0); |
|
302 |
break; |
|
303 |
case DataTypes.FLOAT: |
|
304 |
attr.setSize(18); |
|
305 |
attr.setPrecision(6); |
|
306 |
attr.setScale(0); |
|
307 |
break; |
|
308 |
case DataTypes.DOUBLE: |
|
309 |
attr.setSize(18); |
|
310 |
attr.setPrecision(6); |
|
311 |
attr.setScale(0); |
|
312 |
break; |
|
313 |
} |
|
314 |
} |
|
315 |
return newFeatureType; |
|
316 |
} |
|
317 | 218 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/csv/CSVStoreProviderFactory.java | ||
---|---|---|
37 | 37 |
super(name, description); |
38 | 38 |
} |
39 | 39 |
|
40 |
@Override |
|
40 | 41 |
public DataStoreProvider createProvider(DataParameters parameters, |
41 | 42 |
DataStoreProviderServices providerServices) |
42 | 43 |
throws InitializeException { |
43 | 44 |
return new CSVStoreProvider((CSVStoreParameters) parameters, providerServices); |
44 | 45 |
} |
45 | 46 |
|
47 |
@Override |
|
46 | 48 |
public DynObject createParameters() { |
47 | 49 |
return new CSVStoreParameters(); |
48 | 50 |
} |
49 | 51 |
|
52 |
@Override |
|
50 | 53 |
public int allowCreate() { |
51 | 54 |
return YES; |
52 | 55 |
} |
53 | 56 |
|
57 |
@Override |
|
54 | 58 |
public int allowWrite() { |
55 | 59 |
return YES; |
56 | 60 |
} |
57 | 61 |
|
62 |
@Override |
|
58 | 63 |
public int allowRead() { |
59 | 64 |
return YES; |
60 | 65 |
} |
61 | 66 |
|
67 |
@Override |
|
62 | 68 |
public int hasRasterSupport() { |
63 | 69 |
return NO; |
64 | 70 |
} |
65 | 71 |
|
72 |
@Override |
|
66 | 73 |
public int hasTabularSupport() { |
67 | 74 |
return YES; |
68 | 75 |
} |
69 | 76 |
|
77 |
@Override |
|
70 | 78 |
public int hasVectorialSupport() { |
71 | 79 |
return YES; |
72 | 80 |
} |
... | ... | |
75 | 83 |
return YES; |
76 | 84 |
} |
77 | 85 |
|
86 |
@Override |
|
78 | 87 |
public int allowEditableFeatureType() { |
79 | 88 |
return YES; |
80 | 89 |
} |
81 | 90 |
|
91 |
@Override |
|
82 | 92 |
public int useLocalIndexesCanImprovePerformance() { |
83 | 93 |
return YES; |
84 | 94 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/csv/CSVStoreParameters.java | ||
---|---|---|
96 | 96 |
super(parametersDefinitionName, CSVStoreProvider.NAME); |
97 | 97 |
} |
98 | 98 |
|
99 |
protected FeatureType getFeatureType() { |
|
100 |
if( this.featureType==null ) { |
|
101 |
try { |
|
102 |
EditableFeatureType ftype = DALLocator.getDataManager().createFeatureType(); |
|
103 |
SimpleReaderFeatureTypeLoader featureTypeLoader = new CSVFeatureTypeLoader(this); |
|
104 |
featureTypeLoader.loadFeatureType(ftype, false, null); |
|
105 |
boolean all_fields_declare_type = featureTypeLoader.isAllFieldsDeclareType(); |
|
106 |
defaultValueOfAutomaticTypesDetection = !all_fields_declare_type; |
|
107 |
this.featureType = ftype; |
|
108 |
} catch (Exception ex) { |
|
109 |
LOGGER.debug("Can't detect feature type from csv header", ex); |
|
110 |
// Do nothing, continue |
|
111 |
} |
|
112 |
} |
|
113 |
return this.featureType; |
|
99 |
@Override |
|
100 |
protected SimpleReaderFeatureTypeLoader getFeatureTypeLoader() { |
|
101 |
return new CSVFeatureTypeLoader(this); |
|
114 | 102 |
} |
115 | 103 |
|
116 | 104 |
@Override |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/simplereader/SimpleReaderLibrary.java | ||
---|---|---|
42 | 42 |
import org.gvsig.fmap.dal.store.gml.GMLStoreParameters; |
43 | 43 |
import org.gvsig.fmap.dal.store.gml.GMLStoreProvider; |
44 | 44 |
import org.gvsig.fmap.dal.store.gml.GMLStoreProviderFactory; |
45 |
import org.gvsig.fmap.dal.store.json.JsonFilesystemServerProvider; |
|
46 |
import org.gvsig.fmap.dal.store.json.JsonStoreParameters; |
|
47 |
import org.gvsig.fmap.dal.store.json.JsonStoreProvider; |
|
48 |
import org.gvsig.fmap.dal.store.json.JsonStoreProviderFactory; |
|
45 | 49 |
import org.gvsig.metadata.exceptions.MetadataException; |
46 | 50 |
import org.gvsig.tools.library.AbstractLibrary; |
47 | 51 |
import org.gvsig.tools.library.LibraryException; |
... | ... | |
76 | 80 |
GMLStoreParameters.PARAMETERS_DEFINITION_NAME, |
77 | 81 |
GMLStoreParameters.class, "GMLParameters.xml" |
78 | 82 |
); |
83 |
FileHelper.registerParametersDefinition( |
|
84 |
JsonStoreParameters.PARAMETERS_DEFINITION_NAME, |
|
85 |
JsonStoreParameters.class, "JsonParameters.xml" |
|
86 |
); |
|
79 | 87 |
} catch (Exception e) { |
80 | 88 |
exs.add(e); |
81 | 89 |
} |
... | ... | |
89 | 97 |
GMLStoreProvider.METADATA_DEFINITION_NAME, |
90 | 98 |
GMLStoreProvider.class, "GMLMetadata.xml" |
91 | 99 |
); |
100 |
FileHelper.registerMetadataDefinition( |
|
101 |
JsonStoreProvider.METADATA_DEFINITION_NAME, |
|
102 |
JsonStoreProvider.class, "JsonMetadata.xml" |
|
103 |
); |
|
92 | 104 |
} catch (MetadataException e) { |
93 | 105 |
exs.add(e); |
94 | 106 |
} |
... | ... | |
113 | 125 |
) |
114 | 126 |
); |
115 | 127 |
} |
128 |
if (!dataman.getStoreProviders().contains(JsonStoreProvider.NAME)) { |
|
129 |
dataman.registerStoreProviderFactory( |
|
130 |
new JsonStoreProviderFactory( |
|
131 |
JsonStoreProvider.NAME, |
|
132 |
JsonStoreProvider.DESCRIPTION |
|
133 |
) |
|
134 |
); |
|
135 |
} |
|
116 | 136 |
} catch (RuntimeException e) { |
117 | 137 |
exs.add(e); |
118 | 138 |
} |
... | ... | |
130 | 150 |
GMLStoreProvider.DESCRIPTION, |
131 | 151 |
GMLFilesystemServerProvider.class |
132 | 152 |
); |
153 |
filesystemServerExplorerManager.registerProvider( |
|
154 |
JsonStoreProvider.NAME, |
|
155 |
JsonStoreProvider.DESCRIPTION, |
|
156 |
JsonFilesystemServerProvider.class |
|
157 |
); |
|
133 | 158 |
} catch (RuntimeException e) { |
134 | 159 |
exs.add(e); |
135 | 160 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/simplereader/virtualrows/LimitedReader.java | ||
---|---|---|
1 |
/* |
|
2 |
* To change this license header, choose License Headers in Project Properties. |
|
3 |
* To change this template file, choose Tools | Templates |
|
4 |
* and open the template in the editor. |
|
5 |
*/ |
|
6 |
package org.gvsig.fmap.dal.store.simplereader.virtualrows; |
|
7 |
|
|
8 |
import java.io.IOException; |
|
9 |
import java.io.Reader; |
|
10 |
|
|
11 |
/** |
|
12 |
* |
|
13 |
* @author jjdelcerro |
|
14 |
*/ |
|
15 |
public class LimitedReader extends Reader { |
|
16 |
|
|
17 |
private final Reader delegated; |
|
18 |
private final int limit; |
|
19 |
private int count; |
|
20 |
|
|
21 |
public LimitedReader(Reader reader, int limit) { |
|
22 |
this.delegated = reader; |
|
23 |
this.limit = limit; |
|
24 |
} |
|
25 |
|
|
26 |
@Override |
|
27 |
public int read(char[] cbuf, int off, int len) throws IOException { |
|
28 |
if (count >= limit) { |
|
29 |
return -1; |
|
30 |
} |
|
31 |
if (count + len > limit) { |
|
32 |
len = limit - count; |
|
33 |
} |
|
34 |
if (len == 0) { |
|
35 |
return -1; |
|
36 |
} |
|
37 |
int n = this.delegated.read(cbuf, off, len); |
|
38 |
if (count + n <= limit) { |
|
39 |
count += n; |
|
40 |
return n; |
|
41 |
} |
|
42 |
return limit - count; |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public void close() throws IOException { |
|
47 |
// this.delegated.close(); |
|
48 |
} |
|
49 |
|
|
50 |
@Override |
|
51 |
public int read(java.nio.CharBuffer target) throws IOException { |
|
52 |
return this.delegated.read(target); |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public int read() throws IOException { |
|
57 |
return this.delegated.read(); |
|
58 |
} |
|
59 |
|
|
60 |
@Override |
|
61 |
public int read(char[] cbuf) throws IOException { |
|
62 |
return this.delegated.read(cbuf); |
|
63 |
} |
|
64 |
|
|
65 |
@Override |
|
66 |
public long skip(long n) throws IOException { |
|
67 |
return this.delegated.skip(n); |
|
68 |
} |
|
69 |
|
|
70 |
@Override |
|
71 |
public boolean ready() throws IOException { |
|
72 |
return this.delegated.ready(); |
|
73 |
} |
|
74 |
|
|
75 |
@Override |
|
76 |
public boolean markSupported() { |
|
77 |
return this.delegated.markSupported(); |
|
78 |
} |
|
79 |
|
|
80 |
@Override |
|
81 |
public void mark(int readAheadLimit) throws IOException { |
|
82 |
this.delegated.mark(readAheadLimit); |
|
83 |
} |
|
84 |
|
|
85 |
@Override |
|
86 |
public void reset() throws IOException { |
|
87 |
this.delegated.reset(); |
|
88 |
} |
|
89 |
|
|
90 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/simplereader/SimpleReaderFilesystemServerProvider.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.fmap.dal.store.simplereader; |
|
25 |
|
|
26 |
import java.io.File; |
|
27 |
import java.io.IOException; |
|
28 |
|
|
29 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
30 |
import org.gvsig.fmap.dal.DataStoreParameters; |
|
31 |
import org.gvsig.fmap.dal.exception.FileNotFoundException; |
|
32 |
import org.gvsig.fmap.dal.exception.RemoveException; |
|
33 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
|
34 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
35 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
36 |
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer; |
|
37 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
|
38 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider; |
|
39 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider; |
|
40 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices; |
|
41 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
42 |
|
|
43 |
public abstract class SimpleReaderFilesystemServerProvider extends AbstractFilesystemServerExplorerProvider |
|
44 |
implements FilesystemServerExplorerProvider, ResourceConsumer { |
|
45 |
|
|
46 |
protected FilesystemServerExplorerProviderServices serverExplorer; |
|
47 |
|
|
48 |
protected abstract String getFileExtension(); // ej: .csv .gml .kml |
|
49 |
|
|
50 |
@Override |
|
51 |
public int getMode() { |
|
52 |
return DataServerExplorer.MODE_FEATURE | DataServerExplorer.MODE_GEOMETRY; |
|
53 |
} |
|
54 |
|
|
55 |
@Override |
|
56 |
public boolean accept(File file) { |
|
57 |
String pathname = file.getName().toLowerCase(); |
|
58 |
if ( pathname.endsWith(this.getFileExtension())){ |
|
59 |
return true; |
|
60 |
} |
|
61 |
return false; |
|
62 |
} |
|
63 |
|
|
64 |
@Override |
|
65 |
public boolean canCreate() { |
|
66 |
return false; |
|
67 |
} |
|
68 |
|
|
69 |
@Override |
|
70 |
public void initialize(FilesystemServerExplorerProviderServices serverExplorer) { |
|
71 |
this.serverExplorer = serverExplorer; |
|
72 |
|
|
73 |
} |
|
74 |
|
|
75 |
@Override |
|
76 |
public void remove(DataStoreParameters parameters) throws RemoveException { |
|
77 |
SimpleReaderStoreParameters params = (SimpleReaderStoreParameters) parameters; |
|
78 |
File file = params.getFile(); |
|
79 |
if (!file.exists()) { |
|
80 |
throw new RemoveException(this.getDataStoreProviderName(), |
|
81 |
new FileNotFoundException(params.getFile())); |
|
82 |
} |
|
83 |
if (!file.delete()) { |
|
84 |
throw new RemoveException(this.getDataStoreProviderName(), |
|
85 |
new IOException()); // FIXME Exception |
|
86 |
} |
|
87 |
} |
|
88 |
|
|
89 |
@Override |
|
90 |
public boolean closeResourceRequested(ResourceProvider resource) { |
|
91 |
// while it is using a resource anyone can't close it |
|
92 |
return !(this.equals(resource)); |
|
93 |
} |
|
94 |
|
|
95 |
/* |
|
96 |
* (non-Javadoc) |
|
97 |
* |
|
98 |
* @see |
|
99 |
* org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org. |
|
100 |
* gvsig.fmap.dal.resource.spi.ResourceProvider) |
|
101 |
*/ |
|
102 |
@Override |
|
103 |
public void resourceChanged(ResourceProvider resource) { |
|
104 |
// Do nothing |
|
105 |
} |
|
106 |
|
|
107 |
protected EditableFeatureType fixFeatureType(FeatureType featureType) { |
|
108 |
EditableFeatureType newFeatureType; |
|
109 |
|
|
110 |
if (featureType instanceof EditableFeatureType) { |
|
111 |
newFeatureType = (EditableFeatureType) featureType.getCopy(); |
|
112 |
} else { |
|
113 |
newFeatureType = featureType.getEditable(); |
|
114 |
} |
|
115 |
|
|
116 |
for (int i = 0; i < newFeatureType.size(); i++) { |
|
117 |
EditableFeatureAttributeDescriptor attr = (EditableFeatureAttributeDescriptor) newFeatureType.getAttributeDescriptor(i); |
|
118 |
String s; |
|
119 |
switch (attr.getType()) { |
|
120 |
case DataTypes.INT: |
|
121 |
s = String.valueOf(Integer.MAX_VALUE); |
|
122 |
attr.setSize(18); |
|
123 |
attr.setPrecision(0); |
|
124 |
attr.setScale(0); |
|
125 |
break; |
|
126 |
case DataTypes.LONG: |
|
127 |
s = String.valueOf(Long.MAX_VALUE); |
|
128 |
attr.setSize(18); |
|
129 |
attr.setPrecision(0); |
|
130 |
attr.setScale(0); |
|
131 |
break; |
|
132 |
case DataTypes.FLOAT: |
|
133 |
attr.setSize(18); |
|
134 |
attr.setPrecision(6); |
|
135 |
attr.setScale(0); |
|
136 |
break; |
|
137 |
case DataTypes.DOUBLE: |
|
138 |
attr.setSize(18); |
|
139 |
attr.setPrecision(6); |
|
140 |
attr.setScale(0); |
|
141 |
break; |
|
142 |
} |
|
143 |
} |
|
144 |
return newFeatureType; |
|
145 |
} |
|
146 |
} |
|
0 | 147 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/simplereader/SimpleReaderStoreParameters.java | ||
---|---|---|
32 | 32 |
import org.gvsig.basicformats.CPGFile; |
33 | 33 |
import org.gvsig.basicformats.FormatsFile; |
34 | 34 |
import org.gvsig.basicformats.PRJFile; |
35 |
import org.gvsig.fmap.dal.DALLocator; |
|
35 | 36 |
import static org.gvsig.fmap.dal.DataParameters.CRS_PARAMTER_NAME; |
36 | 37 |
import org.gvsig.fmap.dal.FileHelper; |
37 | 38 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
39 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
38 | 40 |
import org.gvsig.fmap.dal.feature.FeatureType; |
39 | 41 |
import org.gvsig.fmap.dal.feature.OpenFeatureStoreParameters; |
40 | 42 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
... | ... | |
75 | 77 |
this.setDynValue(DataStoreProviderServices.PROVIDER_PARAMTER_NAME, name); |
76 | 78 |
} |
77 | 79 |
|
78 |
protected FeatureType getFeatureType() {
|
|
80 |
protected SimpleReaderFeatureTypeLoader getFeatureTypeLoader() {
|
|
79 | 81 |
return null; |
80 | 82 |
} |
81 | 83 |
|
... | ... | |
341 | 343 |
} |
342 | 344 |
super.validate(); |
343 | 345 |
} |
346 |
|
|
347 |
protected FeatureType getFeatureType() { |
|
348 |
if( this.featureType==null ) { |
|
349 |
try { |
|
350 |
SimpleReaderFeatureTypeLoader featureTypeLoader = this.getFeatureTypeLoader(); |
|
351 |
if( featureTypeLoader!=null ) { |
|
352 |
EditableFeatureType ftype = DALLocator.getDataManager().createFeatureType(); |
|
353 |
featureTypeLoader.loadFeatureType(ftype, false, null); |
|
354 |
boolean all_fields_declare_type = featureTypeLoader.isAllFieldsDeclareType(); |
|
355 |
defaultValueOfAutomaticTypesDetection = !all_fields_declare_type; |
|
356 |
this.featureType = ftype; |
|
357 |
} |
|
358 |
} catch (Exception ex) { |
|
359 |
LOGGER.debug("Can't detect feature of json file", ex); |
|
360 |
// Do nothing, continue |
|
361 |
} |
|
362 |
} |
|
363 |
return this.featureType; |
|
364 |
} |
|
365 |
|
|
344 | 366 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/gml/GMLFilesystemServerProvider.java | ||
---|---|---|
24 | 24 |
package org.gvsig.fmap.dal.store.gml; |
25 | 25 |
|
26 | 26 |
import java.io.File; |
27 |
import java.io.IOException; |
|
28 | 27 |
import org.gvsig.fmap.dal.DALLocator; |
29 | 28 |
import org.gvsig.fmap.dal.DataManager; |
30 | 29 |
|
31 |
import org.gvsig.fmap.dal.DataServerExplorer; |
|
32 | 30 |
import org.gvsig.fmap.dal.DataStoreParameters; |
33 |
import org.gvsig.fmap.dal.NewDataStoreParameters; |
|
34 | 31 |
import org.gvsig.fmap.dal.exception.DataException; |
35 |
import org.gvsig.fmap.dal.exception.FileNotFoundException; |
|
36 |
import org.gvsig.fmap.dal.exception.RemoveException; |
|
37 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
|
38 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
39 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
40 |
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer; |
|
41 |
import org.gvsig.fmap.dal.resource.spi.ResourceProvider; |
|
42 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.impl.AbstractFilesystemServerExplorerProvider; |
|
43 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProvider; |
|
44 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.spi.FilesystemServerExplorerProviderServices; |
|
45 |
import org.gvsig.tools.dataTypes.DataTypes; |
|
32 |
import org.gvsig.fmap.dal.store.simplereader.SimpleReaderFilesystemServerProvider; |
|
46 | 33 |
|
47 |
public class GMLFilesystemServerProvider extends AbstractFilesystemServerExplorerProvider
|
|
48 |
implements FilesystemServerExplorerProvider, ResourceConsumer {
|
|
34 |
public class GMLFilesystemServerProvider |
|
35 |
extends SimpleReaderFilesystemServerProvider {
|
|
49 | 36 |
|
50 |
protected FilesystemServerExplorerProviderServices serverExplorer; |
|
51 |
|
|
52 | 37 |
@Override |
53 | 38 |
public String getDataStoreProviderName() { |
54 | 39 |
return GMLStoreProvider.NAME; |
55 | 40 |
} |
56 | 41 |
|
57 | 42 |
@Override |
58 |
public int getMode() { |
|
59 |
return DataServerExplorer.MODE_FEATURE | DataServerExplorer.MODE_GEOMETRY; |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public boolean accept(File file) { |
|
64 |
String pathname = file.getName().toLowerCase(); |
|
65 |
if ( pathname.endsWith(".gml")){ |
|
66 |
return true; |
|
67 |
} |
|
68 |
return false; |
|
69 |
} |
|
70 |
|
|
71 |
@Override |
|
72 | 43 |
public String getDescription() { |
73 | 44 |
return GMLStoreProvider.DESCRIPTION; |
74 | 45 |
} |
75 | 46 |
|
76 | 47 |
@Override |
48 |
protected String getFileExtension() { |
|
49 |
return ".gml"; |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
77 | 53 |
public DataStoreParameters getParameters(File file) throws DataException { |
78 | 54 |
DataManager manager = DALLocator.getDataManager(); |
79 | 55 |
GMLStoreParameters params = (GMLStoreParameters) manager |
... | ... | |
82 | 58 |
return params; |
83 | 59 |
} |
84 | 60 |
|
85 |
@Override |
|
86 |
public boolean canCreate() { |
|
87 |
return false; |
|
88 |
} |
|
89 |
|
|
90 |
@Override |
|
91 |
public void initialize(FilesystemServerExplorerProviderServices serverExplorer) { |
|
92 |
this.serverExplorer = serverExplorer; |
|
93 |
|
|
94 |
} |
|
95 |
|
|
96 |
@Override |
|
97 |
public void remove(DataStoreParameters parameters) throws RemoveException { |
|
98 |
GMLStoreParameters params = (GMLStoreParameters) parameters; |
|
99 |
File file = params.getFile(); |
|
100 |
if (!file.exists()) { |
|
101 |
throw new RemoveException(this.getDataStoreProviderName(), |
|
102 |
new FileNotFoundException(params.getFile())); |
|
103 |
} |
|
104 |
if (!file.delete()) { |
|
105 |
throw new RemoveException(this.getDataStoreProviderName(), |
|
106 |
new IOException()); // FIXME Exception |
|
107 |
} |
|
108 |
} |
|
109 |
|
|
110 |
@Override |
|
111 |
public boolean closeResourceRequested(ResourceProvider resource) { |
|
112 |
// while it is using a resource anyone can't close it |
|
113 |
return !(this.equals(resource)); |
|
114 |
} |
|
115 |
|
|
116 |
/* |
|
117 |
* (non-Javadoc) |
|
118 |
* |
|
119 |
* @see |
|
120 |
* org.gvsig.fmap.dal.resource.spi.ResourceConsumer#resourceChanged(org. |
|
121 |
* gvsig.fmap.dal.resource.spi.ResourceProvider) |
|
122 |
*/ |
|
123 |
@Override |
|
124 |
public void resourceChanged(ResourceProvider resource) { |
|
125 |
// Do nothing |
|
126 |
} |
|
127 |
|
|
128 |
protected EditableFeatureType fixFeatureType(FeatureType featureType) { |
|
129 |
EditableFeatureType newFeatureType; |
|
130 |
|
|
131 |
if (featureType instanceof EditableFeatureType) { |
|
132 |
newFeatureType = (EditableFeatureType) featureType.getCopy(); |
|
133 |
} else { |
|
134 |
newFeatureType = featureType.getEditable(); |
|
135 |
} |
|
136 |
|
|
137 |
for (int i = 0; i < newFeatureType.size(); i++) { |
|
138 |
EditableFeatureAttributeDescriptor attr = (EditableFeatureAttributeDescriptor) newFeatureType.getAttributeDescriptor(i); |
|
139 |
String s; |
|
140 |
switch (attr.getType()) { |
|
141 |
case DataTypes.INT: |
|
142 |
s = String.valueOf(Integer.MAX_VALUE); |
|
143 |
attr.setSize(18); |
|
144 |
attr.setPrecision(0); |
|
145 |
attr.setScale(0); |
|
146 |
break; |
|
147 |
case DataTypes.LONG: |
|
148 |
s = String.valueOf(Long.MAX_VALUE); |
|
149 |
attr.setSize(18); |
|
150 |
attr.setPrecision(0); |
|
151 |
attr.setScale(0); |
|
152 |
break; |
|
153 |
case DataTypes.FLOAT: |
|
154 |
attr.setSize(18); |
|
155 |
attr.setPrecision(6); |
|
156 |
attr.setScale(0); |
|
157 |
break; |
|
158 |
case DataTypes.DOUBLE: |
|
159 |
attr.setSize(18); |
|
160 |
attr.setPrecision(6); |
|
161 |
attr.setScale(0); |
|
162 |
break; |
|
163 |
} |
|
164 |
} |
|
165 |
return newFeatureType; |
|
166 |
} |
|
167 | 61 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/gml/GMLStoreProviderFactory.java | ||
---|---|---|
37 | 37 |
super(name, description); |
38 | 38 |
} |
39 | 39 |
|
40 |
@Override |
|
40 | 41 |
public DataStoreProvider createProvider(DataParameters parameters, |
41 | 42 |
DataStoreProviderServices providerServices) |
42 | 43 |
throws InitializeException { |
43 | 44 |
return new GMLStoreProvider((GMLStoreParameters) parameters, providerServices); |
44 | 45 |
} |
45 | 46 |
|
47 |
@Override |
|
46 | 48 |
public DynObject createParameters() { |
47 | 49 |
return new GMLStoreParameters(); |
48 | 50 |
} |
49 | 51 |
|
52 |
@Override |
|
50 | 53 |
public int allowCreate() { |
51 | 54 |
return NO; |
52 | 55 |
} |
53 | 56 |
|
57 |
@Override |
|
54 | 58 |
public int allowWrite() { |
55 | 59 |
return NO; |
56 | 60 |
} |
57 | 61 |
|
62 |
@Override |
|
58 | 63 |
public int allowRead() { |
59 | 64 |
return YES; |
60 | 65 |
} |
61 | 66 |
|
67 |
@Override |
|
62 | 68 |
public int hasRasterSupport() { |
63 | 69 |
return NO; |
64 | 70 |
} |
65 | 71 |
|
72 |
@Override |
|
66 | 73 |
public int hasTabularSupport() { |
67 | 74 |
return YES; |
68 | 75 |
} |
69 | 76 |
|
77 |
@Override |
|
70 | 78 |
public int hasVectorialSupport() { |
71 | 79 |
return YES; |
72 | 80 |
} |
... | ... | |
75 | 83 |
return YES; |
76 | 84 |
} |
77 | 85 |
|
86 |
@Override |
|
78 | 87 |
public int allowEditableFeatureType() { |
79 | 88 |
return NO; |
80 | 89 |
} |
81 | 90 |
|
91 |
@Override |
|
82 | 92 |
public int useLocalIndexesCanImprovePerformance() { |
83 | 93 |
return YES; |
84 | 94 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/gml/simplereaders/GMLReader.java | ||
---|---|---|
15 | 15 |
import org.gvsig.fmap.dal.store.gml.virtualrows.XMLFileAsList; |
16 | 16 |
import org.gvsig.fmap.dal.store.simplereader.SimpleReaderStoreParameters; |
17 | 17 |
import org.gvsig.fmap.dal.store.simplereader.simplereaders.AbstractSimpleReader; |
18 |
import org.gvsig.tools.task.SimpleTaskStatus; |
|
19 |
import org.gvsig.tools.util.GetItemWithSize64; |
|
18 | 20 |
import org.slf4j.Logger; |
19 | 21 |
import org.slf4j.LoggerFactory; |
20 | 22 |
|
... | ... | |
35 | 37 |
|
36 | 38 |
public GMLReader(Reader reader, SimpleReaderStoreParameters theParameters) throws IOException { |
37 | 39 |
File gmlFile = theParameters.getFile(); |
38 |
File gmlIdx = new File(FilenameUtils.removeExtension(gmlFile.getName())+".gmlidx");
|
|
39 |
File gfsFile = new File(FilenameUtils.removeExtension(gmlFile.getName())+".gfs");
|
|
40 |
File gmlIdx = new File(FilenameUtils.removeExtension(gmlFile.getAbsolutePath())+".gmlidx");
|
|
41 |
File gfsFile = new File(FilenameUtils.removeExtension(gmlFile.getAbsolutePath())+".gfs");
|
|
40 | 42 |
gfs = new GfsFile(); |
41 |
if(gmlIdx.exists()){
|
|
43 |
if(gfsFile.exists()){
|
|
42 | 44 |
//TODO: Comparar fechas del gfs y gml |
43 | 45 |
gfs.load(gfsFile); |
44 | 46 |
} else { |
... | ... | |
130 | 132 |
throw new RuntimeException(ex); |
131 | 133 |
} |
132 | 134 |
} |
135 |
|
|
136 |
@Override |
|
137 |
public GetItemWithSize64<List<String>> getVirtualRows(SimpleTaskStatus status) { |
|
138 |
return this.gml; |
|
139 |
} |
|
133 | 140 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/gml/GMLStoreParameters.java | ||
---|---|---|
23 | 23 |
*/ |
24 | 24 |
package org.gvsig.fmap.dal.store.gml; |
25 | 25 |
|
26 |
import java.io.File; |
|
27 |
import org.apache.commons.lang3.StringUtils; |
|
28 |
import org.cresques.cts.IProjection; |
|
29 |
import org.gvsig.basicformats.CPGFile; |
|
30 |
import org.gvsig.basicformats.FormatsFile; |
|
31 |
import org.gvsig.basicformats.PRJFile; |
|
32 |
import org.gvsig.fmap.dal.DALLocator; |
|
33 |
import static org.gvsig.fmap.dal.DataParameters.CRS_PARAMTER_NAME; |
|
34 |
import org.gvsig.fmap.dal.exception.ValidateDataParametersException; |
|
35 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
36 |
import org.gvsig.fmap.dal.feature.FeatureAttributeDescriptor; |
|
37 |
import org.gvsig.fmap.dal.feature.FeatureType; |
|
38 | 26 |
import org.gvsig.fmap.dal.feature.OpenFeatureStoreParameters; |
39 | 27 |
import org.gvsig.fmap.dal.serverexplorer.filesystem.FilesystemStoreParameters; |
40 | 28 |
import org.gvsig.fmap.dal.store.simplereader.SimpleReaderFeatureTypeLoader; |
41 | 29 |
import org.gvsig.fmap.dal.store.simplereader.SimpleReaderStoreParameters; |
42 |
import static org.gvsig.fmap.dal.store.simplereader.SimpleReaderStoreParameters.getCharset; |
|
43 |
import org.gvsig.fmap.geom.Geometry; |
|
44 |
import org.gvsig.tools.dynobject.Tags; |
|
45 | 30 |
import org.slf4j.Logger; |
46 | 31 |
import org.slf4j.LoggerFactory; |
47 | 32 |
|
... | ... | |
49 | 34 |
public class GMLStoreParameters extends SimpleReaderStoreParameters implements |
50 | 35 |
OpenFeatureStoreParameters, FilesystemStoreParameters { |
51 | 36 |
|
52 |
private static final Logger LOGGER = LoggerFactory.getLogger(GMLStoreParameters.class); |
|
53 |
|
|
54 | 37 |
public static final String PARAMETERS_DEFINITION_NAME = "GMLStoreParameters"; |
55 | 38 |
|
56 | 39 |
|
... | ... | |
62 | 45 |
super(parametersDefinitionName, GMLStoreProvider.NAME); |
63 | 46 |
} |
64 | 47 |
|
65 |
protected FeatureType getFeatureType() { |
|
66 |
if( this.featureType==null ) { |
|
67 |
try { |
|
68 |
EditableFeatureType ftype = DALLocator.getDataManager().createFeatureType(); |
|
69 |
SimpleReaderFeatureTypeLoader featureTypeLoader = new GMLFeatureTypeLoader(this); |
|
70 |
featureTypeLoader.loadFeatureType(ftype, false, null); |
|
71 |
boolean all_fields_declare_type = featureTypeLoader.isAllFieldsDeclareType(); |
|
72 |
defaultValueOfAutomaticTypesDetection = !all_fields_declare_type; |
|
73 |
this.featureType = ftype; |
|
74 |
} catch (Exception ex) { |
|
75 |
LOGGER.debug("Can't detect feature type from csv header", ex); |
|
76 |
// Do nothing, continue |
|
77 |
} |
|
78 |
} |
|
79 |
return this.featureType; |
|
48 |
@Override |
|
49 |
protected SimpleReaderFeatureTypeLoader getFeatureTypeLoader() { |
|
50 |
return new GMLFeatureTypeLoader(this); |
|
80 | 51 |
} |
81 |
|
|
52 |
|
|
82 | 53 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/gml/virtualrows/XMLFileAsList.java | ||
---|---|---|
5 | 5 |
*/ |
6 | 6 |
package org.gvsig.fmap.dal.store.gml.virtualrows; |
7 | 7 |
|
8 |
import org.gvsig.fmap.dal.store.simplereader.virtualrows.LimitedReader; |
|
8 | 9 |
import java.io.BufferedReader; |
9 | 10 |
import java.io.Closeable; |
10 | 11 |
import java.io.File; |
... | ... | |
188 | 189 |
} |
189 | 190 |
} |
190 | 191 |
|
191 |
System.out.println("RECORD "+position); |
|
192 |
// System.out.println("RECORD "+position);
|
|
192 | 193 |
ParseRecordsHandler handler = null; |
193 | 194 |
Record record = this.index.get64(position); |
194 | 195 |
try { |
195 | 196 |
long recordPosition = record.getLong(IDXFIELD_BEGINRECORDPOS); |
196 | 197 |
this.reader.seek(recordPosition); |
197 |
BufferedReader breader = new BufferedReader(this.reader, 1024 * 8); |
|
198 |
// TODO: guardarse el tama?o del registro en el indice y en funcion de eso usar un buffersize mas peque?o aqui si procede |
|
199 |
int bufferSize = 1024*8; |
|
200 |
BufferedReader breader = new BufferedReader(this.reader, bufferSize); |
|
198 | 201 |
|
199 | 202 |
InputSource is = new InputSource(CloseShieldReader.wrap(breader)); |
200 | 203 |
SAXParserFactory spf = SAXParserFactory.newInstance(); |
... | ... | |
202 | 205 |
SAXParser saxParser = spf.newSAXParser(); |
203 | 206 |
handler = new ParseRecordsHandler(); |
204 | 207 |
handler.endLineNumber=(int) (record.getLong(IDXFIELD_ENDLINE)-record.getLong(IDXFIELD_BEGINLINE)+1); |
205 |
// if(record.getLong(IDXFIELD_ENDLINE)==record.getLong(IDXFIELD_BEGINLINE)){ |
|
206 |
// handler.endColumnNumber=(int) (record.getLong(IDXFIELD_ENDCOLUMN)-record.getLong(IDXFIELD_BEGINCOLUMN)); |
|
207 |
// } else { |
|
208 |
handler.endColumnNumber=(int) record.getLong(IDXFIELD_ENDCOLUMN); |
|
209 |
// } |
|
208 |
handler.endColumnNumber=(int) record.getLong(IDXFIELD_ENDCOLUMN); |
|
210 | 209 |
|
211 | 210 |
saxParser.parse(is, handler); |
212 | 211 |
} catch (StopParserSAXException ex) { |
... | ... | |
233 | 232 |
if(position == 0){ |
234 | 233 |
char[] cbuff = new char[(int)(endGeomPosition-geomPosition)]; |
235 | 234 |
this.reader.read(cbuff); |
236 |
System.out.println("["+new String(cbuff)+"]"); |
|
235 |
// System.out.println("["+new String(cbuff)+"]");
|
|
237 | 236 |
this.reader.seek(geomPosition); |
238 | 237 |
} |
239 | 238 |
Reader limitedReader = new LimitedReader(reader, (int)(endGeomPosition-geomPosition)); |
240 |
BufferedReader breader = new BufferedReader(limitedReader, 1024 * 8); |
|
239 |
// TODO: calcular el buffersize como el min(8k,endGeomPosition-geomPosition+1) |
|
240 |
int bufferSize = 1024*8; |
|
241 |
BufferedReader breader = new BufferedReader(limitedReader, bufferSize); |
|
241 | 242 |
geom = GeometryLocator.getGeometryManager().createFrom(breader, null); |
242 | 243 |
if(this.combineMode == COMBINE_FIRST_NOT_NULL){ |
243 | 244 |
if(geom != null){ |
... | ... | |
291 | 292 |
try { |
292 | 293 |
// 1. Creamos el indice vacio |
293 | 294 |
RecordsFile.RecordTypeBuilder builder = recordTypeBuilder() |
295 |
.addInteger() |
|
296 |
.addInteger() |
|
294 | 297 |
.addLong() |
295 |
.addLong() |
|
296 |
.addLong() |
|
297 |
.addLong() |
|
298 |
.addLong(); |
|
298 |
.addInteger() |
|
299 |
.addInteger(); |
|
299 | 300 |
|
300 | 301 |
if (CollectionUtils.isNotEmpty(geomPaths)) { |
301 |
for (String geomPath : geomPaths) { |
|
302 |
builder.addLong() |
|
302 |
for (int i = 0; i < geomPaths.size(); i++) { |
|
303 |
builder.addInteger() |
|
304 |
.addInteger() |
|
303 | 305 |
.addLong() |
304 |
.addLong() |
|
305 |
.addLong() |
|
306 |
.addLong() |
|
306 |
.addInteger() |
|
307 |
.addInteger() |
|
307 | 308 |
.addLong(); |
308 | 309 |
} |
309 | 310 |
} |
... | ... | |
414 | 415 |
for (int j = 0; j < theIndex.size(); j++) { |
415 | 416 |
Record r = theIndex.get(j); |
416 | 417 |
// if(i==0){ |
417 |
System.out.println("RECO BEGIN: "+r.getLong(IDXFIELD_BEGINLINE) + " " + r.getLong(IDXFIELD_BEGINCOLUMN)); |
|
418 |
if(CollectionUtils.isNotEmpty(geomPaths)) { |
|
419 |
for (int i = 0; i < geomPaths.size(); i++) { |
|
420 |
System.out.println("GEOM"+i+"BEGIN: "+r.getLong(IDXFIELD_BEGINGEOMLINE+i*6) + " " + r.getLong(IDXFIELD_BEGINGEOMCOLUMN+i*6)); |
|
421 |
System.out.println("GEOM"+i+"END : "+r.getLong(IDXFIELD_ENDGEOMLINE+i*6) + " " + r.getLong(IDXFIELD_ENDGEOMCOLUMN+i*6)); |
|
422 |
} |
|
423 |
} |
|
424 |
System.out.println("RECO END : "+r.getLong(IDXFIELD_ENDLINE) + " " + r.getLong(IDXFIELD_ENDCOLUMN)); |
|
418 |
// System.out.println("RECO BEGIN: "+r.getLong(IDXFIELD_BEGINLINE) + " " + r.getLong(IDXFIELD_BEGINCOLUMN));
|
|
419 |
// if(CollectionUtils.isNotEmpty(geomPaths)) {
|
|
420 |
// for (int i = 0; i < geomPaths.size(); i++) {
|
|
421 |
// System.out.println("GEOM"+i+"BEGIN: "+r.getLong(IDXFIELD_BEGINGEOMLINE+i*6) + " " + r.getLong(IDXFIELD_BEGINGEOMCOLUMN+i*6));
|
|
422 |
// System.out.println("GEOM"+i+"END : "+r.getLong(IDXFIELD_ENDGEOMLINE+i*6) + " " + r.getLong(IDXFIELD_ENDGEOMCOLUMN+i*6));
|
|
423 |
// }
|
|
424 |
// }
|
|
425 |
// System.out.println("RECO END : "+r.getLong(IDXFIELD_ENDLINE) + " " + r.getLong(IDXFIELD_ENDCOLUMN));
|
|
425 | 426 |
// } |
426 | 427 |
positionCalculator.next(r.getLong(IDXFIELD_BEGINLINE), r.getLong(IDXFIELD_BEGINCOLUMN)); |
427 | 428 |
r.setLong(IDXFIELD_BEGINRECORDPOS, positionCalculator.getColumnPosition()); |
428 |
System.out.println("RPOS : " + r.getLong(IDXFIELD_BEGINRECORDPOS)); |
|
429 |
// System.out.println("RPOS : " + r.getLong(IDXFIELD_BEGINRECORDPOS));
|
|
429 | 430 |
if(CollectionUtils.isNotEmpty(geomPaths)) { |
430 | 431 |
for (int i = 0; i < geomPaths.size(); i++) { |
431 | 432 |
long beginGeomLine = r.getLong(IDXFIELD_BEGINGEOMLINE + i * 6); |
... | ... | |
437 | 438 |
r.setLong(IDXFIELD_BEGINGEOMPOS + i * 6, positionCalculator.getColumnPosition()); |
438 | 439 |
positionCalculator.next(endGeomLine, r.getLong(IDXFIELD_ENDGEOMCOLUMN + i * 6)); |
439 | 440 |
r.setLong(IDXFIELD_ENDGEOMPOS + i * 6, positionCalculator.getColumnPosition()); |
440 |
System.out.println("GPOS" + i + " : " + r.getLong(IDXFIELD_BEGINGEOMPOS + i * 6) + " " + r.getLong(IDXFIELD_ENDGEOMPOS + i * 6)); |
|
441 |
// System.out.println("GPOS" + i + " : " + r.getLong(IDXFIELD_BEGINGEOMPOS + i * 6) + " " + r.getLong(IDXFIELD_ENDGEOMPOS + i * 6));
|
|
441 | 442 |
} |
442 | 443 |
} |
443 | 444 |
theIndex.set(j, r); |
444 |
// if(i==0){ |
|
445 |
// } |
|
446 | 445 |
} |
447 | 446 |
this.index = new RecordsFileImpl(indexFile); |
448 | 447 |
} catch (Exception ex) { |
... | ... | |
450 | 449 |
} |
451 | 450 |
} |
452 | 451 |
|
453 |
private static class LimitedReader extends Reader { |
|
454 | 452 |
|
455 |
private final Reader delegated; |
|
456 |
private final int limit; |
|
457 |
private int count; |
|
458 |
|
|
459 |
public LimitedReader(Reader reader, int limit) { |
|
460 |
this.delegated = reader; |
|
461 |
this.limit = limit; |
|
462 |
} |
|
463 |
|
|
464 |
@Override |
|
465 |
public int read(char[] cbuf, int off, int len) throws IOException { |
|
466 |
if(count >= limit){ |
|
467 |
return -1; |
|
468 |
} |
|
469 |
if(count+len > limit){ |
|
470 |
len = limit - count; |
|
471 |
} |
|
472 |
if(len==0){ |
|
473 |
return -1; |
|
474 |
} |
|
475 |
int n = this.delegated.read(cbuf, off, len); |
|
476 |
if(count+n <= limit){ |
|
477 |
count += n; |
|
478 |
return n; |
|
479 |
} |
|
480 |
return limit - count; |
|
481 |
|
|
482 |
} |
|
483 |
|
|
484 |
@Override |
|
485 |
public void close() throws IOException { |
|
486 |
// this.delegated.close(); |
|
487 |
} |
|
488 |
|
|
489 |
@Override |
|
490 |
public int read(java.nio.CharBuffer target) throws IOException { |
|
491 |
return this.delegated.read(target); |
|
492 |
} |
|
493 |
|
|
494 |
@Override |
|
495 |
public int read() throws IOException { |
|
496 |
return this.delegated.read(); |
|
497 |
} |
|
498 |
|
|
499 |
@Override |
|
500 |
public int read(char cbuf[]) throws IOException { |
|
501 |
return this.delegated.read(cbuf); |
|
502 |
} |
|
503 |
|
|
504 |
@Override |
|
505 |
public long skip(long n) throws IOException { |
|
506 |
return this.delegated.skip(n); |
|
507 |
} |
|
508 |
|
|
509 |
@Override |
|
510 |
public boolean ready() throws IOException { |
|
511 |
return this.delegated.ready(); |
|
512 |
} |
|
513 |
|
|
514 |
@Override |
|
515 |
public boolean markSupported() { |
|
516 |
return this.delegated.markSupported(); |
|
517 |
} |
|
518 |
|
|
519 |
@Override |
|
520 |
public void mark(int readAheadLimit) throws IOException { |
|
521 |
this.delegated.mark(readAheadLimit); |
|
522 |
} |
|
523 |
|
|
524 |
@Override |
|
525 |
public void reset() throws IOException { |
|
526 |
this.delegated.reset(); |
|
527 |
} |
|
528 |
} |
|
529 |
|
|
530 | 453 |
private static class CharacterSize { |
531 | 454 |
|
532 | 455 |
private final Charset charset; |
... | ... | |
587 | 510 |
} |
588 | 511 |
|
589 | 512 |
public boolean next(long line, long column) throws IOException { |
590 |
System.out.println(); |
|
591 |
System.out.println("----"+line+" "+column); |
|
513 |
// System.out.println();
|
|
514 |
// System.out.println("----"+line+" "+column);
|
|
592 | 515 |
if(this.currentLine>line){ |
593 | 516 |
throw new IOException("Illegal column number " + column + " ("+this.currentColumn+") for line " + line+ " ("+this.currentLine+")"); |
594 | 517 |
} |
595 | 518 |
if(this.currentLine==line && this.currentColumn > column){ |
596 | 519 |
throw new IOException("Illegal column number " + column + " ("+this.currentColumn+") for line " + line); |
597 | 520 |
} |
598 |
System.out.print(this.currentLine+":"); |
|
521 |
// System.out.print(this.currentLine+":");
|
|
599 | 522 |
while (this.currentLine < line) { |
600 | 523 |
if (breader.read(this.ch, 0, 1) < 1) { |
601 | 524 |
return false; |
602 | 525 |
} |
603 | 526 |
char c = ch[0]; |
604 |
System.out.print(String.valueOf(c)); |
|
527 |
// System.out.print(String.valueOf(c));
|
|
605 | 528 |
this.currentPosition += characterSize.size(c); |
606 | 529 |
if (c == '\n') { |
607 | 530 |
this.currentLine++; |
608 | 531 |
this.currentColumn = 1; |
609 |
System.out.print(this.currentLine+":"); |
|
532 |
// System.out.print(this.currentLine+":");
|
|
610 | 533 |
} |
611 | 534 |
} |
612 | 535 |
this.currentLinePosition = this.currentPosition; |
613 |
while (true) { //this.currentColumn < column) {
|
|
536 |
while (true) { |
|
614 | 537 |
if (breader.read(this.ch, 0, 1) < 1) { |
615 | 538 |
return false; |
616 | 539 |
} |
617 | 540 |
char c = ch[0]; |
618 |
System.out.print(String.valueOf(c)); |
|
541 |
// System.out.print(String.valueOf(c));
|
|
619 | 542 |
this.currentColumn++; |
620 | 543 |
this.currentPosition += characterSize.size(c); |
621 | 544 |
if(this.currentColumn >= column){ |
622 | 545 |
break; |
623 | 546 |
} |
624 | 547 |
if (c == '\n') { |
625 |
// if (this.currentColumn < column) { |
|
626 |
// Uff, esto seria un error, ya que la linea corriente no |
|
627 |
// tiene tantas columnas. |
|
628 |
throw new IOException("Illegal column number " + column + " ("+this.currentColumn+") for line " + line+ " ("+this.currentLine+")"); |
|
629 |
// } |
|
630 |
// this.currentLine++; |
|
548 |
throw new IOException("Illegal column number " + column + " ("+this.currentColumn+") for line " + line+ " ("+this.currentLine+")"); |
|
631 | 549 |
} |
632 | 550 |
} |
633 | 551 |
this.currentColumnPosition = this.currentPosition; |
634 |
System.out.println(); |
|
552 |
// System.out.println();
|
|
635 | 553 |
return true; |
636 | 554 |
} |
637 | 555 |
|
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/gml/GMLFeatureTypeLoader.java | ||
---|---|---|
5 | 5 |
*/ |
6 | 6 |
package org.gvsig.fmap.dal.store.gml; |
7 | 7 |
|
8 |
import org.gvsig.fmap.dal.store.csv.*; |
|
9 |
import org.gvsig.fmap.dal.store.simplereader.SimpleReaderPointAttributeEmulator; |
|
10 | 8 |
import java.io.IOException; |
11 | 9 |
import java.io.Reader; |
12 |
import org.apache.commons.lang3.StringUtils; |
|
13 |
import org.gvsig.fmap.dal.DataTypes; |
|
14 |
import org.gvsig.fmap.dal.feature.EditableFeatureAttributeDescriptor; |
|
15 |
import org.gvsig.fmap.dal.feature.EditableFeatureType; |
|
16 |
import org.gvsig.fmap.dal.store.csv.simplereaders.CSVReaderSuperCSV; |
|
17 |
import org.gvsig.fmap.dal.store.csv.simplereaders.FixedLenReader; |
|
10 |
import org.gvsig.fmap.dal.store.gml.simplereaders.GMLReader; |
|
18 | 11 |
import org.gvsig.fmap.dal.store.simplereader.*; |
19 | 12 |
import org.gvsig.fmap.dal.store.simplereader.simplereaders.SimpleReader; |
20 |
import org.gvsig.fmap.geom.Geometry; |
|
21 |
import org.gvsig.fmap.geom.GeometryLocator; |
|
22 |
import org.gvsig.fmap.geom.GeometryManager; |
|
23 |
import org.gvsig.fmap.geom.type.GeometryType; |
|
24 |
import org.gvsig.tools.locator.LocatorException; |
|
25 |
import org.slf4j.Logger; |
|
26 |
import org.slf4j.LoggerFactory; |
|
27 | 13 |
|
28 | 14 |
/** |
29 | 15 |
* |
... | ... | |
31 | 17 |
*/ |
32 | 18 |
public class GMLFeatureTypeLoader extends SimpleReaderFeatureTypeLoader{ |
33 | 19 |
|
34 |
private static final Logger LOGGER = LoggerFactory.getLogger(GMLFeatureTypeLoader.class); |
|
35 |
|
|
36 | 20 |
public GMLFeatureTypeLoader(GMLStoreParameters parameters) { |
37 | 21 |
super(parameters); |
38 | 22 |
} |
39 | 23 |
|
40 | 24 |
protected String getProviderName() { |
41 |
return CSVStoreProvider.NAME;
|
|
25 |
return GMLStoreProvider.NAME;
|
|
42 | 26 |
} |
43 | 27 |
|
44 | 28 |
protected SimpleReader getSimpleReader(Reader in) throws IOException { |
45 |
SimpleReader reader; |
|
46 |
if (CSVStoreParameters.getRawFieldsDefinition(parameters) != null) { |
|
47 |
reader = new FixedLenReader(in, (CSVStoreParameters) parameters); |
|
48 |
} else { |
|
49 |
reader = new CSVReaderSuperCSV(in, (CSVStoreParameters) parameters); |
|
50 |
} |
|
29 |
SimpleReader reader = new GMLReader(in, parameters); |
|
51 | 30 |
return reader; |
52 | 31 |
} |
53 |
|
|
54 |
@Override |
|
55 |
protected boolean isFirstLineHeader() { |
|
56 |
return CSVStoreParameters.isFirstLineHeader(parameters); |
|
57 |
} |
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
protected String[] getHeaders(CSVStoreParameters parameters, SimpleReader reader) throws RuntimeException, IOException { |
|
62 |
String headers[]; |
|
63 |
headers = CSVStoreParameters.getHeaders(parameters); |
|
64 |
if (headers == null) { |
|
65 |
if (CSVStoreParameters.isFirstLineHeader(parameters)) { |
|
66 |
headers = reader.getHeader(); |
|
67 |
if (headers == null) { |
|
68 |
if (CSVStoreParameters.getIgnoreErrors(parameters)) { |
|
69 |
headers = getFixedHeaders(reader.getColumnsCount()); |
|
70 |
} else { |
|
71 |
String msg = "Can't retrieve header from csv file '" |
|
72 |
+ parameters.getFile() |
|
73 |
.getAbsolutePath() |
|
74 |
+ "' and not specified in the parameters."; |
|
75 |
LOGGER.warn(msg); |
|
76 |
throw new RuntimeException(msg); |
|
77 |
} |
|
78 |
} |
|
79 |
} else { |
|
80 |
headers = getFixedHeaders(reader.getColumnsCount()); |
|
81 |
} |
|
82 |
} else { |
|
83 |
if (CSVStoreParameters.isFirstLineHeader(parameters)) { |
|
84 |
reader.getHeader(); // Skip and ignore the header of file |
|
85 |
} |
|
86 |
} |
|
87 |
return headers; |
|
88 |
} |
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
public void fillFeatureType(CSVStoreParameters parameters, EditableFeatureType fType, String headers[], AutomaticDetectionOfTypes.DetectedValue automaticTypes[]) { |
|
93 |
String fullFileName = parameters.getFile()==null? "":parameters.getFile().getAbsolutePath(); |
|
94 |
String providerName = this.getProviderName(); |
|
95 |
|
|
96 |
fType.setHasOID(true); |
|
97 |
|
|
98 |
|
|
99 |
FieldTypeParser[] fieldTypes = getFieldTypes(headers, automaticTypes); |
|
100 |
|
|
101 |
fillFeatureType(fType, fieldTypes); |
|
102 |
|
|
103 |
makeGeometry(fType, providerName, fullFileName); |
|
104 |
|
|
105 |
declareGeometryType(fType, fullFileName); |
|
106 |
|
|
107 |
} |
|
108 |
|
|
109 |
private void declareGeometryType(EditableFeatureType fType, String fullFileName) throws LocatorException { |
|
110 |
String geometry_column = CSVStoreParameters.getGeometryColumn(parameters); |
|
111 |
if (!StringUtils.isEmpty(geometry_column)) { |
|
112 |
EditableFeatureAttributeDescriptor attr = (EditableFeatureAttributeDescriptor) fType.get(geometry_column); |
|
113 |
if (attr != null ) { |
|
114 |
if( attr.getType() != DataTypes.GEOMETRY ) { |
|
115 |
attr.setDataType(DataTypes.GEOMETRY); |
|
116 |
} |
|
117 |
GeometryManager geommgr = GeometryLocator.getGeometryManager(); |
|
118 |
GeometryType gt; |
|
119 |
try { |
|
120 |
gt = geommgr.getGeometryType( |
|
121 |
CSVStoreParameters.getGeometryType(parameters), |
|
122 |
CSVStoreParameters.getGeometrySubType(parameters) |
|
123 |
); |
|
124 |
attr.setGeometryType(gt); |
|
125 |
} catch (Exception e) { |
|
126 |
LOGGER.warn("Can't set geometry type for the calculated field in CSV file '" + fullFileName + "'.", e); |
|
127 |
} |
|
128 |
fType.setDefaultGeometryAttributeName(geometry_column); |
|
129 |
} |
|
130 |
} |
|
131 |
} |
|
132 |
|
|
133 |
private void makeGeometry(EditableFeatureType fType, String providerName, String fullFileName) throws LocatorException { |
|
134 |
String[] pointDimensionNames = CSVStoreParameters.getPointDimensionNames(parameters); |
|
135 |
if ( pointDimensionNames != null ) { |
|
136 |
SimpleReaderPointAttributeEmulator emulator = new SimpleReaderPointAttributeEmulator(pointDimensionNames); |
|
137 |
String columnName = CSVStoreParameters.getPointColumnName(parameters); |
|
138 |
if( StringUtils.isBlank(columnName) ) { |
|
139 |
columnName = "geom"; |
|
140 |
} |
|
141 |
EditableFeatureAttributeDescriptor attr = fType.add(columnName, DataTypes.GEOMETRY, emulator); |
|
142 |
GeometryManager geommgr = GeometryLocator.getGeometryManager(); |
|
143 |
GeometryType gt; |
|
144 |
try { |
|
145 |
if ( emulator.getFieldNames() != null && emulator.getFieldNames().length <= 2 ) { |
|
146 |
gt = geommgr.getGeometryType(Geometry.TYPES.GEOMETRY, Geometry.SUBTYPES.GEOM2D); |
|
147 |
} else { |
|
148 |
gt = geommgr.getGeometryType(Geometry.TYPES.GEOMETRY, Geometry.SUBTYPES.GEOM3D); |
|
149 |
} |
|
150 |
attr.setGeometryType(gt); |
|
151 |
} catch (Exception e) { |
|
152 |
LOGGER.warn("Can't set geometry type for the calculated field in '"+providerName+"' file '" + fullFileName + "'.", e); |
|
153 |
} |
|
154 |
} |
|
155 |
} |
|
156 |
|
|
157 | 32 |
} |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/json/JsonStoreProviderFactory.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
|
19 |
* MA 02110-1301, USA. |
|
20 |
* |
|
21 |
* For any additional information, do not hesitate to contact us |
|
22 |
* at info AT gvsig.com, or visit our website www.gvsig.com. |
|
23 |
*/ |
|
24 |
package org.gvsig.fmap.dal.store.json; |
|
25 |
|
|
26 |
import org.gvsig.fmap.dal.DataParameters; |
|
27 |
import org.gvsig.fmap.dal.DataStoreProvider; |
|
28 |
import org.gvsig.fmap.dal.exception.InitializeException; |
|
29 |
import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory; |
|
30 |
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProviderFactory; |
|
31 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
|
32 |
import org.gvsig.tools.dynobject.DynObject; |
|
33 |
|
|
34 |
public class JsonStoreProviderFactory extends AbstractFeatureStoreProviderFactory implements FeatureStoreProviderFactory{ |
|
35 |
|
|
36 |
public JsonStoreProviderFactory(String name, String description) { |
|
37 |
super(name, description); |
|
38 |
} |
|
39 |
|
|
40 |
@Override |
|
41 |
public DataStoreProvider createProvider(DataParameters parameters, |
|
42 |
DataStoreProviderServices providerServices) |
|
43 |
throws InitializeException { |
|
44 |
return new JsonStoreProvider((JsonStoreParameters) parameters, providerServices); |
|
45 |
} |
|
46 |
|
|
47 |
@Override |
|
48 |
public DynObject createParameters() { |
|
49 |
return new JsonStoreParameters(); |
|
50 |
} |
|
51 |
|
|
52 |
@Override |
|
53 |
public int allowCreate() { |
|
54 |
return NO; |
|
55 |
} |
|
56 |
|
|
57 |
@Override |
|
58 |
public int allowWrite() { |
|
59 |
return NO; |
|
60 |
} |
|
61 |
|
|
62 |
@Override |
|
63 |
public int allowRead() { |
|
64 |
return YES; |
|
65 |
} |
|
66 |
|
|
67 |
@Override |
|
68 |
public int hasRasterSupport() { |
|
69 |
return NO; |
|
70 |
} |
|
71 |
|
|
72 |
@Override |
|
73 |
public int hasTabularSupport() { |
|
74 |
return YES; |
|
75 |
} |
|
76 |
|
|
77 |
@Override |
|
78 |
public int hasVectorialSupport() { |
|
79 |
return YES; |
|
80 |
} |
|
81 |
|
|
82 |
public int allowMultipleGeometryTypes() { |
|
83 |
return YES; |
|
84 |
} |
|
85 |
|
|
86 |
@Override |
|
87 |
public int allowEditableFeatureType() { |
|
88 |
return NO; |
|
89 |
} |
|
90 |
|
|
91 |
@Override |
|
92 |
public int useLocalIndexesCanImprovePerformance() { |
|
93 |
return YES; |
|
94 |
} |
|
95 |
|
|
96 |
@Override |
|
97 |
public int isOptimalRecoverFeaturesByReference() { |
|
98 |
return YES; |
|
99 |
} |
|
100 |
|
|
101 |
@Override |
|
102 |
public boolean supportNumericOID() { |
|
103 |
return true; |
|
104 |
} |
|
105 |
|
|
106 |
} |
|
0 | 107 |
trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.dal/org.gvsig.fmap.dal.file/org.gvsig.fmap.dal.file.csv/src/main/java/org/gvsig/fmap/dal/store/json/JsonStoreParameters.java | ||
---|---|---|
1 |
/** |
|
2 |
* gvSIG. Desktop Geographic Information System. |
|
3 |
* |
|
4 |
* Copyright (C) 2007-2013 gvSIG Association. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 3 |
|
9 |
* of the License, or (at your option) any later version. |
Also available in: Unified diff