svn-gvsig-desktop / trunk / org.gvsig.desktop / org.gvsig.desktop.compat.cdc / org.gvsig.fmap.dal / org.gvsig.fmap.dal.tilecache / org.gvsig.fmap.dal.tilecache.raster / src / main / java / org / gvsig / raster / tilecache / provider / TileCacheLibrary.java @ 44831
History | View | Annotate | Download (4.11 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.raster.tilecache.provider; |
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.DALLibrary; |
31 |
import org.gvsig.fmap.dal.FileHelper; |
32 |
import org.gvsig.fmap.dal.spi.DALSPILocator; |
33 |
import org.gvsig.fmap.dal.spi.DataManagerProviderServices; |
34 |
import org.gvsig.metadata.exceptions.MetadataException; |
35 |
import org.gvsig.tools.library.AbstractLibrary; |
36 |
import org.gvsig.tools.library.LibraryException; |
37 |
|
38 |
/**
|
39 |
* Jimi Library to register provider commponents
|
40 |
* @author dmartinezizquierdo
|
41 |
*
|
42 |
*/
|
43 |
public class TileCacheLibrary extends AbstractLibrary { |
44 |
|
45 |
public static int DEFAULT_LEVELS = 25; |
46 |
public static int DEFAULT_TILEWIDTH = 256; |
47 |
public static int DEFAULT_TILEHEIGHT = 256; |
48 |
|
49 |
|
50 |
@Override
|
51 |
public void doRegistration() { |
52 |
registerAsServiceOf(DALLibrary.class); |
53 |
require(DALFileLibrary.class); |
54 |
|
55 |
} |
56 |
|
57 |
@Override
|
58 |
protected void doInitialize() throws LibraryException { |
59 |
} |
60 |
|
61 |
@Override
|
62 |
protected void doPostInitialize() throws LibraryException { |
63 |
List<Throwable> exs = new ArrayList<Throwable>(); |
64 |
|
65 |
FileHelper.registerParametersDefinition( |
66 |
TileCacheStoreProviderParameters.PARAMETERS_DEFINITION_NAME, |
67 |
TileCacheStoreProviderParameters.class, "TileCacheParameters.xml");
|
68 |
try {
|
69 |
FileHelper.registerMetadataDefinition( |
70 |
TileCacheStoreProvider.METADATA_DEFINITION_NAME, |
71 |
TileCacheStoreProvider.class, "TileCacheMetadata.xml");
|
72 |
} catch (MetadataException e) {
|
73 |
exs.add(e); |
74 |
} |
75 |
|
76 |
FileHelper.registerParametersDefinition(MemoryTileCacheStoreProviderParameters.PARAMETERS_DEFINITION_NAME, |
77 |
MemoryTileCacheStoreProviderParameters.class, "TileCacheParameters.xml");
|
78 |
try {
|
79 |
FileHelper.registerMetadataDefinition(MemoryTileCacheStoreProvider.METADATA_DEFINITION_NAME, |
80 |
MemoryTileCacheStoreProvider.class, "TileCacheMetadata.xml");
|
81 |
} catch (MetadataException e) {
|
82 |
exs.add(e); |
83 |
} |
84 |
|
85 |
DataManagerProviderServices dataman = DALSPILocator.getDataManagerProviderServices(); |
86 |
|
87 |
|
88 |
try {
|
89 |
if (!dataman.getStoreProviders()
|
90 |
.contains(TileCacheStoreProvider.NAME)) { |
91 |
dataman.registerStoreProviderFactory( |
92 |
new TileCacheStoreProviderFactory(
|
93 |
TileCacheStoreProvider.NAME, |
94 |
TileCacheStoreProvider.DESCRIPTION)); |
95 |
} |
96 |
if (!dataman.getStoreProviders()
|
97 |
.contains(MemoryTileCacheStoreProvider.NAME)) { |
98 |
dataman.registerStoreProviderFactory( |
99 |
new MemoryTileCacheStoreProviderFactory(
|
100 |
MemoryTileCacheStoreProvider.NAME, |
101 |
MemoryTileCacheStoreProvider.DESCRIPTION)); |
102 |
} |
103 |
} catch (RuntimeException e) { |
104 |
exs.add(e); |
105 |
} |
106 |
|
107 |
// try {
|
108 |
// DALFileLocator.getFilesystemServerExplorerManager()
|
109 |
// .registerProvider(TileCacheStoreProvider.NAME,
|
110 |
// TileCacheStoreProvider.DESCRIPTION,
|
111 |
// TileCacheFileSystemServerProvider.class);
|
112 |
// } catch (RuntimeException e) {
|
113 |
// exs.add(e);
|
114 |
// }
|
115 |
|
116 |
if (exs.size() > 0) { |
117 |
throw new LibraryException(this.getClass(), exs); |
118 |
} |
119 |
} |
120 |
} |