Statistics
| Revision:

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 24452 jmvivo
/* 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 32880 jjdelcerro
 * AUTHORS (In addition to CIT):
25
 * 2008 IVER T.I. S.A.   {{Task}}
26
 */
27 24452 jmvivo
28 24498 jmvivo
package org.gvsig.fmap.dal.store.dxf;
29 24452 jmvivo
30 32880 jjdelcerro
import java.util.ArrayList;
31
import java.util.List;
32
33 30717 jpiera
import org.gvsig.fmap.dal.DALFileLibrary;
34 24893 jmvivo
import org.gvsig.fmap.dal.DALFileLocator;
35 33032 jjdelcerro
import org.gvsig.fmap.dal.DALLibrary;
36 24498 jmvivo
import org.gvsig.fmap.dal.DALLocator;
37 32880 jjdelcerro
import org.gvsig.fmap.dal.FileHelper;
38 24498 jmvivo
import org.gvsig.fmap.dal.spi.DataManagerProviderServices;
39 37333 fdiaz
import org.gvsig.fmap.dal.store.shp.SHPStoreProvider;
40
import org.gvsig.fmap.dal.store.shp.SHPStoreProviderFactory;
41 32880 jjdelcerro
import org.gvsig.metadata.exceptions.MetadataException;
42 30633 cordinyana
import org.gvsig.tools.library.AbstractLibrary;
43 30580 cordinyana
import org.gvsig.tools.library.LibraryException;
44 24452 jmvivo
45 30633 cordinyana
public class DXFLibrary extends AbstractLibrary {
46 25924 jmvivo
47 35142 cordinyana
    @Override
48
    public void doRegistration() {
49
        registerAsServiceOf(DALLibrary.class);
50
        require(DALFileLibrary.class);
51
    }
52
53 30580 cordinyana
        @Override
54
        protected void doInitialize() throws LibraryException {
55
        }
56 25548 cordinyana
57 30580 cordinyana
        @Override
58
        protected void doPostInitialize() throws LibraryException {
59 32880 jjdelcerro
                List<Throwable> exs = new ArrayList<Throwable>();
60 25924 jmvivo
61 32880 jjdelcerro
                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 25548 cordinyana
72 32880 jjdelcerro
                DataManagerProviderServices dataman = (DataManagerProviderServices) DALLocator
73 24452 jmvivo
                                .getDataManager();
74
75 32880 jjdelcerro
                try {
76
                        if (!dataman.getStoreProviders().contains(DXFStoreProvider.NAME)) {
77 37333 fdiaz
                                dataman.registerStoreProviderFactory(new DXFStoreProviderFactory(DXFStoreProvider.NAME, DXFStoreProvider.DESCRIPTION));
78
79 32880 jjdelcerro
                        }
80
                } catch (RuntimeException e) {
81
                        exs.add(e);
82 24452 jmvivo
                }
83
84 32880 jjdelcerro
                try {
85
                        DALFileLocator.getFilesystemServerExplorerManager()
86
                                        .registerProvider(DXFStoreProvider.NAME,
87
                                                        DXFStoreProvider.DESCRIPTION,
88
                                                        DXFFilesystemServerProvider.class);
89
                } catch (RuntimeException e) {
90
                        exs.add(e);
91
                }
92 25789 jmvivo
93 32880 jjdelcerro
                if (exs.size() > 0) {
94
                        throw new LibraryException(this.getClass(), exs);
95 25789 jmvivo
                }
96 24452 jmvivo
        }
97 30580 cordinyana
}