Class WFSDataStoreFactory
- Object
-
- WFSDataAccessFactory
-
- WFSDataStoreFactory
-
- All Implemented Interfaces:
DataAccessFactory
,DataStoreFactorySpi
,Factory
public class WFSDataStoreFactory extends WFSDataAccessFactory implements DataStoreFactorySpi
ADataStoreFactorySpi
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 isWFSDataAccessFactory.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
-
-
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 Constructor Description WFSDataStoreFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canProcess(Map params)
Checks whetherparams
contains a valid set of parameters to connecto to a WFS.WFSDataStore
createDataStore(Map<String,?> params)
Requests the WFS Capabilities document from theurl
parameter inparams
and returns aWFSDataStore
according to the version of the GetCapabilities document returned.static URL
createGetCapabilitiesRequest(URL host)
Creates a HTTP GET Method based WFSGetCapabilities
request.static URL
createGetCapabilitiesRequest(URL host, Version version)
Creates a HTTP GET Method based WFSGetCapabilities
request for the given protocol version.DataStore
createNewDataStore(Map<String,?> params)
String
getDescription()
Describe the nature of the datasource constructed by this factory.String
getDisplayName()
Name suitable for display to end user.HTTPClient
getHttpClient(Map<String,?> params)
Creates the HttpClient instance used to connect to the WFS service, compatible with the given parameters.boolean
isAvailable()
Defaults to true, only a few datastores need to check for drivers.-
Methods inherited from class WFSDataAccessFactory
canProcess, getImplementationHints, getParametersInfo, getWFSClient
-
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface DataAccessFactory
getParametersInfo
-
Methods inherited from interface Factory
getImplementationHints
-
-
-
-
Method Detail
-
createDataStore
public WFSDataStore createDataStore(Map<String,?> params) throws IOException
Requests the WFS Capabilities document from theurl
parameter inparams
and returns aWFSDataStore
according to the version of the GetCapabilities document returned.Note the
URL
provided as parameter must refer to the actualGetCapabilities
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 thecreateGetCapabilitiesRequest(java.net.URL, org.geotools.util.Version)
first.- Specified by:
createDataStore
in interfaceDataAccessFactory
- Specified by:
createDataStore
in interfaceDataStoreFactorySpi
- Overrides:
createDataStore
in 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:
DataStoreFactorySpi.createDataStore(java.util.Map)
-
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.- Parameters:
params
- wfs service connection parameters- Returns:
- the HttpClient instance
- Throws:
IOException
-
createNewDataStore
public DataStore createNewDataStore(Map<String,?> params) throws IOException
- Specified by:
createNewDataStore
in interfaceDataStoreFactorySpi
- Throws:
IOException
-
getDisplayName
public String getDisplayName()
Description copied from interface:DataAccessFactory
Name suitable for display to end user.A non localized display name for this data store type.
- Specified by:
getDisplayName
in interfaceDataAccessFactory
- Overrides:
getDisplayName
in classWFSDataAccessFactory
- Returns:
- A short name suitable for display in a user interface.
-
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 interfaceDataAccessFactory
- Overrides:
getDescription
in classWFSDataAccessFactory
- Returns:
- A human readable description that is suitable for inclusion in a list of available datasources.
-
canProcess
public boolean canProcess(Map params)
Checks whetherparams
contains a valid set of parameters to connecto to a WFS.Rules are:
- The mandatory
WFSDataAccessFactory.URL
is provided. - Either both
WFSDataAccessFactory.USERNAME
andWFSDataAccessFactory.PASSWORD
are provided, or none.
- Specified by:
canProcess
in interfaceDataAccessFactory
- Overrides:
canProcess
in 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
public static URL createGetCapabilitiesRequest(URL host, Version version)
Creates a HTTP GET Method based WFSGetCapabilities
request for the given protocol version.If the query string in the
host
URL already contains a VERSION number, that version is discarded.- Parameters:
host
- non null URL from which to construct the WFSGetCapabilities
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 WFSGetCapabilities
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.
- Parameters:
host
- non null URL pointing either to a base WFS service access point, or to a fullGetCapabilities
request.
-
isAvailable
public boolean isAvailable()
Defaults to true, only a few datastores need to check for drivers.- Specified by:
isAvailable
in interfaceDataAccessFactory
- Overrides:
isAvailable
in classWFSDataAccessFactory
- Returns:
true
-
-