Class ServiceMetadataUtils

java.lang.Object
org.opengeospatial.cite.wmts10.ets.core.util.ServiceMetadataUtils

public final class ServiceMetadataUtils extends Object
Provides various utility methods for accessing service metadata.
Author:
Lyn Goltz (original), Jim Beatty (modified/fixed May/Jun/Jul-2017 for WMS and/or WMTS)
  • Method Details

    • getOperationEndpoint_KVP

      public static URI getOperationEndpoint_KVP(Document wmtsMetadata, String opName, ProtocolBinding binding)
      Extracts a request KVP endpoint from a WMTS capabilities document. If the request URI contains a query component it is removed (but not from the source document).
      Parameters:
      wmtsMetadata - the document node containing service metadata (OGC capabilities document).
      opName - the operation (request) name
      binding - the message binding to use (if null any supported binding will be used)
      Returns:
      the URI referring to a request endpoint, null if no matching endpoint is found
    • getOperationEndpoint_REST

      public static URI getOperationEndpoint_REST(Document wmtsMetadata, String opName, ProtocolBinding binding)
      Extracts a request REST endpoint from a WMTS capabilities document. If the request URI contains a query component it is removed (but not from the source document).
      Parameters:
      wmtsMetadata - the document node containing service metadata (OGC capabilities document).
      opName - the operation (request) name
      binding - the message binding to use (if null any supported binding will be used)
      Returns:
      the URI referring to a request endpoint, null if no matching endpoint is found
    • getOperationEndpoint_SOAP

      public static URI getOperationEndpoint_SOAP(Document wmtsMetadata, String opName, ProtocolBinding binding)
      Extracts a request SOAP endpoint from a WMTS capabilities document. If the request URI contains a query component it is removed (but not from the source document).
      Parameters:
      wmtsMetadata - the document node containing service metadata (OGC capabilities document).
      opName - the operation (request) name
      binding - the message binding to use (if null any supported binding will be used)
      Returns:
      the URI referring to a request endpoint, null if no matching endpoint is found
    • getOperationBindings

      public static Set<ProtocolBinding> getOperationBindings(Document wmtsMetadata, String opName)
      Determines which protocol bindings are supported for a given operation.
      Parameters:
      wmtsMetadata - the capabilities document (wmts:Capabilities), never null
      opName - the name of the WMTS operation
      Returns:
      A Set of protocol bindings supported for the operation. May be empty but never null.
    • getNodeElements

      public static NodeList getNodeElements(XPath xPath, Node wmtsCapabilities, String xPathAbstract) throws XPathExpressionException
      Throws:
      XPathExpressionException
    • getNodeElements

      public static NodeList getNodeElements(Node wmtsCapabilities, String xPathAbstract) throws XPathExpressionException
      Throws:
      XPathExpressionException
    • getNode

      public static Node getNode(XPath xPath, Node wmtsCapabilities, String xPathAbstract) throws XPathExpressionException
      Throws:
      XPathExpressionException
    • getNode

      public static Node getNode(Node wmtsCapabilities, String xPathAbstract) throws XPathExpressionException
      Throws:
      XPathExpressionException
    • getNodeText

      public static String getNodeText(XPath xPath, Node wmtsCapabilities, String xPathAbstract) throws XPathExpressionException
      Throws:
      XPathExpressionException
    • getNodeText

      public static String getNodeText(Node wmtsCapabilities, String xPathAbstract) throws XPathExpressionException
      Throws:
      XPathExpressionException
    • parseLayerChildElements

      public static NodeList parseLayerChildElements(Document wmtsCapabilities, String layerName, String childElement)
      Parses the configured formats for the given operation.
      Parameters:
      wmtsCapabilities - the capabilities document (wmts:Capabilities), never null
      layerName - the name of the selected layer
      childElement - the child element(s) of the layer
      Returns:
      a list of the child elements by the operation, never null
    • parseLayerInfo

      public static List<LayerInfo> parseLayerInfo(Document wmtsCapabilities)
      Parses all named layers from the capabilities document.
      Parameters:
      wmtsCapabilities - the capabilities document (wmts:Capabilities), never null
      Returns:
      a list of LayerInfos supported by the WMTS, never null
    • parseLayers

      public static NodeList parseLayers(XPath xPath, Document wmtsCapabilities)
    • parseLayers

      public static NodeList parseLayers(Document wmtsCapabilities)
    • parseNodeElementName

      public static String parseNodeElementName(XPath xPath, Node nodeElement) throws XPathExpressionException
      Throws:
      XPathExpressionException
    • parseNodeElementName

      public static String parseNodeElementName(Node nodeElement) throws XPathExpressionException
      Throws:
      XPathExpressionException
    • parseBoundingBox

      public static BoundingBox parseBoundingBox(Node bboxNode, boolean presumedWGS84)
      Parses the BoundingBox from the layer; either as the WGS84 Bbox, or one of the other listed ones
      Parameters:
      bboxNode - node of the layer, never null wgs84 if parsing the WGS84 bounding box
      presumedWGS84 - are we working in WGS84 bounding box or not
      Returns:
      the BoundingBox - crs is CRS:84 if wgs84 is true, otherwise parse from attribute