svn-gvsig-desktop / branches / org.gvsig.desktop-2018a / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.file / org.gvsig.fmap.dal.file.jpg / src / main / java / org / gvsig / fmap / dal / file / jpg / JpgLibrary.java @ 43803
History | View | Annotate | Download (3.05 KB)
1 |
/* gvSIG. Desktop Geographic Information System.
|
---|---|
2 |
*
|
3 |
* Copyright ? 2007-2016 gvSIG Association
|
4 |
*
|
5 |
* This program is free software; you can redistribute it and/or
|
6 |
* modify it under the terms of the GNU General Public License
|
7 |
* as published by the Free Software Foundation; either version 2
|
8 |
* of the License, or (at your option) any later version.
|
9 |
*
|
10 |
* This program is distributed in the hope that it will be useful,
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13 |
* GNU General Public License for more details.
|
14 |
*
|
15 |
* You should have received a copy of the GNU General Public License
|
16 |
* along with this program; if not, write to the Free Software
|
17 |
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18 |
* MA 02110-1301, USA.
|
19 |
*
|
20 |
* For any additional information, do not hesitate to contact us
|
21 |
* at info AT gvsig.com, or visit our website www.gvsig.com.
|
22 |
*/
|
23 |
|
24 |
package org.gvsig.fmap.dal.file.jpg; |
25 |
|
26 |
import java.util.ArrayList; |
27 |
import java.util.List; |
28 |
|
29 |
import org.gvsig.fmap.dal.DALFileLibrary; |
30 |
import org.gvsig.fmap.dal.DALFileLocator; |
31 |
import org.gvsig.fmap.dal.DALLibrary; |
32 |
import org.gvsig.fmap.dal.FileHelper; |
33 |
import org.gvsig.fmap.dal.spi.DALSPILocator; |
34 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
35 |
import org.gvsig.metadata.exceptions.MetadataException; |
36 |
import org.gvsig.tools.library.AbstractLibrary; |
37 |
import org.gvsig.tools.library.LibraryException; |
38 |
|
39 |
/**
|
40 |
* Jpg Library to register provider components
|
41 |
* @author fdiaz
|
42 |
*
|
43 |
*/
|
44 |
public class JpgLibrary extends AbstractLibrary { |
45 |
|
46 |
@Override
|
47 |
public void doRegistration() { |
48 |
registerAsServiceOf(DALLibrary.class); |
49 |
require(DALFileLibrary.class); |
50 |
|
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 |
JpgStoreProviderParameters.PARAMETERS_DEFINITION_NAME, |
63 |
JpgStoreProviderParameters.class, JpgStoreProvider.NAME+"Parameters.xml");
|
64 |
try {
|
65 |
FileHelper.registerMetadataDefinition( |
66 |
JpgStoreProvider.METADATA_DEFINITION_NAME, |
67 |
JpgStoreProvider.class, JpgStoreProvider.NAME+"Metadata.xml");
|
68 |
} catch (MetadataException e) {
|
69 |
exs.add(e); |
70 |
} |
71 |
|
72 |
DataManagerProviderServices dataman = DALSPILocator.getDataManagerProviderServices(); |
73 |
|
74 |
|
75 |
try {
|
76 |
if (!dataman.getStoreProviders()
|
77 |
.contains(JpgStoreProvider.NAME)) { |
78 |
dataman.registerStoreProviderFactory( |
79 |
new JpgStoreProviderFactory(
|
80 |
JpgStoreProvider.NAME, |
81 |
JpgStoreProvider.DESCRIPTION)); |
82 |
} |
83 |
} catch (RuntimeException e) { |
84 |
exs.add(e); |
85 |
} |
86 |
|
87 |
try {
|
88 |
DALFileLocator.getFilesystemServerExplorerManager() |
89 |
.registerProvider(JpgStoreProvider.NAME, |
90 |
JpgStoreProvider.DESCRIPTION, |
91 |
JpgFileSystemServerProvider.class); |
92 |
} catch (RuntimeException e) { |
93 |
exs.add(e); |
94 |
} |
95 |
|
96 |
if (exs.size() > 0) { |
97 |
throw new LibraryException(this.getClass(), exs); |
98 |
} |
99 |
} |
100 |
} |