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.ows.xml.v1_0;
06:
07: import org.eclipse.xsd.XSDSchema;
08: import org.eclipse.xsd.util.XSDSchemaLocationResolver;
09:
10: public class OWSSchemaLocationResolver implements
11: XSDSchemaLocationResolver {
12: public String resolveSchemaLocation(XSDSchema xsdSchema,
13: String namespaceURI, String schemaLocationURI) {
14: if (schemaLocationURI == null) {
15: return null;
16: }
17:
18: //if no namespace given, assume default for the current schema
19: if (((namespaceURI == null) || "".equals(namespaceURI))
20: && (xsdSchema != null)) {
21: namespaceURI = xsdSchema.getTargetNamespace();
22: }
23:
24: if ("http://www.opengis.net/ows".equals(namespaceURI)
25: && (schemaLocationURI != null)) {
26: if (schemaLocationURI.endsWith("ows19115subset.xsd")) {
27: return getClass().getResource("ows19115subset.xsd")
28: .toString();
29: }
30: }
31:
32: if ("http://www.opengis.net/ows".equals(namespaceURI)
33: && (schemaLocationURI != null)) {
34: if (schemaLocationURI.endsWith("owsAll.xsd")) {
35: return getClass().getResource("owsAll.xsd").toString();
36: }
37: }
38:
39: if ("http://www.opengis.net/ows".equals(namespaceURI)
40: && (schemaLocationURI != null)) {
41: if (schemaLocationURI.endsWith("owsCommon.xsd")) {
42: return getClass().getResource("owsCommon.xsd")
43: .toString();
44: }
45: }
46:
47: if ("http://www.opengis.net/ows".equals(namespaceURI)
48: && (schemaLocationURI != null)) {
49: if (schemaLocationURI.endsWith("owsDataIdentification.xsd")) {
50: return getClass().getResource(
51: "owsDataIdentification.xsd").toString();
52: }
53: }
54:
55: if ("http://www.opengis.net/ows".equals(namespaceURI)
56: && (schemaLocationURI != null)) {
57: if (schemaLocationURI.endsWith("owsExceptionReport.xsd")) {
58: return getClass().getResource("owsExceptionReport.xsd")
59: .toString();
60: }
61: }
62:
63: if ("http://www.opengis.net/ows".equals(namespaceURI)
64: && (schemaLocationURI != null)) {
65: if (schemaLocationURI.endsWith("owsGetCapabilities.xsd")) {
66: return getClass().getResource("owsGetCapabilities.xsd")
67: .toString();
68: }
69: }
70:
71: if ("http://www.opengis.net/ows".equals(namespaceURI)
72: && (schemaLocationURI != null)) {
73: if (schemaLocationURI.endsWith("owsOperationsMetadata.xsd")) {
74: return getClass().getResource(
75: "owsOperationsMetadata.xsd").toString();
76: }
77: }
78:
79: if ("http://www.opengis.net/ows".equals(namespaceURI)
80: && (schemaLocationURI != null)) {
81: if (schemaLocationURI
82: .endsWith("owsServiceIdentification.xsd")) {
83: return getClass().getResource(
84: "owsServiceIdentification.xsd").toString();
85: }
86: }
87:
88: if ("http://www.opengis.net/ows".equals(namespaceURI)
89: && (schemaLocationURI != null)) {
90: if (schemaLocationURI.endsWith("owsServiceProvider.xsd")) {
91: return getClass().getResource("owsServiceProvider.xsd")
92: .toString();
93: }
94: }
95:
96: return null;
97: }
98: }
|