Statistics
| Revision:

gvsig-gdal / trunk / org.gvsig.gdal / org.gvsig.gdal.prov / org.gvsig.gdal.prov.ogr / src / main / java / org / gvsig / gdal / prov / ogr / BasicOGRDataStoreProviderFactory.java @ 135

History | View | Annotate | Download (3.99 KB)

1
/**
2
 * gvSIG. Desktop Geographic Information System.
3
 *
4
 * Copyright ? 2007-2016 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 2
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.gdal.prov.ogr;
25

    
26
import java.util.ArrayList;
27
import java.util.List;
28

    
29
import org.gvsig.fmap.dal.DataParameters;
30
import org.gvsig.fmap.dal.DataStoreParameters;
31
import org.gvsig.fmap.dal.DataStoreProvider;
32
import org.gvsig.fmap.dal.DataTypes;
33
import org.gvsig.fmap.dal.exception.InitializeException;
34
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProviderFactory;
35
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
36
import org.gvsig.fmap.geom.Geometry.SUBTYPES;
37
import org.gvsig.tools.dynobject.DynObject;
38

    
39
/**
40
 * 
41
 * @author <a href="mailto:lmarques@disid.com">Lluis Marques</a>
42
 *
43
 */
44
public class BasicOGRDataStoreProviderFactory extends AbstractFeatureStoreProviderFactory implements
45
    OGRDataStoreProviderFactory {
46

    
47
    /**
48
     * @param name
49
     *            Name of factory
50
     * @param description
51
     *            Description of factory
52
     */
53
    public BasicOGRDataStoreProviderFactory(String name, String description) {
54
        super(name, description);
55
    }
56

    
57
    @Override
58
    public DataStoreProvider createProvider(DataParameters dataParameters,
59
        DataStoreProviderServices providerServices) throws InitializeException {
60
        return new OGRDataStoreProvider((DataStoreParameters) dataParameters, providerServices);
61
    }
62

    
63
    @Override
64
    public DynObject createParameters() {
65
        return new OGRDataStoreParameters();
66
    }
67

    
68
    public int allowMultipleGeometryTypes() {
69
        return UNKNOWN;
70
    }
71

    
72
    public int allowEditableFeatureType() {
73
        return UNKNOWN;
74
    }
75

    
76
    /**
77
     * See {@link OGRConverter#convertToDataType(int)} method. The list of data
78
     * type of OGR. If the list of OGR types changes update this method.
79
     */
80
    @SuppressWarnings("rawtypes")
81
    public List getSupportedDataTypes() {
82

    
83
        List<Integer> supportedDataTypes = new ArrayList<Integer>();
84

    
85
        supportedDataTypes.add(DataTypes.BOOLEAN);
86
        supportedDataTypes.add(DataTypes.DATE);
87
        supportedDataTypes.add(DataTypes.FLOAT);
88
        supportedDataTypes.add(DataTypes.DOUBLE);
89
        supportedDataTypes.add(DataTypes.STRING);
90
        supportedDataTypes.add(DataTypes.INT);
91
        supportedDataTypes.add(DataTypes.LONG);
92
        supportedDataTypes.add(DataTypes.TIME);
93

    
94
        return supportedDataTypes;
95
    }
96

    
97
    @SuppressWarnings("rawtypes")
98
    public List getSupportedGeometryTypesSubtypes() {
99
        List<Integer> supportedSubtypes = new ArrayList<Integer>();
100
        supportedSubtypes.add(SUBTYPES.GEOM2D);
101
        return supportedSubtypes;
102
    }
103

    
104
    public boolean allowsMandatoryAttributes() {
105
        return false;
106
    }
107

    
108
    public boolean allowsPrimaryKeyAttributes() {
109
        return false;
110
    }
111

    
112
    public int useLocalIndexesCanImprovePerformance() {
113
        return UNKNOWN;
114
    }
115

    
116
    @Override
117
    public DynObject createDataExplorerParameters(Object connectionString) {
118
        return new OGRDataExplorerParameters();
119
    }
120

    
121
    @Override
122
    public DynObject createParameters(Object connectionObject) {
123
        return createParameters();
124
    }
125

    
126
    @Override
127
    public String getDriver() {
128
        return null;
129
    }
130

    
131
}