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