01: /*
02: * GeoTools - OpenSource mapping toolkit
03: * http://geotools.org
04: * (C) 2004-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; either
09: * version 2.1 of the License, or (at your option) any later version.
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.data.wms.gce;
17:
18: import java.util.Collections;
19: import java.util.Map;
20:
21: import org.geotools.coverage.grid.io.GridFormatFactorySpi;
22: import org.geotools.data.ows.WMSCapabilities;
23: import org.opengis.coverage.grid.Format;
24:
25: /**
26: * Factory for the creation of a Format for use with WebMapServer.
27: *
28: * <p>
29: * The level of separation afforded a Factory implementation is not currently
30: * used, however we may need make use of this class to provide a specific
31: * WMSFormat for each version of the WMS Specification.
32: * </p>
33: *
34: * @author Richard Gould, Refractions Research
35: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/plugin/wms/src/main/java/org/geotools/data/wms/gce/WMSFormatFactory.java $
36: */
37: public class WMSFormatFactory implements GridFormatFactorySpi {
38: private WMSCapabilities capabilities;
39:
40: /**
41: * WMSFormatFactory constructions based on parsed CapabilitiesDocument.
42: *
43: * <p>
44: * Currently only WMSFormat is supported - my impression is that a given
45: * WMS can understand several formats.
46: * </p>
47: *
48: * @param capabilities Capabilities Document used to determine supported
49: * formats
50: */
51: public WMSFormatFactory(WMSCapabilities capabilities) {
52: this .capabilities = capabilities;
53: }
54:
55: /**
56: * Constructs a WMSFormat for use
57: *
58: * @return DOCUMENT ME!
59: */
60: public Format createFormat() {
61: return new WMSFormat(capabilities);
62: }
63:
64: /**
65: * Ensures Format preconditions are met
66: *
67: * @return DOCUMENT ME!
68: */
69: public boolean isAvailable() {
70: return true;
71: }
72:
73: /**
74: * Returns the implementation hints. The default implementation returns en empty map.
75: */
76: public Map getImplementationHints() {
77: return Collections.EMPTY_MAP;
78: }
79: }
|