root / branches / v2_0_0_prep / libraries / libFMap_dalfile / src / org / gvsig / fmap / dal / store / dbf / DBFLibrary.java @ 30187
History | View | Annotate | Download (3.86 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.DALFileLocator; |
31 |
import org.gvsig.fmap.dal.DALLocator; |
32 |
import org.gvsig.fmap.dal.DataTypes; |
33 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
34 |
import org.gvsig.tools.dynobject.DynClass; |
35 |
import org.gvsig.tools.dynobject.DynField; |
36 |
import org.gvsig.tools.dynobject.DynObjectValueItem; |
37 |
import org.gvsig.tools.locator.BaseLibrary; |
38 |
import org.gvsig.tools.locator.ReferenceNotRegisteredException; |
39 |
|
40 |
|
41 |
public class DBFLibrary extends BaseLibrary { |
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 |
public void postInitialize() throws ReferenceNotRegisteredException { |
79 |
super.postInitialize();
|
80 |
|
81 |
|
82 |
DBFStoreParameters.registerDynClass(); |
83 |
DBFNewStoreParameters.registerDynClass(); |
84 |
DBFStoreProvider.registerDynClass(); |
85 |
|
86 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator |
87 |
.getDataManager(); |
88 |
|
89 |
if (!dataman.getStoreProviders().contains(DBFStoreProvider.NAME)) {
|
90 |
dataman.registerStoreProvider(DBFStoreProvider.NAME, |
91 |
DBFStoreProvider.class, DBFStoreParameters.class); |
92 |
} |
93 |
|
94 |
|
95 |
|
96 |
DALFileLocator.getFilesystemServerExplorerManager().registerProvider( |
97 |
DBFStoreProvider.NAME, DBFStoreProvider.DESCRIPTION, |
98 |
DBFFilesystemServerProvider.class); |
99 |
} |
100 |
|
101 |
} |