01: /* Copyright (c) 2001 - 2007 TOPP - www.openplans.org. All rights reserved.
02: * This code is licensed under the GPL 2.0 license, availible at the root
03: * application directory.
04: */
05: package org.geoserver.wfsv.response.v1_0_0;
06:
07: import net.opengis.wfs.GetFeatureType;
08: import net.opengis.wfs.ResultTypeType;
09:
10: import org.geoserver.ows.util.OwsUtils;
11: import org.geoserver.ows.util.RequestUtils;
12: import org.geoserver.ows.util.ResponseUtils;
13: import org.geoserver.platform.Operation;
14: import org.geoserver.wfs.WFS;
15: import org.geoserver.wfs.xml.GML2OutputFormat;
16: import org.vfny.geoserver.global.Data;
17: import org.vfny.geoserver.global.FeatureTypeInfo;
18: import org.vfny.geoserver.global.GeoServer;
19:
20: /**
21: * Encodes features in Geographic Markup Language (GML) version 2 adding the
22: * versioning attributes to the mix.
23: *
24: * <p>
25: * GML2-GZIP format is just GML2 with gzip compression. If GML2-GZIP format was
26: * requested, <code>getContentEncoding()</code> will retutn
27: * <code>"gzip"</code>, otherwise will return <code>null</code>
28: * </p>
29: *
30: * @author Gabriel Rold?n
31: * @author Andrea Aime
32: * @version $Id: VersionedGML2OutputFormat.java 7990 2007-12-12 21:01:01Z aaime $
33: */
34: public class VersionedGML2OutputFormat extends GML2OutputFormat {
35: /**
36: * Creates the producer with a reference to the GetFeature operation
37: * using it.
38: */
39: public VersionedGML2OutputFormat(WFS wfs, GeoServer geoServer,
40: Data catalog) {
41: super (wfs, geoServer, catalog);
42: }
43:
44: protected String wfsSchemaLocation(WFS wfs, String baseUrl) {
45: return ResponseUtils.appendPath(RequestUtils.proxifiedBaseURL(
46: baseUrl, wfs.getGeoServer().getProxyBaseUrl()),
47: "schemas/wfs/1.0.0/WFS-versioning.xsd");
48: }
49:
50: protected String typeSchemaLocation(WFS wfs, FeatureTypeInfo meta,
51: String baseUrl) {
52: final String proxifiedBase = RequestUtils.proxifiedBaseURL(
53: baseUrl, wfs.getGeoServer().getProxyBaseUrl());
54: return ResponseUtils.appendQueryString(proxifiedBase + "wfs",
55: "service=WFSV&version=1.0.0&request=DescribeVersionedFeatureType&typeName="
56: + meta.getName());
57: }
58:
59: public boolean canHandle(Operation operation) {
60: // GetVersionedFeature operation?
61: if ("GetVersionedFeature".equalsIgnoreCase(operation.getId())) {
62: // also check that the resultType is "results"
63: GetFeatureType request = (GetFeatureType) OwsUtils
64: .parameter(operation.getParameters(),
65: GetFeatureType.class);
66:
67: if (request.getResultType() == ResultTypeType.RESULTS_LITERAL) {
68: return true;
69: }
70: }
71:
72: return false;
73: }
74:
75: }
|