Statistics
| Revision:

svn-gvsig-desktop / branches / v2_0_0_prep / libraries / libFMap_dalfile / src / org / gvsig / fmap / dal / store / dbf / DBFLibrary.java @ 30717

History | View | Annotate | Download (4.08 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.impl.DALDefaultImplLibrary;
35
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
36
import org.gvsig.tools.dynobject.DynClass;
37
import org.gvsig.tools.dynobject.DynField;
38
import org.gvsig.tools.dynobject.DynObjectValueItem;
39
import org.gvsig.tools.library.AbstractLibrary;
40
import org.gvsig.tools.library.LibraryException;
41

    
42
public class DBFLibrary extends AbstractLibrary {
43

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

    
46
        static DynField addCodePageField(DynClass dynClass) {
47

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

    
74
                });
75
                return dynField;
76

    
77
        }
78

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

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

    
88
                DBFStoreParameters.registerDynClass();
89
                DBFNewStoreParameters.registerDynClass();
90
                DBFStoreProvider.registerDynClass();
91

    
92
        DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
93
                                .getDataManager();
94

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

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