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.xml;
017:
018: import java.net.URI;
019: import java.net.URISyntaxException;
020: import java.util.Collections;
021: import java.util.Map;
022:
023: import org.geotools.xml.gml.GMLSchema;
024: import org.geotools.xml.schema.Attribute;
025: import org.geotools.xml.schema.AttributeGroup;
026: import org.geotools.xml.schema.ComplexType;
027: import org.geotools.xml.schema.Element;
028: import org.geotools.xml.schema.Group;
029: import org.geotools.xml.schema.Schema;
030: import org.geotools.xml.schema.SimpleType;
031:
032: public class OGCSchema implements Schema {
033:
034: private static OGCSchema instance = new OGCSchema();
035:
036: protected OGCSchema() {
037: //do nothing
038: }
039:
040: public static OGCSchema getInstance() {
041: return instance;
042: }
043:
044: public static final URI NAMESPACE = loadNS();
045:
046: private static URI loadNS() {
047: try {
048: return new URI("http://www.opengis.net/ows");
049: } catch (URISyntaxException e) {
050: return null;
051: }
052: }
053:
054: public int getBlockDefault() {
055: return 0;
056: }
057:
058: public int getFinalDefault() {
059: return 0;
060: }
061:
062: public String getId() {
063: return "null";
064: }
065:
066: private static Schema[] imports = null;
067:
068: public Schema[] getImports() {
069: if (imports == null) {
070: imports = new Schema[] { GMLSchema.getInstance() };
071: }
072: return imports;
073: }
074:
075: public String getPrefix() {
076: return "ogc";
077: }
078:
079: public URI getTargetNamespace() {
080: return NAMESPACE;
081: }
082:
083: public URI getURI() {
084: return NAMESPACE;
085: }
086:
087: public String getVersion() {
088: return "null";
089: }
090:
091: public boolean includesURI(URI uri) {
092: // // TODO fill me in!
093: return false; // // safer
094: }
095:
096: public boolean isAttributeFormDefault() {
097: return false;
098: }
099:
100: public boolean isElementFormDefault() {
101: return false;
102: }
103:
104: public AttributeGroup[] getAttributeGroups() {
105: return null;
106: }
107:
108: public Attribute[] getAttributes() {
109: return null;
110: }
111:
112: /**
113: * TODO comment here
114: */
115: private static ComplexType[] complexTypes = null;
116:
117: public ComplexType[] getComplexTypes() {
118: if (complexTypes == null) {
119: complexTypes = new ComplexType[] { ogcComplexTypes.VendorType
120: .getInstance() };
121: }
122: return complexTypes;
123: }
124:
125: /**
126: * TODO comment here
127: */
128: private static Element[] elements = null;
129: public static final int GET_CAPABILITIES = 0;
130: public static final int GET_MAP = 1;
131: public static final int GET_FEATURE_INFO = 2;
132:
133: public Element[] getElements() {
134: if (elements == null) {
135: elements = new Element[3];
136: elements[GET_CAPABILITIES] = new ogcElement(
137: "GetCapabilities", ogcComplexTypes._GetCapabilities
138: .getInstance(), null, 1, 1);
139: elements[GET_MAP] = new ogcElement("GetMap",
140: ogcComplexTypes._GetMap.getInstance(), null, 1, 1);
141: elements[GET_FEATURE_INFO] = new ogcElement(
142: "ogc:GetFeatureInfo",
143: ogcComplexTypes._GetFeatureInfo.getInstance(),
144: null, 1, 1);
145: }
146: return elements;
147: }
148:
149: public Group[] getGroups() {
150: return null;
151: }
152:
153: /**
154: * TODO comment here
155: */
156: private static SimpleType[] simpleTypes = null;
157:
158: public SimpleType[] getSimpleTypes() {
159: if (simpleTypes == null) {
160: simpleTypes = new SimpleType[] {
161: ogcSimpleTypes.CapabilitiesSectionType
162: .getInstance(),
163: ogcSimpleTypes.FormatType.getInstance(),
164: ogcSimpleTypes.OWSType.getInstance(),
165: ogcSimpleTypes.ExceptionsType.getInstance() };
166: }
167: return simpleTypes;
168: }
169:
170: /**
171: * Returns the implementation hints. The default implementation returns en empty map.
172: */
173: public Map getImplementationHints() {
174: return Collections.EMPTY_MAP;
175: }
176: }
|