01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2003-2006, 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: package org.geotools.coverage.grid.io;
17:
18: import java.util.HashMap;
19:
20: import org.geotools.coverage.grid.io.imageio.GeoToolsWriteParams;
21: import org.geotools.factory.Hints;
22: import org.opengis.coverage.grid.Format;
23: import org.opengis.coverage.grid.GridCoverageReader;
24: import org.opengis.coverage.grid.GridCoverageWriter;
25:
26: /**
27: * This class can be used when a proper {@link Format} cannot be found for some
28: * input sources.
29: *
30: * <p>
31: * It implements the abstract method of {@link AbstractGridFormat} but it always
32: * returns null to indicate that the format it represents is unknown.
33: *
34: * @author Jesse Eichar
35: * @author Simone Giannecchini (simboss)
36: * @source $URL:
37: * http://svn.geotools.org/geotools/branches/2.3.x/module/main/src/org/geotools/data/coverage/grid/UnknownFormat.java $
38: * @version $Revision: 1.9 $
39: */
40: public class UnknownFormat extends AbstractGridFormat implements Format {
41: /**
42: * Creates a new UnknownFormat object.
43: */
44: public UnknownFormat() {
45: mInfo = new HashMap();
46: mInfo.put("name", "Unkown Format");
47: mInfo.put("description",
48: "This format describes all unknown formats");
49: mInfo.put("vendor", null);
50: mInfo.put("docURL", null);
51: mInfo.put("version", null);
52: readParameters = null;
53: writeParameters = null;
54:
55: }
56:
57: /**
58: * @see AbstractGridFormat#getReader(Object)
59: */
60: public GridCoverageReader getReader(java.lang.Object source) {
61: return null;
62: }
63:
64: /**
65: * @see AbstractGridFormat#getWriter(Object)
66: */
67: public GridCoverageWriter getWriter(Object destination) {
68: throw new UnsupportedOperationException(
69: "Trying to get a writer from an unknown format.");
70: }
71:
72: /**
73: * @see AbstractGridFormat#getReader(Object, Hints)
74: */
75: public GridCoverageReader getReader(Object source, Hints hints) {
76: throw new UnsupportedOperationException(
77: "Trying to get a reader from an unknown format.");
78: }
79:
80: /**
81: * @see AbstractGridFormat#getDefaultImageIOWriteParameters()
82: */
83: public GeoToolsWriteParams getDefaultImageIOWriteParameters() {
84: throw new UnsupportedOperationException(
85: "Trying to get a writing parameters from an unknown format.");
86: }
87:
88: /**
89: * @see AbstractGridFormat#accepts(Object)
90: */
91: public boolean accepts(Object input) {
92: return false;
93: }
94:
95: }
|