Class WFSDataStoreFactory
- All Implemented Interfaces:
DataAccessFactory,DataStoreFactorySpi,Factory
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class WFSDataAccessFactory
WFSDataAccessFactory.WFSFactoryParam<T>Nested classes/interfaces inherited from interface DataAccessFactory
DataAccessFactory.Param -
Field Summary
Fields inherited from class WFSDataAccessFactory
ADDITIONAL_HEADERS, AXIS_ORDER, AXIS_ORDER_COMPLIANT, AXIS_ORDER_EAST_NORTH, AXIS_ORDER_FILTER, AXIS_ORDER_NORTH_EAST, BUFFER_SIZE, ENCODING, ENTITY_RESOLVER, FILTER_COMPLIANCE, GML_COMPATIBLE_TYPENAMES, GML_COMPLIANCE_LEVEL, LENIENT, MAX_CONNECTION_POOL_SIZE, MAXFEATURES, NAMESPACE, OUTPUTFORMAT, PASSWORD, PROTOCOL, SCHEMA_CACHE_LOCATION, TIMEOUT, TRY_GZIP, URL, USE_HTTP_CONNECTION_POOLING, USEDEFAULTSRS, USERNAME, WFS_STRATEGY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancanProcess(Map params) Checks whetherparamscontains a valid set of parameters to connecto to a WFS.createDataStore(Map<String, ?> params) Requests the WFS Capabilities document from theurlparameter inparamsand returns aWFSDataStoreaccording to the version of the GetCapabilities document returned.static URLCreates a HTTP GET Method based WFSGetCapabilitiesrequest.static URLcreateGetCapabilitiesRequest(URL host, Version version) Creates a HTTP GET Method based WFSGetCapabilitiesrequest for the given protocol version.createNewDataStore(Map<String, ?> params) Describe the nature of the datasource constructed by this factory.Name suitable for display to end user.getHttpClient(Map<String, ?> params) Creates the HttpClient instance used to connect to the WFS service, compatible with the given parameters.booleanDefaults to true, only a few datastores need to check for drivers.Methods inherited from class WFSDataAccessFactory
canProcess, getImplementationHints, getParametersInfo, getWFSClientMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DataAccessFactory
getParametersInfoMethods inherited from interface Factory
getImplementationHints
-
Constructor Details
-
WFSDataStoreFactory
public WFSDataStoreFactory()
-
-
Method Details
-
createDataStore
Requests the WFS Capabilities document from theurlparameter inparamsand returns aWFSDataStoreaccording to the version of the GetCapabilities document returned.Note the
URLprovided as parameter must refer to the actualGetCapabilitiesrequest. If you need to specify a preferred version or want the GetCapabilities request to be generated from a base URL build the URL with thecreateGetCapabilitiesRequest(java.net.URL, org.geotools.util.Version)first.- Specified by:
createDataStorein interfaceDataAccessFactory- Specified by:
createDataStorein interfaceDataStoreFactorySpi- Overrides:
createDataStorein classWFSDataAccessFactory- Parameters:
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- Returns:
- 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.
- Throws:
IOException- if there were any problems setting up (creating or connecting) the datasource.- See Also:
-
getHttpClient
Creates the HttpClient instance used to connect to the WFS service, compatible with the given parameters.- Parameters:
params- wfs service connection parameters- Returns:
- the HttpClient instance
- Throws:
IOException
-
createNewDataStore
- Specified by:
createNewDataStorein interfaceDataStoreFactorySpi- Throws:
IOException
-
getDisplayName
Description copied from interface:DataAccessFactoryName suitable for display to end user.A non localized display name for this data store type.
- Specified by:
getDisplayNamein interfaceDataAccessFactory- Overrides:
getDisplayNamein classWFSDataAccessFactory- Returns:
- A short name suitable for display in a user interface.
-
getDescription
Description copied from interface:DataAccessFactoryDescribe the nature of the datasource constructed by this factory.A non localized description of this data store type.
- Specified by:
getDescriptionin interfaceDataAccessFactory- Overrides:
getDescriptionin classWFSDataAccessFactory- Returns:
- A human readable description that is suitable for inclusion in a list of available datasources.
-
canProcess
Checks whetherparamscontains a valid set of parameters to connecto to a WFS.Rules are:
- The mandatory
WFSDataAccessFactory.URLis provided. - Either both
WFSDataAccessFactory.USERNAMEandWFSDataAccessFactory.PASSWORDare provided, or none.
- Specified by:
canProcessin interfaceDataAccessFactory- Overrides:
canProcessin classWFSDataAccessFactory- Parameters:
params- The full set of information needed to construct a live data source.- Returns:
- booean true if and only if this factory can process the resource indicated by the param set and all the required params are pressent.
- The mandatory
-
createGetCapabilitiesRequest
Creates a HTTP GET Method based WFSGetCapabilitiesrequest for the given protocol version.If the query string in the
hostURL already contains a VERSION number, that version is discarded.- Parameters:
host- non null URL from which to construct the WFSGetCapabilitiesrequest by discarding the query string, if any, and appending the propper query string.
-
createGetCapabilitiesRequest
Creates a HTTP GET Method based WFSGetCapabilitiesrequest.If the query string in the
hostURL 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.
- Parameters:
host- non null URL pointing either to a base WFS service access point, or to a fullGetCapabilitiesrequest.
-
isAvailable
public boolean isAvailable()Defaults to true, only a few datastores need to check for drivers.- Specified by:
isAvailablein interfaceDataAccessFactory- Overrides:
isAvailablein classWFSDataAccessFactory- Returns:
true
-