root / branches / v2_0_0_prep / libraries / libFMap_dalfile / src / org / gvsig / fmap / dal / store / dxf / DXFLibrary.java @ 32880
History | View | Annotate | Download (2.8 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.dxf; |
29 |
|
30 |
import java.util.ArrayList; |
31 |
import java.util.List; |
32 |
|
33 |
import org.gvsig.fmap.dal.DALFileLibrary; |
34 |
import org.gvsig.fmap.dal.DALFileLocator; |
35 |
import org.gvsig.fmap.dal.DALLocator; |
36 |
import org.gvsig.fmap.dal.FileHelper; |
37 |
import org.gvsig.fmap.dal.impl.DALDefaultImplLibrary; |
38 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
39 |
import org.gvsig.metadata.exceptions.MetadataException; |
40 |
import org.gvsig.tools.library.AbstractLibrary; |
41 |
import org.gvsig.tools.library.LibraryException; |
42 |
|
43 |
public class DXFLibrary extends AbstractLibrary { |
44 |
|
45 |
@Override
|
46 |
protected void doInitialize() throws LibraryException { |
47 |
} |
48 |
|
49 |
@Override
|
50 |
protected void doPostInitialize() throws LibraryException { |
51 |
new DALDefaultImplLibrary().postInitialize();
|
52 |
new DALFileLibrary().postInitialize();
|
53 |
List<Throwable> exs = new ArrayList<Throwable>(); |
54 |
|
55 |
FileHelper.registerParametersDefinition( |
56 |
DXFStoreParameters.PARAMETERS_DEFINITION_NAME, |
57 |
DXFStoreParameters.class, "DXFParameters.xml");
|
58 |
try {
|
59 |
FileHelper.registerMetadataDefinition( |
60 |
DXFStoreProvider.METADATA_DEFINITION_NAME, |
61 |
DXFStoreProvider.class, "DXFMetadata.xml");
|
62 |
} catch (MetadataException e) {
|
63 |
exs.add(e); |
64 |
} |
65 |
|
66 |
DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator |
67 |
.getDataManager(); |
68 |
|
69 |
try {
|
70 |
if (!dataman.getStoreProviders().contains(DXFStoreProvider.NAME)) {
|
71 |
dataman.registerStoreProvider(DXFStoreProvider.NAME, |
72 |
DXFStoreProvider.class, DXFStoreParameters.class); |
73 |
} |
74 |
} catch (RuntimeException e) { |
75 |
exs.add(e); |
76 |
} |
77 |
|
78 |
try {
|
79 |
DALFileLocator.getFilesystemServerExplorerManager() |
80 |
.registerProvider(DXFStoreProvider.NAME, |
81 |
DXFStoreProvider.DESCRIPTION, |
82 |
DXFFilesystemServerProvider.class); |
83 |
} catch (RuntimeException e) { |
84 |
exs.add(e); |
85 |
} |
86 |
|
87 |
if (exs.size() > 0) { |
88 |
throw new LibraryException(this.getClass(), exs); |
89 |
} |
90 |
} |
91 |
} |