001: // $HeadURL: https://svn.wald.intevation.org/svn/deegree/base/trunk/src/org/deegree/ogcwebservices/wfs/capabilities/WFSCapabilitiesDocument.java $
002: /*---------------- FILE HEADER ------------------------------------------
003:
004: This file is part of deegree.
005: Copyright (C) 2001-2008 by:
006: EXSE, Department of Geography, University of Bonn
007: http://www.giub.uni-bonn.de/deegree/
008: lat/lon GmbH
009: http://www.lat-lon.de
010:
011: This library is free software; you can redistribute it and/or
012: modify it under the terms of the GNU Lesser General Public
013: License as published by the Free Software Foundation; either
014: version 2.1 of the License, or (at your option) any later version.
015:
016: This library is distributed in the hope that it will be useful,
017: but WITHOUT ANY WARRANTY; without even the implied warranty of
018: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
019: Lesser General Public License for more details.
020:
021: You should have received a copy of the GNU Lesser General Public
022: License along with this library; if not, write to the Free Software
023: Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
024:
025: Contact:
026:
027: Andreas Poth
028: lat/lon GmbH
029: Aennchenstr. 19
030: 53115 Bonn
031: Germany
032: E-Mail: poth@lat-lon.de
033:
034: Prof. Dr. Klaus Greve
035: Department of Geography
036: University of Bonn
037: Meckenheimer Allee 166
038: 53115 Bonn
039: Germany
040: E-Mail: greve@giub.uni-bonn.de
041:
042: ---------------------------------------------------------------------------*/
043: package org.deegree.ogcwebservices.wfs.capabilities;
044:
045: import java.io.IOException;
046: import java.net.MalformedURLException;
047: import java.net.URI;
048: import java.net.URISyntaxException;
049: import java.net.URL;
050: import java.security.InvalidParameterException;
051: import java.util.ArrayList;
052: import java.util.HashMap;
053: import java.util.List;
054: import java.util.Map;
055:
056: import org.deegree.datatypes.Code;
057: import org.deegree.datatypes.QualifiedName;
058: import org.deegree.framework.log.ILogger;
059: import org.deegree.framework.log.LoggerFactory;
060: import org.deegree.framework.util.StringTools;
061: import org.deegree.framework.xml.XMLParsingException;
062: import org.deegree.framework.xml.XMLTools;
063: import org.deegree.model.filterencoding.capabilities.FilterCapabilities;
064: import org.deegree.model.filterencoding.capabilities.FilterCapabilities110Fragment;
065: import org.deegree.model.metadata.iso19115.Keywords;
066: import org.deegree.model.spatialschema.Envelope;
067: import org.deegree.ogcbase.CommonNamespaces;
068: import org.deegree.ogcwebservices.getcapabilities.InvalidCapabilitiesException;
069: import org.deegree.ogcwebservices.getcapabilities.MetadataURL;
070: import org.deegree.ogcwebservices.getcapabilities.OGCCapabilities;
071: import org.deegree.ogcwebservices.getcapabilities.Operation;
072: import org.deegree.ogcwebservices.getcapabilities.OperationsMetadata;
073: import org.deegree.ogcwebservices.getcapabilities.ServiceIdentification;
074: import org.deegree.owscommon.OWSCommonCapabilitiesDocument;
075: import org.deegree.owscommon.OWSDomainType;
076: import org.w3c.dom.Document;
077: import org.w3c.dom.Element;
078: import org.w3c.dom.Node;
079: import org.xml.sax.SAXException;
080:
081: /**
082: * Represents a capabilities document for an OGC WFS 1.1.0 compliant web service.
083: *
084: * @author <a href="mailto:mschneider@lat-lon.de">Markus Schneider </a>
085: * @author last edited by: $Author: apoth $
086: *
087: * @version $Revision: 9345 $, $Date: 2007-12-27 08:22:25 -0800 (Thu, 27 Dec 2007) $
088: */
089: public class WFSCapabilitiesDocument extends
090: OWSCommonCapabilitiesDocument {
091:
092: private static final long serialVersionUID = 6664839532969382269L;
093: private static ILogger LOG = LoggerFactory
094: .getLogger(WFSCapabilitiesDocument.class);
095:
096: /**
097: * The "FeatureTypeList" string.
098: */
099: public final static String FEATURE_TYPE_LIST_NAME = "FeatureTypeList";
100:
101: /**
102: * The "ServesGMLObjectTypeList" string.
103: */
104: public final static String SERVES_GML_OBJECT_TYPE_LIST_NAME = "ServesGMLObjectTypeList";
105:
106: /**
107: * The "SupportsGMLObjectTypeList" string.
108: */
109: public final static String SUPPORTS_GML_OBJECT_TYPE_LIST_NAME = "SupportsGMLObjectTypeList";
110:
111: /**
112: * The "FilterCapabilities" string.
113: */
114: public final static String FILTER_CAPABILITIES_NAME = "FilterCapabilities";
115:
116: protected static final URI WFSNS = CommonNamespaces.WFSNS;
117: private static final String PRE_WFS = CommonNamespaces.WFS_PREFIX
118: + ":";
119:
120: private static final String PRE_OWS = CommonNamespaces.OWS_PREFIX
121: + ":";
122:
123: protected static final URI OGCNS = CommonNamespaces.OGCNS;
124:
125: protected static final URI DEEGREEWFSNS = CommonNamespaces.DEEGREEWFS;
126:
127: private static final String XML_TEMPLATE = "WFSCapabilitiesTemplate.xml";
128:
129: private static final String[] VALID_TYPES = { "TDC211", "FGDC",
130: "19115", "19139" };
131:
132: private static final String[] VALID_FORMATS = { "text/xml",
133: "text/html", "text/sgml", "text/plain" };
134:
135: /**
136: * Creates a skeleton capabilities document that contains the mandatory elements only.
137: *
138: * @throws IOException
139: * @throws SAXException
140: */
141: public void createEmptyDocument() throws IOException, SAXException {
142: URL url = WFSCapabilitiesDocument.class
143: .getResource(XML_TEMPLATE);
144: if (url == null) {
145: throw new IOException("The resource '" + XML_TEMPLATE
146: + " could not be found.");
147: }
148: load(url);
149: }
150:
151: /**
152: * Creates an emptyDocument with given version, and an updateSequence of "0" without reading the skeleton document.
153: * @param version if
154: *
155: */
156: public void createEmptyDocument(String version) {
157: // set up the root document.
158: Document doc = XMLTools.create();
159: Element root = doc.createElementNS(
160: "http://www.opengis.net/wfs", PRE_WFS
161: + "WFS_Capabilities");
162: doc.importNode(root, false);
163:
164: setRootElement(root);
165: root.setAttribute("version", version);
166: root.setAttribute("updateSequence", "0");
167: }
168:
169: /**
170: * Creates a class representation of the document.
171: *
172: * @return class representation of the configuration document
173: */
174: @Override
175: public OGCCapabilities parseCapabilities()
176: throws InvalidCapabilitiesException {
177:
178: WFSCapabilities wfsCapabilities = null;
179: try {
180:
181: wfsCapabilities = new WFSCapabilities(parseVersion(),
182: parseUpdateSequence(), getServiceIdentification(),
183: getServiceProvider(), getOperationsMetadata(),
184: getFeatureTypeList(), getServesGMLObjectTypeList(),
185: getSupportsGMLObjectTypeList(), null,
186: getFilterCapabilities());
187: } catch (XMLParsingException e) {
188: throw new InvalidCapabilitiesException(e.getMessage()
189: + "\n" + StringTools.stackTraceToString(e));
190: }
191:
192: return wfsCapabilities;
193: }
194:
195: /**
196: * Returns the class representation for the <code>ServiceIdentification</code> section of the
197: * document. <p> NOTE: this method is overridden, because the WFS 1.1.0 requires the OWS 1.0.0
198: * version of the element
199: *
200: * @return class representation for the <code>ServiceIdentification</code> section
201: * @throws XMLParsingException
202: */
203: @Override
204: public ServiceIdentification getServiceIdentification()
205: throws XMLParsingException {
206:
207: // Element element = XMLTools.getRequiredChildElement( "ServiceIdentification", OWSNS,
208: // getRootElement() );
209: Element element = XMLTools.getRequiredElement(getRootElement(),
210: PRE_OWS + "ServiceIdentification", nsContext);
211:
212: // 'ServiceType' element (mandatory)
213: // Element serviceTypeElement = XMLTools.getRequiredChildElement( "ServiceType", OWSNS,
214: // element );
215: Element serviceTypeElement = XMLTools.getRequiredElement(
216: element, PRE_OWS + "ServiceType", nsContext);
217: Code serviceType = null;
218: try {
219: String codeSpace = XMLTools.getAttrValue(
220: serviceTypeElement, OWSNS, "codeSpace", null);
221: URI uri = codeSpace != null ? new URI(codeSpace) : null;
222: serviceType = new Code(XMLTools
223: .getStringValue(serviceTypeElement), uri);
224: } catch (URISyntaxException e) {
225: throw new XMLParsingException(
226: "Given value '"
227: + XMLTools.getAttrValue(serviceTypeElement,
228: OWSNS, "codeSpace", null)
229: + "' in attribute 'codeSpace' of element 'ServiceType' "
230: + "(namespace: '" + OWSNS
231: + "') is not a valid URI.");
232: }
233:
234: // 'ServiceTypeVersion' elements (mandatory)
235: String[] serviceTypeVersions = XMLTools
236: .getRequiredNodeAsStrings(element,
237: "ows:ServiceTypeVersion", nsContext, ",;");
238: if (serviceTypeVersions.length == 0) {
239: String msg = "No version specified in 'ows:ServiceTypeVersion' element.";
240: throw new XMLParsingException(msg);
241: }
242:
243: // 'Fees' element (optional)
244: String fees = XMLTools.getStringValue("Fees", OWSNS, element,
245: null);
246:
247: // 'AccessConstraints' elements (optional)
248: String accessConstraints[] = XMLTools.getNodesAsStrings(
249: element, "ows:AccessConstraints", nsContext);
250:
251: String title = XMLTools.getNodeAsString(element, "ows:Title",
252: nsContext, null);
253: String abs = XMLTools.getNodeAsString(element, "ows:Abstract",
254: nsContext, null);
255:
256: Keywords[] kws = getKeywords(XMLTools.getElements(element,
257: "ows:Keywords", nsContext));
258:
259: ServiceIdentification serviceIdentification = new ServiceIdentification(
260: serviceType, serviceTypeVersions, title, abs, kws,
261: fees, accessConstraints);
262: return serviceIdentification;
263: }
264:
265: /**
266: * Creates an object representation of the <code>ows:OperationsMetadata</code> section.
267: *
268: * @return object representation of the <code>ows:OperationsMetadata</code> section
269: * @throws XMLParsingException
270: */
271: public OperationsMetadata getOperationsMetadata()
272: throws XMLParsingException {
273:
274: List<Node> operationElementList = XMLTools.getNodes(
275: getRootElement(),
276: "ows:OperationsMetadata/ows:Operation", nsContext);
277:
278: // build HashMap of 'ows:Operation'-elements for easier access
279: Map<String, Node> operations = new HashMap<String, Node>();
280: for (int i = 0; i < operationElementList.size(); i++) {
281: operations.put(XMLTools.getRequiredNodeAsString(
282: operationElementList.get(i), "@name", nsContext),
283: operationElementList.get(i));
284: }
285:
286: Operation getCapabilities = getOperation(
287: OperationsMetadata.GET_CAPABILITIES_NAME, true,
288: operations);
289: Operation describeFeatureType = getOperation(
290: WFSOperationsMetadata.DESCRIBE_FEATURETYPE_NAME, true,
291: operations);
292: Operation getFeature = getOperation(
293: WFSOperationsMetadata.GET_FEATURE_NAME, false,
294: operations);
295: Operation getFeatureWithLock = getOperation(
296: WFSOperationsMetadata.GET_FEATURE_WITH_LOCK_NAME,
297: false, operations);
298: Operation getGMLObject = getOperation(
299: WFSOperationsMetadata.GET_GML_OBJECT_NAME, false,
300: operations);
301: Operation lockFeature = getOperation(
302: WFSOperationsMetadata.LOCK_FEATURE_NAME, false,
303: operations);
304: Operation transaction = getOperation(
305: WFSOperationsMetadata.TRANSACTION_NAME, false,
306: operations);
307:
308: List parameterElementList = XMLTools.getNodes(getRootElement(),
309: "ows:OperationsMetadata/ows:Parameter", nsContext);
310: OWSDomainType[] parameters = new OWSDomainType[parameterElementList
311: .size()];
312: for (int i = 0; i < parameters.length; i++) {
313: parameters[i] = getOWSDomainType(null,
314: (Element) parameterElementList.get(i));
315: }
316:
317: List constraintElementList = XMLTools.getNodes(
318: getRootElement(),
319: "ows:OperationsMetadata/ows:Constraint", nsContext);
320: OWSDomainType[] constraints = new OWSDomainType[constraintElementList
321: .size()];
322: for (int i = 0; i < constraints.length; i++) {
323: constraints[i] = getOWSDomainType(null,
324: (Element) constraintElementList.get(i));
325: }
326: WFSOperationsMetadata metadata = new WFSOperationsMetadata(
327: getCapabilities, describeFeatureType, getFeature,
328: getFeatureWithLock, getGMLObject, lockFeature,
329: transaction, parameters, constraints);
330:
331: return metadata;
332: }
333:
334: /**
335: * Returns the object representation for the <code>wfs:FeatureTypeList</code>- section.
336: *
337: * @return object representation of the <code>wfs:FeatureTypeList</code> section, may be empty
338: * (if missing)
339: * @throws XMLParsingException
340: */
341: public FeatureTypeList getFeatureTypeList()
342: throws XMLParsingException {
343:
344: List<WFSFeatureType> wfsFeatureTypes = new ArrayList<WFSFeatureType>();
345:
346: FeatureTypeList featureTypeList = new FeatureTypeList(
347: new org.deegree.ogcwebservices.wfs.capabilities.Operation[0],
348: wfsFeatureTypes);
349:
350: Element element = (Element) XMLTools.getNode(getRootElement(),
351: "wfs:FeatureTypeList", nsContext);
352: if (element != null) {
353: org.deegree.ogcwebservices.wfs.capabilities.Operation[] globalOperations = null;
354: Element operationsTypeElement = (Element) XMLTools.getNode(
355: element, "wfs:Operations", nsContext);
356: if (operationsTypeElement != null) {
357: globalOperations = getOperationsType(operationsTypeElement);
358: }
359: List featureTypeElementList = XMLTools.getNodes(element,
360: "wfs:FeatureType", nsContext);
361: // TODO Check this.
362: // if ( featureTypeElementList.getLength() < 1 ) {
363: // throw new XMLParsingException(
364: // "A wfs:FeatureTypeListType must contain at least one wfs:FeatureType-element." );
365: // }
366: for (int i = 0; i < featureTypeElementList.size(); i++) {
367: WFSFeatureType wfsFT = getFeatureTypeType((Element) featureTypeElementList
368: .get(i));
369: wfsFeatureTypes.add(wfsFT);
370: }
371:
372: featureTypeList = new FeatureTypeList(globalOperations,
373: wfsFeatureTypes);
374: }
375:
376: return featureTypeList;
377: }
378:
379: /**
380: * Returns the object representation for the <code>wfs:ServesGMLObjectTypeList</code>-
381: * section.
382: *
383: * @return object representation of the <code>wfs:ServesGMLObjectTypeList</code> section, null
384: * if the section does not exist
385: * @throws XMLParsingException
386: */
387: public GMLObject[] getServesGMLObjectTypeList()
388: throws XMLParsingException {
389:
390: GMLObject[] gmlObjectTypes = null;
391: Element element = (Element) XMLTools.getNode(getRootElement(),
392: "wfs:ServesGMLObjectTypeList", nsContext);
393: if (element != null) {
394: List nodeList = XMLTools.getRequiredNodes(element,
395: "wfs:GMLObjectType", nsContext);
396: gmlObjectTypes = new GMLObject[nodeList.size()];
397: for (int i = 0; i < gmlObjectTypes.length; i++) {
398: gmlObjectTypes[i] = getGMLObjectType((Element) nodeList
399: .get(i));
400: }
401: }
402:
403: return gmlObjectTypes;
404: }
405:
406: /**
407: * Returns the object representation for the <code>wfs:SupportsGMLObjectTypeList</code>-
408: * section.
409: *
410: * @return object representation of the <code>wfs:SupportsGMLObjectTypeList</code> section,
411: * null if the section does not exist
412: * @throws XMLParsingException
413: */
414: public GMLObject[] getSupportsGMLObjectTypeList()
415: throws XMLParsingException {
416:
417: GMLObject[] gmlObjectTypes = null;
418: Element element = (Element) XMLTools.getNode(getRootElement(),
419: "wfs:SupportsGMLObjectTypeList", nsContext);
420: if (element != null) {
421: List nodeList = XMLTools.getRequiredNodes(element,
422: "wfs:GMLObjectType", nsContext);
423: gmlObjectTypes = new GMLObject[nodeList.size()];
424: for (int i = 0; i < gmlObjectTypes.length; i++) {
425: gmlObjectTypes[i] = getGMLObjectType((Element) nodeList
426: .get(i));
427: }
428: }
429:
430: return gmlObjectTypes;
431: }
432:
433: /**
434: * Returns the object representation for an element of type <code>wfs:GMLObjectType</code>.
435: *
436: * @param element
437: * @return object representation of the element of type <code>wfs:GMLObjectType</code>
438: * @throws XMLParsingException
439: */
440: public GMLObject getGMLObjectType(Element element)
441: throws XMLParsingException {
442: QualifiedName name = parseQualifiedName(XMLTools
443: .getRequiredNode(element, "wfs:Name/text()", nsContext));
444: String title = XMLTools.getNodeAsString(element,
445: "wfs:Title/text()", nsContext, null);
446: String abstract_ = XMLTools.getNodeAsString(element,
447: "wfs:Abstract/text()", nsContext, null);
448: Keywords[] keywords = getKeywords(XMLTools.getNodes(element,
449: "ows:Keywords", nsContext));
450: List formatElementList = XMLTools.getNodes(element,
451: "wfs:OutputFormats/wfs:Format", nsContext);
452: FormatType[] outputFormats = new FormatType[formatElementList
453: .size()];
454: for (int i = 0; i < outputFormats.length; i++) {
455: outputFormats[i] = getFormatType((Element) formatElementList
456: .get(i));
457: }
458: return new GMLObject(name, title, abstract_, keywords,
459: outputFormats);
460: }
461:
462: /**
463: * Returns the object representation for an element of type <code>wfs:FeatureTypeType</code>.
464: *
465: * @param element
466: * @return object representation for the element of type <code>wfs:OperationsType</code>
467: * @throws XMLParsingException
468: */
469: public WFSFeatureType getFeatureTypeType(Element element)
470: throws XMLParsingException {
471:
472: QualifiedName name = parseQualifiedName(XMLTools
473: .getRequiredNode(element, "wfs:Name/text()", nsContext));
474: String title = XMLTools.getRequiredNodeAsString(element,
475: "wfs:Title/text()", nsContext);
476: String abstract_ = XMLTools.getNodeAsString(element,
477: "wfs:Abstract/text()", nsContext, null);
478: Keywords[] keywords = getKeywords(XMLTools.getNodes(element,
479: "ows:Keywords", nsContext));
480:
481: URI defaultSrs = null;
482: URI[] otherSrs = null;
483: Node noSrsElement = XMLTools.getNode(element, "wfs:NoSRS",
484: nsContext);
485: if (noSrsElement == null) {
486: defaultSrs = XMLTools.getNodeAsURI(element,
487: "wfs:DefaultSRS/text()", nsContext, null);
488: if (defaultSrs == null) {
489: String msg = "A 'wfs:FeatureType' element must always contain a 'wfs:NoSRS' "
490: + "element or a 'wfs:DefaultSRS' element";
491: throw new XMLParsingException(msg);
492: }
493: otherSrs = XMLTools.getNodesAsURIs(element,
494: "wfs:OtherSRS/text()", nsContext);
495: }
496:
497: org.deegree.ogcwebservices.wfs.capabilities.Operation[] operations = null;
498: Element operationsTypeElement = (Element) XMLTools.getNode(
499: element, "wfs:Operations", nsContext);
500: if (operationsTypeElement != null) {
501: operations = getOperationsType(operationsTypeElement);
502: }
503: List formatElementList = XMLTools.getNodes(element,
504: "wfs:OutputFormats/wfs:Format", nsContext);
505: FormatType[] formats = new FormatType[formatElementList.size()];
506: for (int i = 0; i < formats.length; i++) {
507: formats[i] = getFormatType((Element) formatElementList
508: .get(i));
509: }
510: List wgs84BoundingBoxElements = XMLTools.getNodes(element,
511: "ows:WGS84BoundingBox", nsContext);
512: if (wgs84BoundingBoxElements.size() < 1) {
513: throw new XMLParsingException(
514: "A 'wfs:FeatureTypeType' must contain at least one "
515: + "'ows:WGS84BoundingBox'-element.");
516: }
517: Envelope[] wgs84BoundingBoxes = new Envelope[wgs84BoundingBoxElements
518: .size()];
519: for (int i = 0; i < wgs84BoundingBoxes.length; i++) {
520: wgs84BoundingBoxes[i] = getWGS84BoundingBoxType((Element) wgs84BoundingBoxElements
521: .get(i));
522: }
523: List metadataURLElementList = XMLTools.getNodes(element,
524: "wfs:MetadataURL", nsContext);
525: MetadataURL[] metadataUrls = new MetadataURL[metadataURLElementList
526: .size()];
527: for (int i = 0; i < metadataUrls.length; i++) {
528: metadataUrls[i] = getMetadataURL((Element) metadataURLElementList
529: .get(i));
530: }
531: WFSFeatureType featureType = new WFSFeatureType(name, title,
532: abstract_, keywords, defaultSrs, otherSrs, operations,
533: formats, wgs84BoundingBoxes, metadataUrls);
534:
535: return featureType;
536: }
537:
538: /**
539: * Returns the object representation for an <code>wfs:OutputFormat</code> -element.
540: *
541: * @param element
542: * @return object representation for the element
543: * @throws XMLParsingException
544: */
545: public FormatType getFormatType(Element element)
546: throws XMLParsingException {
547:
548: String[] tmp = new String[3];
549: URI[] uris = new URI[3];
550: tmp[0] = XMLTools.getNodeAsString(element,
551: "@deegreewfs:inFilter", nsContext, null);
552: tmp[1] = XMLTools.getNodeAsString(element,
553: "@deegreewfs:outFilter", nsContext, null);
554: tmp[2] = XMLTools.getNodeAsString(element,
555: "@deegreewfs:schemaLocation", nsContext, null);
556: for (int i = 0; i < tmp.length; i++) {
557: try {
558: if (tmp[i] != null && !"".equals(tmp[i].trim())) {
559: if (!(tmp[i].toLowerCase().startsWith("file:/"))) {
560: tmp[i] = this .resolve(tmp[i]).toExternalForm();
561: LOG.logDebug("Found format "
562: + ((i == 0) ? "inFilter"
563: : ((i == 1) ? "outFilter"
564: : "schemaLocation"))
565: + " at location: " + tmp[i]);
566: }
567: uris[i] = new URI(tmp[i]);
568: }
569: } catch (MalformedURLException e) {
570: throw new XMLParsingException(
571: "Could not resolve relative path:" + tmp[i]);
572: } catch (URISyntaxException e) {
573: throw new XMLParsingException("Not a valid URI:"
574: + tmp[i]);
575: }
576: }
577:
578: String value = XMLTools.getRequiredNodeAsString(element,
579: "text()", nsContext);
580:
581: return new FormatType(uris[0], uris[1], uris[2], value);
582: }
583:
584: /**
585: * Returns the object representation for an element node of type
586: * <code>wfs:MetadataURLType</code>.
587: *
588: * TODO: Schema says base type is String, not URL!
589: *
590: * @param element
591: * @return object representation for the element of type <code>wfs:MetadataURLType</code>
592: * @throws XMLParsingException
593: */
594: public MetadataURL getMetadataURL(Element element)
595: throws XMLParsingException {
596:
597: String type = XMLTools.getRequiredNodeAsString(element,
598: "@type", nsContext, VALID_TYPES);
599: String format = XMLTools.getRequiredNodeAsString(element,
600: "@format", nsContext, VALID_FORMATS);
601: String url = XMLTools.getRequiredNodeAsString(element,
602: "text()", nsContext);
603: URL onlineResource;
604: try {
605: onlineResource = new URL(url);
606: } catch (MalformedURLException e) {
607: throw new XMLParsingException(
608: "A wfs:MetadataURLType must contain a valid URL: "
609: + e.getMessage());
610: }
611:
612: return new MetadataURL(type, format, onlineResource);
613: }
614:
615: /**
616: * Returns the object representation for an element node of type <code>wfs:OperationsType</code>.
617: *
618: * @param element
619: * @return object representation for the element of type <code>wfs:OperationsType</code>
620: * @throws XMLParsingException
621: */
622: public org.deegree.ogcwebservices.wfs.capabilities.Operation[] getOperationsType(
623: Element element) throws XMLParsingException {
624:
625: String[] operationCodes = XMLTools.getNodesAsStrings(element,
626: "wfs:Operation/text()", nsContext);
627: org.deegree.ogcwebservices.wfs.capabilities.Operation[] operations = new org.deegree.ogcwebservices.wfs.capabilities.Operation[operationCodes.length];
628: for (int i = 0; i < operations.length; i++) {
629: try {
630: operations[i] = new org.deegree.ogcwebservices.wfs.capabilities.Operation(
631: operationCodes[i]);
632: } catch (InvalidParameterException e) {
633: throw new XMLParsingException(e.getMessage());
634: }
635: }
636:
637: return operations;
638: }
639:
640: /**
641: * Returns the object representation for the <code>Filter_Capabilities</code> section of the
642: * document.
643: *
644: * @return class representation for the <code>Filter_Capabilities</code> section
645: * @throws XMLParsingException
646: */
647: public FilterCapabilities getFilterCapabilities()
648: throws XMLParsingException {
649:
650: FilterCapabilities filterCapabilities = null;
651: Element filterCapabilitiesElement = (Element) XMLTools.getNode(
652: getRootElement(), "ogc:Filter_Capabilities", nsContext);
653: if (filterCapabilitiesElement != null) {
654: filterCapabilities = new FilterCapabilities110Fragment(
655: filterCapabilitiesElement, getSystemId())
656: .parseFilterCapabilities();
657: }
658: return filterCapabilities;
659: }
660: }
|