01: /*
02: * Geotools2 - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2002, Geotools Project Managment Committee (PMC)
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library 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 GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package org.geotools.gce.gtopo30;
18:
19: import java.util.Collections;
20: import java.util.Map;
21: import java.util.logging.Level;
22: import java.util.logging.Logger;
23:
24: import org.geotools.coverage.grid.io.GridFormatFactorySpi;
25: import org.opengis.coverage.grid.Format;
26:
27: /**
28: * The GTopo30FormatFactory will be discovered by the GridFormatFinder. Use the
29: * standard Geotools method of discovering a factory in order to create a
30: * format.
31: *
32: * @author Simone Giannecchini
33: * @author mkraemer
34: * @source $URL:
35: * http://svn.geotools.org/geotools/trunk/gt/plugin/gtopo30/src/org/geotools/gce/gtopo30/GTopo30FormatFactory.java $
36: */
37: public class GTopo30FormatFactory implements GridFormatFactorySpi {
38:
39: /** Logger. */
40: private final static Logger LOGGER = org.geotools.util.logging.Logging
41: .getLogger("org.geotools.gce.gtopo30");
42:
43: /**
44: * Creates a new instance of GTopo30Format
45: *
46: * @return an instance of GTopo30Format
47: */
48: public Format createFormat() {
49: return new GTopo30Format();
50: }
51:
52: /**
53: * Checks for the JAI library which is needed by the GTopo30DataSource
54: *
55: * @return true if all libraries are available
56: */
57: public boolean isAvailable() {
58: boolean available = true;
59:
60: // if these classes are here, then the runtine environment has
61: // access to JAI and the JAI ImageI/O toolbox.
62:
63: try {
64: Class.forName("javax.media.jai.JAI");
65: Class
66: .forName("com.sun.media.jai.operator.ImageReadDescriptor");
67: } catch (ClassNotFoundException e) {
68: if (LOGGER.isLoggable(Level.FINE))
69: LOGGER.log(Level.FINE, e.getLocalizedMessage(), e);
70: available = false;
71: }
72:
73: return available;
74: }
75:
76: /**
77: * Returns the implementation hints
78: *
79: * @return the implementation hints (an empty map, actually)
80: */
81: public Map getImplementationHints() {
82: return Collections.EMPTY_MAP;
83: }
84: }
|