Statistics
| Revision:

root / branches / v2_0_0_prep / libraries / libFMap_dalfile / src / org / gvsig / fmap / dal / store / dbf / DBFLibrary.java @ 30754

History | View | Annotate | Download (3.98 KB)

1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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
 */
22

    
23
/*
24
* AUTHORS (In addition to CIT):
25
* 2008 IVER T.I. S.A.   {{Task}}
26
*/
27

    
28
package org.gvsig.fmap.dal.store.dbf;
29

    
30
import org.gvsig.fmap.dal.DALFileLibrary;
31
import org.gvsig.fmap.dal.DALFileLocator;
32
import org.gvsig.fmap.dal.DALLocator;
33
import org.gvsig.fmap.dal.DataTypes;
34
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
35
import org.gvsig.tools.dynobject.DynClass;
36
import org.gvsig.tools.dynobject.DynField;
37
import org.gvsig.tools.dynobject.DynObjectValueItem;
38
import org.gvsig.tools.library.AbstractLibrary;
39
import org.gvsig.tools.library.LibraryException;
40

    
41
public class DBFLibrary extends AbstractLibrary {
42

    
43
        public static final String DYNFIELD_CODEPAGE_NAME = "codePage";
44

    
45
        static DynField addCodePageField(DynClass dynClass) {
46

    
47
                DynField dynField = dynClass.addDynField(DYNFIELD_CODEPAGE_NAME);
48
                dynField.setDescription("Code Page");
49
                dynField.setDefaultDynValue(new Byte((byte) 0x2));
50
                dynField.setType(DataTypes.BYTE);
51
                dynField.setTheTypeOfAvailableValues(DynField.CHOICE);
52
                dynField.setAvailableValues(new DynObjectValueItem[] {
53
                        new DynObjectValueItem(new Byte((byte) 0x1),"DOS USA"),
54
                        new DynObjectValueItem(new Byte((byte) 0x2),"DOS Multilingual"),
55
                        new DynObjectValueItem(new Byte((byte) 0x3),"Windows ANSI"),
56
                        new DynObjectValueItem(new Byte((byte) 0x4),"Standard Macintosh"),
57
                        new DynObjectValueItem(new Byte((byte) 0x64),"EE MS-DOS"),
58
                        new DynObjectValueItem(new Byte((byte) 0x65),"Nordic MS-DOS"),
59
                        new DynObjectValueItem(new Byte((byte) 0x66),"Russian MS-DOS"),
60
                        new DynObjectValueItem(new Byte((byte) 0x67),"Icelandic MS-DOS"),
61
                        new DynObjectValueItem(new Byte((byte) 0x68),"Kamenicky (Czech) MS-DOS"),
62
                        new DynObjectValueItem(new Byte((byte) 0x69),"Mazovia (Polish) MS-DOS"),
63
                        new DynObjectValueItem(new Byte((byte) 0x6A),"Greek MS-DOS (437G)"),
64
                        new DynObjectValueItem(new Byte((byte) 0x6B),"Turkish MS-DOS"),
65
                        new DynObjectValueItem(new Byte((byte) 0x96),"Russian Macintosh"),
66
                        new DynObjectValueItem(new Byte((byte) 0x97),"Eastern European Macintosh"),
67
                        new DynObjectValueItem(new Byte((byte) 0x98),"Greek Macintosh"),
68
                        new DynObjectValueItem(new Byte((byte) 0xC8),"Windows EE"),
69
                        new DynObjectValueItem(new Byte((byte) 0xC9),"Russian Windows"),
70
                        new DynObjectValueItem(new Byte((byte) 0xCA),"Turkish Windows"),
71
                        new DynObjectValueItem(new Byte((byte) 0xCB),"Greek Windows"),
72

    
73
                });
74
                return dynField;
75

    
76
        }
77

    
78
        @Override
79
        protected void doInitialize() throws LibraryException {
80
        }
81

    
82
        @Override
83
        protected void doPostInitialize() throws LibraryException {
84
                new DALFileLibrary().postInitialize();
85

    
86
                DBFStoreParameters.registerDynClass();
87
                DBFNewStoreParameters.registerDynClass();
88
                DBFStoreProvider.registerDynClass();
89

    
90
        DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
91
                                .getDataManager();
92

    
93
                if (!dataman.getStoreProviders().contains(DBFStoreProvider.NAME)) {
94
                        dataman.registerStoreProvider(DBFStoreProvider.NAME,
95
                                        DBFStoreProvider.class, DBFStoreParameters.class);
96
                }
97

    
98
                DALFileLocator.getFilesystemServerExplorerManager().registerProvider(
99
                                DBFStoreProvider.NAME, DBFStoreProvider.DESCRIPTION,
100
                                DBFFilesystemServerProvider.class);
101
        }
102
}