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.xml.v1_1_0;
06:
07: import org.eclipse.xsd.XSDSchema;
08: import org.geoserver.wfs.xml.v1_1_0.WFSSchemaLocationResolver;
09:
10: /**
11: * Schema location resolver, extending the WFS one
12: */
13: public class WFSVSchemaLocationResolver extends
14: WFSSchemaLocationResolver {
15: /**
16: * <!-- begin-user-doc -->
17: * <!-- end-user-doc -->
18: *
19: * @generated modifiable
20: */
21: public String resolveSchemaLocation(XSDSchema xsdSchema,
22: String namespaceURI, String schemaLocationURI) {
23: String location = super .resolveSchemaLocation(xsdSchema,
24: namespaceURI, schemaLocationURI);
25:
26: if (location != null) {
27: return location;
28: }
29:
30: if (schemaLocationURI == null) {
31: return null;
32: }
33:
34: //if no namespace given, assume default for the current schema
35: if (((namespaceURI == null) || "".equals(namespaceURI))
36: && (xsdSchema != null)) {
37: namespaceURI = xsdSchema.getTargetNamespace();
38: }
39:
40: if ("http://www.opengis.net/wfsv".equals(namespaceURI)) {
41: if (schemaLocationURI.endsWith("wfsv.xsd")) {
42: return getClass().getResource("wfsv.xsd").toString();
43: }
44: }
45:
46: return null;
47: }
48: }
|