Class ServiceMetadataUtils

java.lang.Object
org.opengis.cite.cat30.util.ServiceMetadataUtils

public class ServiceMetadataUtils extends Object
Provides various utility methods for accessing service-related metadata resources such as an OGC service description or an OpenSearch description document.
  • Field Details

    • URL_TEMPLATE_PARAMS

      public static final String URL_TEMPLATE_PARAMS
      Key value that associates an Element node (osd:Url in an OpenSearch description document) with the collection of URL template parameters it declares.
      See Also:
  • Constructor Details

    • ServiceMetadataUtils

      public ServiceMetadataUtils()
  • Method Details

    • getOperationEndpoint

      public static URI getOperationEndpoint(Document cswMetadata, String opName, String httpMethod)
      Extracts a request endpoint from a service capabilities document. If the request URI contains a query component it is ignored.
      Parameters:
      cswMetadata - A DOM Document node containing service metadata (OGC capabilities document).
      opName - The operation (request) name.
      httpMethod - The HTTP method to use (if null or empty the first method listed will be used).
      Returns:
      A URI denoting a service endpoint; the URI is empty if no matching endpoint was found.
    • getOpenSearchURLTemplates

      public static List<Node> getOpenSearchURLTemplates(Document osDescr)
      Returns a list of nodes representing the URL templates defined in an OpenSearch description document. Each node in the resulting list will be associated with an unmodifiable List<TemplateParamInfo> containing information about the declared template parameters; it can be accessed via getUserData using the key value URL_TEMPLATE_PARAMS.
      Parameters:
      osDescr - An OpenSearchDescription document (osd:OpenSearchDescription).
      Returns:
      A sequence of Element nodes (os:Url) containing URL templates.
    • getOpenSearchQueriesByRole

      public static List<Node> getOpenSearchQueriesByRole(Document osDescr, QName role)
      Returns a list of nodes representing queries defined in an OpenSearch description document.
      Parameters:
      osDescr - An OpenSearchDescription document.
      role - The (qualified) name of a query role.
      Returns:
      A sequence of Element nodes (os:Query) that define specific search requests; the list may be empty if no matching queries are found.
    • getConstraintValues

      public static Set<String> getConstraintValues(Document cswMetadata, String name)
      Searches a CSW capabilities document for the specified constraint and returns its set of allowed values. The default value is returned if present; otherwise the complete list of allowed values.
      Parameters:
      cswMetadata - A CSW capabilities document.
      name - The name of the constraint (not case-sensitive).
      Returns:
      A set containing the allowed values of the constraint; it will be empty if no such constraint exists or it has no value.
    • getParameterValues

      public static Set<String> getParameterValues(Document cswMetadata, String reqName, String paramName)
      Searches a CSW capabilities document for the specified request parameter and returns its set of allowed values. A service-level parameter value may be overridden or supplemented by an operation-specific parameter value.
      Parameters:
      cswMetadata - A CSW capabilities document.
      reqName - The name of a service request; if omitted, the search is restricted to service-level parameters.
      paramName - The name of the request parameter (not case-sensitive).
      Returns:
      A set containing the allowed parameter values; it will be empty if no such parameter exists or it has no value.
    • addDomainValues

      static void addDomainValues(Set<String> valueSet, net.sf.saxon.s9api.XdmValue opMetadata)
      Adds the allowed values of operation metadata elements to the given set.
      Parameters:
      valueSet - The set to which the values are added.
      opMetadata - A sequence of operation metadata elements (ows:Parameter or ows:Constraint, of type ows:DomainType).