Class WFSStrategy

  • Direct Known Subclasses:
    AbstractWFSStrategy

    public abstract class WFSStrategy
    extends Specification
    Facade interface to interact with a WFS instance.

    Implementations of this interface know how to send and get information back from a WFS service for a specific protocol version, but are not meant to provide any logic other than the conversation with the service. For instance, WFSProtocol implementations are not required to transform filters to something appropriate for the service capabilities, nor any other control logic than creating and sending the requests mapping what is given to the operation methods.

    This interface provides enough information extracted or derived from the WFS capabilities document as for the client code to issue requests appropriate for the server capabilities.

    • Constructor Detail

      • WFSStrategy

        public WFSStrategy()
    • Method Detail

      • setCapabilities

        public abstract void setCapabilities​(WFSGetCapabilities capabilities)
      • setConfig

        public abstract void setConfig​(WFSConfig config)
      • getFeatureTypeInfo

        public abstract FeatureTypeInfo getFeatureTypeInfo​(QName typeName)
        Returns the feature type metadata object parsed from the capabilities document for the given typeName
        Parameters:
        typeName - the typeName as stated in the capabilities FeatureTypeList to get the info for
        Returns:
        the WFS capabilities metadata for typeName
        Throws:
        IllegalArgumentException - if typeName is not the name of a FeatureType stated in the capabilities document.
      • getConfig

        public abstract WFSConfig getConfig()
      • getServiceVersion

        public abstract Version getServiceVersion()
        Returns the WFS protocol version this facade talks to the WFS instance.
        Returns:
        the protocol version in use by this facade
      • getServerSupportedOutputFormats

        public abstract Set<String> getServerSupportedOutputFormats​(WFSOperationType operation)
        Returns:
        the output formats the server advertises for the given operation;
      • getServerSupportedOutputFormats

        public abstract Set<String> getServerSupportedOutputFormats​(QName typeName,
                                                                    WFSOperationType operation)
        Parameters:
        typeName - the feature type name for which to return the supported output formats
        Returns:
        the output formats the server supports for the given type name and operation
      • getClientSupportedOutputFormats

        public abstract List<String> getClientSupportedOutputFormats​(WFSOperationType operation)
        Returns:
        the list of output formats supported by the client for the given operation, in preferred order.
      • getFeatureTypeNames

        public abstract Set<QName> getFeatureTypeNames()
        Returns the set of type names as extracted from the capabilities document, including the namespace and prefix.
        Returns:
        the set of feature type names as extracted from the capabilities document
      • getFilterCapabilities

        public abstract FilterCapabilities getFilterCapabilities()
        Returns the parsed version of the FilterCapabilities section in the capabilities document
        Returns:
        a FilterCapabilities out of the FilterCapabilities section in the getcapabilities document
      • splitFilters

        public abstract Filter[] splitFilters​(QName typeName,
                                              Filter filter)
        Splits the filter provided by the geotools query into the server supported and unsupported ones.
        Returns:
        a two-element array where the first element is the supported filter and the second the one to post-process
      • supportsOperation

        public abstract boolean supportsOperation​(WFSOperationType operation,
                                                  HttpMethod method)
        Returns whether the service supports the given operation for the given HTTP method.
        Parameters:
        operation - the operation to check if the server supports
        method - the HTTP method to check if the server supports for the given operation
        Returns:
        true if the operation/method is supported as stated in the WFS capabilities
      • supportsTransaction

        public abstract boolean supportsTransaction​(QName typeName)
      • getOperationURL

        public abstract URL getOperationURL​(WFSOperationType operation,
                                            HttpMethod method)
        Returns the URL for the given operation name and HTTP protocol as stated in the WFS capabilities.
        Parameters:
        operation - the name of the WFS operation
        method - the HTTP method
        Returns:
        The URL access point for the given operation and method or null if the capabilities does not declare an access point for the operation/method combination
        See Also:
        supportsOperation(WFSOperationType, HttpMethod)
      • getSupportedCRSIdentifiers

        public abstract Set<String> getSupportedCRSIdentifiers​(QName typeName)
        Returns the union of the default CRS and the other supported CRS's of the given feature type as declared in the corresponding FeatureType element in the capabilities document, as well as any globally supported CRS identifier declared as a parameter of the GetFeature oepration in the capabilities document.
        Parameters:
        typeName - the featuretype name as declared in the FeatureType/Name element of the WFS capabilities
        Returns:
        the list of supported CRS identifiers for the given feature type
      • dispose

        public abstract void dispose()
        Allows to free any resource held.

        Successive calls to this method should not result in any exception, but the instance is meant to not be usable after the first invocation.

      • getDefaultOutputFormat

        public abstract String getDefaultOutputFormat​(WFSOperationType operation)
      • buildUrlGET

        public abstract URL buildUrlGET​(WFSRequest request)
      • getPostContentType

        public abstract String getPostContentType​(WFSRequest wfsRequest)
      • getPostContents

        public abstract InputStream getPostContents​(WFSRequest wfsRequest)
                                             throws IOException
        Returns the input stream with the POST body contents for the given request.
        Throws:
        IOException
      • getWfsConfiguration

        public abstract Configuration getWfsConfiguration()
      • newRequestHandle

        public String newRequestHandle​(WFSOperationType operation)
      • getFieldTypeMappings

        public abstract Map<QName,​Class<?>> getFieldTypeMappings()
        Provide additional field type mappings
        Returns:
        field type mappings
      • canLimit

        public boolean canLimit()
        Returns:
      • canOffset

        public boolean canOffset()
        Indicates whether the server supports adjusting the starting position of the result set. Defaults to false, as not all servers provide support for paging.
        Returns:
        true if the server supports setting an offset for the results, otherwise false