Class WFSDataStoreFactory

  • All Implemented Interfaces:
    DataAccessFactory, DataStoreFactorySpi, Factory

    public class WFSDataStoreFactory
    extends WFSDataAccessFactory
    implements DataStoreFactorySpi
    A DataStoreFactorySpi to connect to a Web Feature Service.

    Produces a WFSDataStore if the correct set of connection parameters are provided. For instance, the only mandatory one is WFSDataAccessFactory.URL.

    As with all the DataStoreFactorySpi implementations, this one is not intended to be used directly but through the DataStoreFinder mechanism, hence client applications should not have strong dependencies over this module.

    Upon a valid URL to a WFS GetCapabilities document, this factory will perform version negotiation between the server supported protocol versions and this plugin supported ones, and will return a DataStore capable of communicating with the server using the agreed WFS protocol version.

    In the case the provided GetCapabilities URL explicitly contains a VERSION parameter and both the server and client support that version, that version will be used.

    See Also:
    WFSDataStore, WFSClient
    • Constructor Detail

      • WFSDataStoreFactory

        public WFSDataStoreFactory()
    • Method Detail

      • createDataStore

        public WFSDataStore createDataStore​(Map<String,​?> params)
                                     throws IOException
        Requests the WFS Capabilities document from the url parameter in params and returns a WFSDataStore according to the version of the GetCapabilities document returned.

        Note the URL provided as parameter must refer to the actual GetCapabilities request. If you need to specify a preferred version or want the GetCapabilities request to be generated from a base URL build the URL with the createGetCapabilitiesRequest(, org.geotools.util.Version) first.

        Specified by:
        createDataStore in interface DataAccessFactory
        Specified by:
        createDataStore in interface DataStoreFactorySpi
        createDataStore in class WFSDataAccessFactory
        params - The full set of information needed to construct a live data store. Typical key values for the map include: url - location of a resource, used by file reading datasources. dbtype - the type of the database to connect to, e.g. postgis, mysql
        The created DataStore, this may be null if the required resource was not found or if insufficent parameters were given. Note that canProcess() should have returned false if the problem is to do with insuficent parameters.
        IOException - if there were any problems setting up (creating or connecting) the datasource.
        See Also:
      • getHttpClient

        public HTTPClient getHttpClient​(Map<String,​?> params)
                                 throws IOException
        Creates the HttpClient instance used to connect to the WFS service, compatible with the given parameters.
        params - wfs service connection parameters
        the HttpClient instance
      • getDescription

        public String getDescription()
        Description copied from interface: DataAccessFactory
        Describe the nature of the datasource constructed by this factory.

        A non localized description of this data store type.

        Specified by:
        getDescription in interface DataAccessFactory
        getDescription in class WFSDataAccessFactory
        A human readable description that is suitable for inclusion in a list of available datasources.
      • createGetCapabilitiesRequest

        public static URL createGetCapabilitiesRequest​(URL host,
                                                       Version version)
        Creates a HTTP GET Method based WFS GetCapabilities request for the given protocol version.

        If the query string in the host URL already contains a VERSION number, that version is discarded.

        host - non null URL from which to construct the WFS GetCapabilities request by discarding the query string, if any, and appending the propper query string.
      • createGetCapabilitiesRequest

        public static URL createGetCapabilitiesRequest​(URL host)
        Creates a HTTP GET Method based WFS GetCapabilities request.

        If the query string in the host URL already contains a VERSION number, that version is used, otherwise the queried version will be 1.0.0.

        NOTE the default version will be 1.0.0 until the support for 1.1.0 gets stable enough for general use. If you want to use a 1.1.0 WFS you'll have to explicitly provide the VERSION=1.1.0 parameter in the GetCapabilities request meanwhile.

        host - non null URL pointing either to a base WFS service access point, or to a full GetCapabilities request.