Class ServiceMetadataUtils

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

public class ServiceMetadataUtils extends Object
Provides various utility methods for accessing service metadata.
  • Constructor Details

    • ServiceMetadataUtils

      public ServiceMetadataUtils()
  • Method Details

    • getServiceTitle

      public static String getServiceTitle(Document wfsMetadata)
      Gets the title of the service.
      Parameters:
      wfsMetadata - The service capabilities document.
      Returns:
      The actual title or "Not specified" if no title appears.
    • getOperationEndpoint

      public static URI getOperationEndpoint(Document wfsMetadata, String opName, ProtocolBinding binding)
      Extracts a request endpoint from a WFS capabilities document. If the request URI contains a query component it is removed (but not from the source document).
      Parameters:
      wfsMetadata - A DOM 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:
      A URI referring to a request endpoint; the URI is empty if no matching endpoint is found.
    • getRequestEndpoints

      public static Map<String,URI> getRequestEndpoints(Document wfsMetadata, String reqName)
      Returns a Map containing the HTTP endpoints for a given service request.
      Parameters:
      wfsMetadata - A DOM Document node containing service metadata (WFS capabilities document).
      reqName - The (local) name of the service request.
      Returns:
      A Map<String, URI> object that associates an HTTP method name with a URI, or null if the request is not implemented.
    • getFeatureTypes

      public static List<QName> getFeatureTypes(Document wfsMetadata)
      Extracts the list of feature type names from a WFS capabilities document.
      Parameters:
      wfsMetadata - A service capabilities document (wfs:WFS_Capabilities).
      Returns:
      A List containing one or more QName items.
    • extractFeatureTypeInfo

      public static Map<QName,FeatureTypeInfo> extractFeatureTypeInfo(Document wfsCapabilities)
      Extracts information about feature types from the service metadata document. The following information items are collected for each feature type:
      • Qualified type name (wfs:Name)
      • Supported CRS identifiers (wfs:DefaultCRS, wfs:OtherCRS)
      • Spatial extent (ows:WGS84BoundingBox)
      Parameters:
      wfsCapabilities - A Document (wfs:WFS_Capabilities).
      Returns:
      A Map containing one or more entries where a feature type name (QName) is associated with a FeatureTypeInfo value object.
    • buildQName

      public static QName buildQName(Node node)
      Builds a QName representing the qualified name conveyed by a node with text content.
      Parameters:
      node - A DOM node (Element) containing a qualified name (xsd:QName value); if it is an unprefixed name, a default namespace binding should be in scope.
      Returns:
      A QName object.
    • getGlobalBindings

      public static Set<ProtocolBinding> getGlobalBindings(Document wfsMetadata)
      Discovers which protocol bindings are broadly implemented by a WFS. These global constraints may be overridden for a particular operation. The values of the standard request encoding constraints are checked:
      • KVPEncoding
      • XMLEncoding
      • SOAPEncoding
      Parameters:
      wfsMetadata - A service metadata document (wfs:WFS_Capabilities).
      Returns:
      A Set of protocol bindings implemented by the SUT.
    • getOperationBindings

      public static Set<ProtocolBinding> getOperationBindings(Document wfsMetadata, String opName)
      Determines which protocol bindings are supported for a given operation. This method will currently not handle the case where a global binding is disabled for an operation (a per-operation constraint overrides a global constraint).
      Parameters:
      wfsMetadata - A service metadata document (wfs:WFS_Capabilities).
      opName - The name of a WFS operation.
      Returns:
      A Set of protocol bindings supported for the operation.
    • getConformanceClaims

      public static Set<ConformanceClass> getConformanceClaims(Document wfsMetadata)
      Returns a set of conformance classes that the WFS under test claims to satisfy.
      Parameters:
      wfsMetadata - A service metadata document (wfs:WFS_Capabilities).
      Returns:
      A Set containing at least two members: a fundamental conformance level and a message binding.
      See Also:
      • "ISO 19142:2010, Geographic information -- Web Feature Service: Table 13"
    • implementsSpatialOperator

      public static boolean implementsSpatialOperator(Document wfsMetadata, String operatorName)
      Indicates whether or not the specified spatial operator is supported. The standard operators are listed below.
      • BBOX (mandatory)
      • Equals
      • Disjoint
      • Intersects
      • Touches
      • Crosses
      • Within
      • Contains
      • Overlaps
      • Beyond
      • DWithin
      Parameters:
      wfsMetadata - A WFS capabilities document.
      operatorName - The name of a spatial operator.
      Returns:
      true if the operator is supported; false if not.
    • getSpatialCapabilities

      public static Map<org.opengis.cite.geomatics.SpatialOperator,Set<QName>> getSpatialCapabilities(Document wfsMetadata)
      Gets the spatial capabilities supported by a WFS: specifically, the set of implemented spatial operators and their associated geometry operands (some of which may be common to all operators).
      Parameters:
      wfsMetadata - A WFS capabilities document.
      Returns:
      A Map with one entry for each implemented spatial operator (the key); the value is a set of supported geometry type names (represented as a QName).
    • geometryOperands

      public static Set<QName> geometryOperands(NodeList operandList)
      Returns a set of geometry type names identified in the given list of geometry operands.
      Parameters:
      operandList - A list of fes:GeometryOperand elements.
      Returns:
      A set of qualified names.
    • implementsTemporalOperator

      public static boolean implementsTemporalOperator(Document wfsMetadata, String operatorName)
      Indicates whether or not the specified temporal operator is supported. The standard operators are listed below.
      • During (mandatory)
      • After
      • Before
      • Begins
      • BegunBy
      • TContains
      • TEquals
      • TOverlaps
      • Meets
      • OverlappedBy
      • MetBy
      • Ends
      • EndedBy
      Parameters:
      wfsMetadata - A WFS capabilities document.
      operatorName - The name of a temporal operator.
      Returns:
      true if the operator is supported; false if not.
    • implementsConformanceClass

      public static boolean implementsConformanceClass(Document wfsMetadata, String conformanceClass)
      Indicates whether or not the given service description claims that the specified WFS or FES conformance class has been implemented.
      Parameters:
      wfsMetadata - A WFS capabilities document.
      conformanceClass - The name of a constraint that identifies a conformance class.
      Returns:
      true if the conformance class is implemented; false if not.
      See Also:
    • getConstraintValue

      public static String getConstraintValue(Document wfsMetadata, String constraintName)
      Gets the effective value of the specified service or operation constraint. The default value or the first allowed value is returned.
      Parameters:
      wfsMetadata - A WFS capabilities document.
      constraintName - The name of the constraint.
      Returns:
      A String denoting the effective constraint value; this is an empty string if the constraint does not occur in the capabilities document.