svn-gvsig-desktop / 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 / GMLStoreProvider.java @ 47642
History | View | Annotate | Download (2.98 KB)
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 modify it under
|
7 |
* the terms of the GNU General Public License as published by the Free Software
|
8 |
* Foundation; either version 3 of the License, or (at your option) any later
|
9 |
* version.
|
10 |
*
|
11 |
* This program is distributed in the hope that it will be useful, but WITHOUT
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
13 |
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
14 |
* details.
|
15 |
*
|
16 |
* You should have received a copy of the GNU General Public License along with
|
17 |
* this program; if not, write to the Free Software Foundation, Inc., 51
|
18 |
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us at info AT
|
21 |
* gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
package org.gvsig.fmap.dal.store.gml; |
24 |
|
25 |
import java.io.IOException; |
26 |
import java.io.Reader; |
27 |
import org.gvsig.fmap.dal.FileHelper; |
28 |
import org.gvsig.fmap.dal.exception.InitializeException; |
29 |
import org.gvsig.fmap.dal.resource.spi.ResourceConsumer; |
30 |
import org.gvsig.fmap.dal.spi.DataStoreProviderServices; |
31 |
import org.gvsig.fmap.dal.store.gml.simplereaders.GMLReader; |
32 |
import org.gvsig.fmap.dal.store.simplereader.simplereaders.SimpleReader; |
33 |
import org.gvsig.fmap.dal.store.simplereader.SimpleReaderFeatureTypeLoader; |
34 |
import org.gvsig.fmap.dal.store.simplereader.SimpleReaderStoreParameters; |
35 |
import org.gvsig.fmap.dal.store.simplereader.SimpleReaderStoreProvider; |
36 |
import org.slf4j.Logger; |
37 |
import org.slf4j.LoggerFactory; |
38 |
|
39 |
@SuppressWarnings("UseSpecificCatch") |
40 |
public class GMLStoreProvider extends SimpleReaderStoreProvider implements |
41 |
ResourceConsumer { |
42 |
|
43 |
private static final Logger LOGGER = LoggerFactory.getLogger(GMLStoreProvider.class); |
44 |
|
45 |
public static final String NAME = "GML"; |
46 |
public static final String DESCRIPTION = "GML file"; |
47 |
|
48 |
public static final String METADATA_DEFINITION_NAME = NAME; |
49 |
|
50 |
@SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"}) |
51 |
public GMLStoreProvider(
|
52 |
GMLStoreParameters parameters, |
53 |
DataStoreProviderServices storeServices |
54 |
) throws InitializeException {
|
55 |
super(
|
56 |
parameters, |
57 |
storeServices, |
58 |
FileHelper.newMetadataContainer(METADATA_DEFINITION_NAME) |
59 |
); |
60 |
} |
61 |
|
62 |
private GMLStoreParameters getGMLParameters() {
|
63 |
return (GMLStoreParameters) this.getParameters(); |
64 |
} |
65 |
|
66 |
@Override
|
67 |
public String getProviderName() { |
68 |
return NAME;
|
69 |
} |
70 |
|
71 |
@Override
|
72 |
protected SimpleReader getSimpleReader(SimpleReaderStoreParameters parameters, Reader in) throws IOException { |
73 |
SimpleReader reader = new GMLReader(in,parameters);
|
74 |
return reader;
|
75 |
} |
76 |
|
77 |
@Override
|
78 |
protected SimpleReaderFeatureTypeLoader getFeatureTypeLoader() {
|
79 |
return new GMLFeatureTypeLoader(getGMLParameters()); |
80 |
} |
81 |
|
82 |
} |