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.arcgrid;
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: * Implementation of the {@link Format} service provider interface for arc
29: * grid files.
30: *
31: * @author Daniele Romagnoli
32: * @author Simone Giannecchini (simboss)
33: */
34: public final class ArcGridFormatFactory implements GridFormatFactorySpi {
35: /** Logger. */
36: private final static Logger LOGGER = org.geotools.util.logging.Logging
37: .getLogger("org.geotools.gce.arcgrid");
38:
39: /**
40: * Tells me if the coverage plugin to access Ascii grids is availaible or
41: * not.
42: *
43: * @return True if the plugin is availaible, False otherwise.
44: */
45: public boolean isAvailable() {
46: boolean available = true;
47:
48: // if these classes are here, then the runtine environment has
49: // access to JAI and the JAI ImageI/O toolbox.
50: try {
51:
52: Class.forName("javax.media.jai.JAI");
53: Class
54: .forName("com.sun.media.jai.operator.ImageReadDescriptor");
55: Class
56: .forName("it.geosolutions.imageio.plugins.arcgrid.AsciiGridsImageMetadata");
57: if (LOGGER.isLoggable(Level.FINE))
58: LOGGER.fine("ArcGridFormatFactory is availaible.");
59: } catch (ClassNotFoundException cnf) {
60: if (LOGGER.isLoggable(Level.FINE))
61: LOGGER.fine("ArcGridFormatFactory is not availaible.");
62: available = false;
63: }
64:
65: return available;
66: }
67:
68: /**
69: * Creating an {@link ArcGridFormat}.
70: *
71: * @return An {@link ArcGridFormat}.;
72: */
73: public Format createFormat() {
74: return new ArcGridFormat();
75: }
76:
77: /**
78: * Returns the implementation hints. The default implementation returns en
79: * empty map.
80: *
81: * @return DOCUMENT ME!
82: */
83: public Map getImplementationHints() {
84: return Collections.EMPTY_MAP;
85: }
86: }
|