Statistics
| Revision:

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.dbf / src / main / java / org / gvsig / fmap / dal / store / dbf / DBFStoreProviderFactory.java @ 42533

History | View | Annotate | Download (3.43 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
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.dbf;
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.DataStoreProvider;
31
import org.gvsig.fmap.dal.exception.InitializeException;
32
import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory;
33
import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProviderFactory;
34
import org.gvsig.fmap.dal.spi.DataStoreProviderServices;
35
import org.gvsig.fmap.dal.store.dbf.utils.DbaseFile;
36
import org.gvsig.tools.ToolsLocator;
37
import org.gvsig.tools.dataTypes.DataType;
38
import org.gvsig.tools.dataTypes.DataTypes;
39
import org.gvsig.tools.dataTypes.DataTypesManager;
40
import org.gvsig.tools.dynobject.DynObject;
41
import org.slf4j.Logger;
42
import org.slf4j.LoggerFactory;
43

    
44
public class DBFStoreProviderFactory extends AbstractFeatureStoreProviderFactory implements FeatureStoreProviderFactory{
45

    
46
    private static final Logger logger = LoggerFactory.getLogger(DBFStoreProviderFactory.class);
47

    
48
        protected DBFStoreProviderFactory(String name, String description) {
49
                super(name, description);
50
        }
51

    
52
        public DataStoreProvider createProvider(DataParameters parameters,
53
                        DataStoreProviderServices providerServices)
54
                        throws InitializeException {
55
                return new DBFStoreProvider((DBFStoreParameters) parameters, providerServices);
56
        }
57

    
58
        public DynObject createParameters() {
59
                return new DBFStoreParameters();
60
        }
61

    
62
        public int allowCreate() {
63
                return YES;
64
        }
65

    
66
        public int allowWrite() {
67
                return YES;
68
        }
69

    
70
        public int allowRead() {
71
                return YES;
72
        }
73

    
74
        public int hasRasterSupport() {
75
                return NO;
76
        }
77

    
78
        public int hasTabularSupport() {
79
                return YES;
80
        }
81

    
82
        public int hasVectorialSupport() {
83
                return NO;
84
        }
85

    
86
        public int allowMultipleGeometryTypes() {
87
                return NO;
88
        }
89

    
90

    
91
    public int allowEditableFeatureType() {
92
        return YES;
93
    }
94

    
95
    public int useLocalIndexesCanImprovePerformance() {
96
        return YES;
97
    }
98

    
99
    public List<DataType> getSupportedDataTypes() {
100

    
101
        DataTypesManager manager = ToolsLocator.getDataTypesManager();
102

    
103
        ArrayList<DataType> resp = new ArrayList<DataType>();
104
        resp.add(manager.get(DataTypes.STRING));
105
        resp.add(manager.get(DataTypes.INT));
106
        resp.add(manager.get(DataTypes.FLOAT));
107
        resp.add(manager.get(DataTypes.DATE));
108
        return resp;
109
    }
110

    
111
    public boolean allowsMandatoryAttributes() {
112
        return false;
113
    }
114

    
115
    public boolean allowsPrimaryKeyAttributes() {
116
        return false;
117
    }
118

    
119
        public int getMaxAttributeNameSize() {
120
            return DbaseFile.MAX_FIELD_NAME_LENGTH;
121
        }
122
}