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 @ 43020
History | View | Annotate | Download (3.47 KB)
1 | 42533 | dmartinezizquierdo | /**
|
---|---|---|---|
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.exception.InitializeException; |
||
31 | import org.gvsig.fmap.dal.feature.FeatureStoreProviderFactory; |
||
32 | import org.gvsig.fmap.dal.feature.spi.AbstractFeatureStoreProviderFactory; |
||
33 | 43020 | jjdelcerro | import org.gvsig.fmap.dal.feature.spi.FeatureStoreProvider; |
34 | 42533 | dmartinezizquierdo | 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 | 43020 | jjdelcerro | public class DBFStoreProviderFactory extends AbstractFeatureStoreProviderFactory { |
45 | 42533 | dmartinezizquierdo | |
46 | private static final Logger logger = LoggerFactory.getLogger(DBFStoreProviderFactory.class); |
||
47 | |||
48 | protected DBFStoreProviderFactory(String name, String description) { |
||
49 | super(name, description);
|
||
50 | } |
||
51 | 43020 | jjdelcerro | |
52 | @Override
|
||
53 | public FeatureStoreProvider createProvider(
|
||
54 | DataParameters parameters, |
||
55 | DataStoreProviderServices providerServices |
||
56 | ) throws InitializeException {
|
||
57 | return new DBFStoreProvider((DBFStoreParameters) parameters, providerServices); |
||
58 | } |
||
59 | |||
60 | 42533 | dmartinezizquierdo | public DynObject createParameters() {
|
61 | return new DBFStoreParameters(); |
||
62 | } |
||
63 | |||
64 | public int allowCreate() { |
||
65 | return YES;
|
||
66 | } |
||
67 | |||
68 | public int allowWrite() { |
||
69 | return YES;
|
||
70 | } |
||
71 | |||
72 | public int allowRead() { |
||
73 | return YES;
|
||
74 | } |
||
75 | |||
76 | public int hasRasterSupport() { |
||
77 | return NO;
|
||
78 | } |
||
79 | |||
80 | public int hasTabularSupport() { |
||
81 | return YES;
|
||
82 | } |
||
83 | |||
84 | public int hasVectorialSupport() { |
||
85 | return NO;
|
||
86 | } |
||
87 | |||
88 | public int allowMultipleGeometryTypes() { |
||
89 | return NO;
|
||
90 | } |
||
91 | |||
92 | |||
93 | public int allowEditableFeatureType() { |
||
94 | return YES;
|
||
95 | } |
||
96 | |||
97 | public int useLocalIndexesCanImprovePerformance() { |
||
98 | return YES;
|
||
99 | } |
||
100 | |||
101 | public List<DataType> getSupportedDataTypes() { |
||
102 | |||
103 | DataTypesManager manager = ToolsLocator.getDataTypesManager(); |
||
104 | |||
105 | ArrayList<DataType> resp = new ArrayList<DataType>(); |
||
106 | resp.add(manager.get(DataTypes.STRING)); |
||
107 | resp.add(manager.get(DataTypes.INT)); |
||
108 | resp.add(manager.get(DataTypes.FLOAT)); |
||
109 | resp.add(manager.get(DataTypes.DATE)); |
||
110 | return resp;
|
||
111 | } |
||
112 | |||
113 | public boolean allowsMandatoryAttributes() { |
||
114 | return false; |
||
115 | } |
||
116 | |||
117 | public boolean allowsPrimaryKeyAttributes() { |
||
118 | return false; |
||
119 | } |
||
120 | |||
121 | public int getMaxAttributeNameSize() { |
||
122 | return DbaseFile.MAX_FIELD_NAME_LENGTH;
|
||
123 | } |
||
124 | } |