Class WFSDataStoreFactory
- Object
-
- WFSDataAccessFactory
-
- WFSDataStoreFactory
-
- All Implemented Interfaces:
DataAccessFactory,DataStoreFactorySpi,Factory
public class WFSDataStoreFactory extends WFSDataAccessFactory implements DataStoreFactorySpi
ADataStoreFactorySpito connect to a Web Feature Service.Produces a
WFSDataStoreif 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
DataStoreFindermechanism, 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
DataStorecapable 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 booleancanProcess(Map params)Checks whetherparamscontains a valid set of parameters to connecto to a WFS.WFSDataStorecreateDataStore(Map<String,?> params)Requests the WFS Capabilities document from theurlparameter inparamsand returns aWFSDataStoreaccording to the version of the GetCapabilities document returned.static URLcreateGetCapabilitiesRequest(URL host)Creates a HTTP GET Method based WFSGetCapabilitiesrequest.static URLcreateGetCapabilitiesRequest(URL host, Version version)Creates a HTTP GET Method based WFSGetCapabilitiesrequest for the given protocol version.DataStorecreateNewDataStore(Map<String,?> params)StringgetDescription()Describe the nature of the datasource constructed by this factory.StringgetDisplayName()Name suitable for display to end user.HTTPClientgetHttpClient(Map<String,?> params)Creates the HttpClient instance used to connect to the WFS service, compatible with the given parameters.booleanisAvailable()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 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:
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:
createNewDataStorein interfaceDataStoreFactorySpi- Throws:
IOException
-
getDisplayName
public String 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
public String 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
public boolean canProcess(Map params)
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
public static URL createGetCapabilitiesRequest(URL host, Version version)
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
public static URL createGetCapabilitiesRequest(URL host)
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
-
-