gvsig-raster / org.gvsig.raster / branches / org.gvsig.raster.2.4 / org.gvsig.wms / org.gvsig.wms.provider / src / main / java / org / gvsig / wms / provider / WMSRasterLibrary.java @ 8690
History | View | Annotate | Download (4.06 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 |
package org.gvsig.wms.provider; |
24 |
|
25 |
import java.util.ArrayList; |
26 |
import java.util.List; |
27 |
|
28 |
import org.gvsig.fmap.dal.DALLibrary; |
29 |
import org.gvsig.fmap.dal.FileHelper; |
30 |
import org.gvsig.fmap.dal.spi.DALSPILocator; |
31 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
32 |
import org.gvsig.fmap.mapcontext.MapContextLibrary; |
33 |
import org.gvsig.metadata.exceptions.MetadataException; |
34 |
import org.gvsig.tools.library.AbstractLibrary; |
35 |
import org.gvsig.tools.library.LibraryException; |
36 |
|
37 |
|
38 |
/**
|
39 |
* @author fdiaz
|
40 |
*
|
41 |
*/
|
42 |
public class WMSRasterLibrary extends AbstractLibrary{ |
43 |
|
44 |
@Override
|
45 |
public void doRegistration() { |
46 |
registerAsServiceOf(DALLibrary.class); |
47 |
require(MapContextLibrary.class); |
48 |
|
49 |
// require(DALFileLibrary.class);
|
50 |
//FIXME:
|
51 |
// require(DefaultWMSIOLibrary.class);
|
52 |
} |
53 |
|
54 |
@Override
|
55 |
protected void doInitialize() throws LibraryException { |
56 |
// TODO Auto-generated method stub
|
57 |
|
58 |
} |
59 |
|
60 |
@Override
|
61 |
protected void doPostInitialize() throws LibraryException { |
62 |
List<Throwable> exs = new ArrayList<Throwable>(); |
63 |
|
64 |
try {
|
65 |
FileHelper.registerParametersDefinition(WMSRasterProviderParameters.PARAMETERS_DEFINITION_NAME, |
66 |
WMSRasterProviderParameters.class, "WMSRasterParameters.xml");
|
67 |
} catch (RuntimeException e) { |
68 |
exs.add(e); |
69 |
} |
70 |
|
71 |
try {
|
72 |
FileHelper.registerMetadataDefinition(WMSRasterProvider.METADATA_DEFINITION_NAME, WMSRasterProvider.class, |
73 |
"WMSRasterMetadata.xml");
|
74 |
|
75 |
} catch (MetadataException e) {
|
76 |
exs.add(e); |
77 |
} |
78 |
|
79 |
try {
|
80 |
FileHelper.registerParametersDefinition(WMSRasterServerExplorerParameters.PARAMETERS_DEFINITION_NAME, |
81 |
WMSRasterServerExplorerParameters.class, "WMSRasterParameters.xml");
|
82 |
|
83 |
} catch (RuntimeException e) { |
84 |
exs.add(e); |
85 |
} |
86 |
|
87 |
DataManagerProviderServices dataman = DALSPILocator.getDataManagerProviderServices(); |
88 |
|
89 |
|
90 |
try {
|
91 |
if (!dataman.getStoreProviders()
|
92 |
.contains(WMSRasterProvider.NAME)) { |
93 |
dataman.registerStoreProviderFactory( |
94 |
new WMSRasterProviderFactory(
|
95 |
WMSRasterProvider.NAME, |
96 |
WMSRasterProvider.DESCRIPTION)); |
97 |
} |
98 |
} catch (RuntimeException e) { |
99 |
exs.add(e); |
100 |
} |
101 |
|
102 |
try {
|
103 |
if (!dataman.getExplorerProviders().contains(WMSRasterServerExplorer.NAME)) {
|
104 |
WMSRasterServerExplorerFactory factory = new WMSRasterServerExplorerFactory(WMSRasterServerExplorer.NAME, WMSRasterServerExplorer.DESCRIPTION);
|
105 |
dataman.registerServerExplorerFactory(factory); |
106 |
|
107 |
// dataman.registerStoreFactory(WMSRasterServerExplorer.NAME, WMSRasterServerExplorer.class);
|
108 |
|
109 |
// dataman.registerExplorerProvider(WMSRasterServerExplorer.NAME, WMSRasterServerExplorer.class,
|
110 |
// WMSRasterServerExplorerParameters.class);
|
111 |
} |
112 |
} catch (RuntimeException e) { |
113 |
exs.add(e); |
114 |
} |
115 |
|
116 |
|
117 |
if (exs.size() > 0) { |
118 |
throw new LibraryException(this.getClass(), exs); |
119 |
} |
120 |
} |
121 |
|
122 |
} |