001: /*
002: * GeoTools - OpenSource mapping toolkit
003: * http://geotools.org
004: * (C) 2004-2006, Geotools Project Managment Committee (PMC)
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or (at your option) any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: */
016: package org.geotools.data.wms;
017:
018: import java.io.IOException;
019: import java.io.InputStream;
020: import java.net.URL;
021: import java.util.Properties;
022:
023: import org.geotools.data.ows.GetCapabilitiesRequest;
024: import org.geotools.data.ows.Layer;
025: import org.geotools.data.ows.Response;
026: import org.geotools.data.wms.request.AbstractDescribeLayerRequest;
027: import org.geotools.data.wms.request.AbstractGetLegendGraphicRequest;
028: import org.geotools.data.wms.request.AbstractGetStylesRequest;
029: import org.geotools.data.wms.request.AbstractPutStylesRequest;
030: import org.geotools.data.wms.request.DescribeLayerRequest;
031: import org.geotools.data.wms.request.GetLegendGraphicRequest;
032: import org.geotools.data.wms.request.GetStylesRequest;
033: import org.geotools.data.wms.request.PutStylesRequest;
034: import org.geotools.data.wms.response.DescribeLayerResponse;
035: import org.geotools.data.wms.response.GetLegendGraphicResponse;
036: import org.geotools.data.wms.response.GetStylesResponse;
037: import org.geotools.data.wms.response.PutStylesResponse;
038: import org.geotools.ows.ServiceException;
039:
040: /**
041: * @author Richard Gould
042: *
043: * @source $URL: http://svn.geotools.org/geotools/tags/2.4.1/modules/plugin/wms/src/main/java/org/geotools/data/wms/WMS1_1_0.java $
044: */
045: public class WMS1_1_0 extends WMS1_0_0 {
046:
047: public WMS1_1_0() {
048:
049: }
050:
051: public org.geotools.data.wms.request.GetMapRequest createGetMapRequest(
052: URL get) {
053: return new GetMapRequest(get);
054: }
055:
056: /* (non-Javadoc)
057: * @see org.geotools.data.wms.Specification#getVersion()
058: */
059: public String getVersion() {
060: return "1.1.0";
061: }
062:
063: /**
064: * @see org.geotools.data.wms.Specification#createGetCapabilitiesRequest(java.net.URL)
065: */
066: public GetCapabilitiesRequest createGetCapabilitiesRequest(
067: URL server) {
068: return new GetCapsRequest(server);
069: }
070:
071: /**
072: * @see org.geotools.data.wms.WMS1_0_0#createGetFeatureInfoRequest(java.net.URL, org.geotools.data.wms.request.GetMapRequest, java.util.Set, java.lang.String[])
073: */
074: public org.geotools.data.wms.request.GetFeatureInfoRequest createGetFeatureInfoRequest(
075: URL onlineResource,
076: org.geotools.data.wms.request.GetMapRequest getMapRequest) {
077: return new GetFeatureInfoRequest(onlineResource, getMapRequest);
078: }
079:
080: /**
081: * @see org.geotools.data.wms.WMS1_0_0#createDescribeLayerRequest(java.net.URL)
082: */
083: public DescribeLayerRequest createDescribeLayerRequest(
084: URL onlineResource) throws UnsupportedOperationException {
085: return new InternalDescribeLayerRequest(onlineResource, null);
086: }
087:
088: public GetLegendGraphicRequest createGetLegendGraphicRequest(
089: URL onlineResource) {
090: return new InternalGetLegendGraphicRequest(onlineResource);
091: }
092:
093: public GetStylesRequest createGetStylesRequest(URL onlineResource,
094: Layer[] layers) throws UnsupportedOperationException {
095: return new InternalGetStylesRequest(onlineResource, layers);
096: }
097:
098: /**
099: * @see org.geotools.data.wms.WMS1_0_0#createPutStylesRequest(java.net.URL)
100: */
101: public PutStylesRequest createPutStylesRequest(URL onlineResource)
102: throws UnsupportedOperationException {
103: return new InternalPutStylesRequest(onlineResource);
104: }
105:
106: public static class GetCapsRequest extends WMS1_0_0.GetCapsRequest {
107:
108: public GetCapsRequest(URL urlGetCapabilities) {
109: super (urlGetCapabilities);
110: // TODO Auto-generated constructor stub
111: }
112:
113: /* (non-Javadoc)
114: * @see org.geotools.data.wms.request.AbstractGetCapabilitiesRequest#initRequest()
115: */
116: protected void initRequest() {
117: setProperty("REQUEST", "GetCapabilities");
118: }
119:
120: /* (non-Javadoc)
121: * @see org.geotools.data.wms.request.AbstractGetCapabilitiesRequest#initService()
122: */
123: protected void initService() {
124: setProperty("SERVICE", "WMS");
125: }
126:
127: /* (non-Javadoc)
128: * @see org.geotools.data.wms.request.AbstractGetCapabilitiesRequest#initVersion()
129: */
130: protected void initVersion() {
131: setProperty("VERSION", "1.1.0");
132: }
133:
134: protected String processKey(String key) {
135: return key.trim().toUpperCase();
136: }
137: }
138:
139: public static class GetMapRequest extends WMS1_0_0.GetMapRequest {
140:
141: public GetMapRequest(URL onlineResource) {
142: super (onlineResource);
143: }
144:
145: protected void initRequest() {
146: setProperty(REQUEST, "GetMap");
147: }
148:
149: protected void initVersion() {
150: setProperty(VERSION, "1.1.0");
151: }
152:
153: protected String getRequestFormat(String format) {
154: return format;
155: }
156:
157: protected String getRequestException(String exception) {
158: return exception;
159: }
160:
161: protected String processKey(String key) {
162: return key.trim().toUpperCase();
163: }
164: }
165:
166: public static class GetFeatureInfoRequest extends
167: WMS1_0_0.GetFeatureInfoRequest {
168:
169: /**
170: * @param onlineResource
171: * @param request
172: *
173: */
174: public GetFeatureInfoRequest(URL onlineResource,
175: org.geotools.data.wms.request.GetMapRequest request) {
176: super (onlineResource, request);
177: }
178:
179: protected void initRequest() {
180: setProperty("REQUEST", "GetFeatureInfo");
181: }
182:
183: protected void initVersion() {
184: setProperty("VERSION", "1.1.0");
185: }
186:
187: protected String processKey(String key) {
188: return key.trim().toUpperCase();
189: }
190: }
191:
192: public static class InternalDescribeLayerRequest extends
193: AbstractDescribeLayerRequest {
194:
195: /**
196: * @param onlineResource
197: * @param properties
198: */
199: public InternalDescribeLayerRequest(URL onlineResource,
200: Properties properties) {
201: super (onlineResource, properties);
202: }
203:
204: protected void initVersion() {
205: setProperty(VERSION, "1.1.0");
206: }
207:
208: public Response createResponse(String contentType,
209: InputStream inputStream) throws ServiceException,
210: IOException {
211: return new DescribeLayerResponse(contentType, inputStream);
212: }
213: }
214:
215: public static class InternalGetLegendGraphicRequest extends
216: AbstractGetLegendGraphicRequest {
217:
218: public InternalGetLegendGraphicRequest(URL onlineResource) {
219: super (onlineResource);
220: }
221:
222: protected void initVersion() {
223: setProperty(VERSION, "1.0.0");
224: }
225:
226: public Response createResponse(String contentType,
227: InputStream inputStream) throws ServiceException,
228: IOException {
229: return new GetLegendGraphicResponse(contentType,
230: inputStream);
231: }
232: }
233:
234: public static class InternalGetStylesRequest extends
235: AbstractGetStylesRequest {
236:
237: /**
238: * @param onlineResource
239: * @param layers
240: */
241: public InternalGetStylesRequest(URL onlineResource,
242: Layer[] layers) {
243: super (onlineResource, layers);
244: }
245:
246: /* (non-Javadoc)
247: * @see org.geotools.data.wms.request.AbstractGetStylesRequest#initVersion()
248: */
249: protected void initVersion() {
250: setProperty(VERSION, "1.1.0");
251: }
252:
253: public Response createResponse(String contentType,
254: InputStream inputStream) throws ServiceException,
255: IOException {
256: return new GetStylesResponse(contentType, inputStream);
257: }
258: }
259:
260: public static class InternalPutStylesRequest extends
261: AbstractPutStylesRequest {
262:
263: public InternalPutStylesRequest(URL onlineResource) {
264: super (onlineResource, null);
265: }
266:
267: protected void initVersion() {
268: setProperty(VERSION, "1.1.0");
269: }
270:
271: public Response createResponse(String contentType,
272: InputStream inputStream) throws ServiceException,
273: IOException {
274: return new PutStylesResponse(contentType, inputStream);
275: }
276: }
277:
278: }
|