Package org.geotools.data.wfs.internal
Class AbstractWFSStrategy
Object
Specification
WFSStrategy
AbstractWFSStrategy
- Direct Known Subclasses:
StrictWFS_1_x_Strategy
,StrictWFS_2_0_Strategy
Base template-method class for
WFSStrategy
implementations that leverage the GeoTools xml-xsd
subsystem for schema assisted parsing and encoding of WFS requests and responses.
A conformant WFS client implementation based on this abstract class should only need to implement the following
methods from WFSStrategy
:
WFSStrategy.setCapabilities(org.geotools.data.wfs.internal.WFSGetCapabilities)
WFSStrategy.getFeatureTypeInfo(javax.xml.namespace.QName)
WFSStrategy.getServerSupportedOutputFormats(WFSOperationType operation)
WFSStrategy.getServerSupportedOutputFormats(QName typeName, WFSOperationType operation)
WFSStrategy.getClientSupportedOutputFormats(WFSOperationType operation)
WFSStrategy.getFeatureTypeNames()
WFSStrategy.getFilterCapabilities()
WFSStrategy.getSupportedCRSIdentifiers(QName typeName)
WFSStrategy.supports(ResultType resultType)
WFSStrategy.getServiceInfo()
getFilterConfiguration()
getWfsConfiguration()
getOperationName(org.geotools.data.wfs.internal.WFSOperationType)
createDescribeFeatureTypeRequestPost(org.geotools.data.wfs.internal.DescribeFeatureTypeRequest)
createGetFeatureRequestPost(org.geotools.data.wfs.internal.GetFeatureRequest)
createTransactionRequest(org.geotools.data.wfs.internal.TransactionRequest)
Additionally, specific strategy objects may override any other method to work around specific service implementation oddities. To that end, the following methods might be of special interest:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected WFSConfig
static final Configuration
static final Configuration
static final Configuration
protected static final Logger
static final Configuration
static final Configuration
static final Configuration
static final Configuration
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildDescribeFeatureTypeParametersForGET
(Map<String, String> kvp, QName typeName) buildUrlGET
(WFSRequest request) protected abstract EObject
Creates the EMF object to be encoded with theWFS configuration
when a DescribeFeatureType POST request is to be made.protected abstract EObject
createGetCapabilitiesRequest
(URL server) Factory method to create GetCapabilities Requestprotected abstract EObject
Creates the EMF object to be encoded with theWFS configuration
when a GetFeature POST request is to be made.protected abstract EObject
protected abstract EObject
Creates the EMF object to be encoded with theWFS configuration
when a Transaction request is to be made.void
dispose()
Allows to free any resource held.protected String
encodeGetFeatureGetFilter
(Filter filter) Returns a single-line string containing the xml representation of the given filter, as appropriate for theFILTER
parameter in a GetFeature request.protected String
encodePropertyName
(String propertyName) getDefaultOutputFormat
(WFSOperationType operation) Provide additional field type mappingsprotected abstract Configuration
Returns the xml configuration used to encode a filter atencodeGetFeatureGetFilter(Filter)
protected abstract QName
getOperationName
(WFSOperationType operation) Used bygetPostContents(WFSRequest)
to get the qualified operation name to encode; different WFS versions may use different operation names (specially namespaces).protected abstract String
getOperationURI
(WFSOperationType operation, HttpMethod method) getOperationURL
(WFSOperationType operation, HttpMethod method) Returns the URL for the given operation name and HTTP protocol as stated in the WFS capabilities.getPostContents
(WFSRequest request) Returns the input stream with the POST body contents for the given request.getPostContentType
(WFSRequest wfsRequest) protected String
getPrefixedTypeName
(QName qname) abstract Version
Returns the WFS protocol version this facade talks to the WFS instance.Expected version attribute for root element.abstract Configuration
Returns the xml configuration used to encode all POST requests.protected Encoder
prepareEncoder
(WFSRequest request) void
protected Filter
Filter[]
splitFilters
(QName typeName, Filter filter) Splits the filter provided by the geotools query into the server supported and unsupported ones.boolean
supportsOperation
(WFSOperationType operation, HttpMethod method) Returns whether the service supports the given operation for the given HTTP method.protected void
updatePropertyNames
(GetFeatureRequest request, Filter unsupportedFilter) If needed, expands the set of requested property names to include the ones needed to evaluate the unsupported filter.Methods inherited from class WFSStrategy
canLimit, canOffset, getClientSupportedOutputFormats, getFeatureTypeInfo, getFeatureTypeNames, getFilterCapabilities, getServerSupportedOutputFormats, getServerSupportedOutputFormats, getServiceInfo, getSupportedCRSIdentifiers, newRequestHandle, setCapabilities, supports, supportsTransaction
-
Field Details
-
LOGGER
-
FILTER_1_0_CONFIGURATION
-
WFS_1_0_CAPABILITIES_CONFIGURATION
-
WFS_1_0_CONFIGURATION
-
FILTER_1_1_CONFIGURATION
-
WFS_1_1_CONFIGURATION
-
FILTER_2_0_CONFIGURATION
-
WFS_2_0_CONFIGURATION
-
config
-
-
Constructor Details
-
AbstractWFSStrategy
public AbstractWFSStrategy()
-
-
Method Details
-
getOperationName
Used bygetPostContents(WFSRequest)
to get the qualified operation name to encode; different WFS versions may use different operation names (specially namespaces). -
updatePropertyNames
If needed, expands the set of requested property names to include the ones needed to evaluate the unsupported filter.- Parameters:
request
-unsupportedFilter
-
-
createDescribeFeatureTypeRequestPost
Creates the EMF object to be encoded with theWFS configuration
when a DescribeFeatureType POST request is to be made. -
createGetFeatureRequestPost
Creates the EMF object to be encoded with theWFS configuration
when a GetFeature POST request is to be made.- Throws:
IOException
-
createTransactionRequest
Creates the EMF object to be encoded with theWFS configuration
when a Transaction request is to be made.- Throws:
IOException
-
createListStoredQueriesRequestPost
protected abstract EObject createListStoredQueriesRequestPost(ListStoredQueriesRequest request) throws IOException - Throws:
IOException
-
createDescribeStoredQueriesRequestPost
protected abstract EObject createDescribeStoredQueriesRequestPost(DescribeStoredQueriesRequest request) throws IOException - Throws:
IOException
-
getFilterConfiguration
Returns the xml configuration used to encode a filter atencodeGetFeatureGetFilter(Filter)
-
getWfsConfiguration
Returns the xml configuration used to encode all POST requests.- Specified by:
getWfsConfiguration
in classWFSStrategy
- See Also:
-
getVersion
Description copied from class:Specification
Expected version attribute for root element.- Specified by:
getVersion
in classSpecification
- Returns:
- the version as a String
-
createGetCapabilitiesRequest
Factory method to create GetCapabilities Request- Specified by:
createGetCapabilitiesRequest
in classSpecification
- Parameters:
server
- the URL that points to the server's getCapabilities document- Returns:
- a configured GetCapabilitiesRequest that can be used to access the Document
-
setConfig
- Specified by:
setConfig
in classWFSStrategy
-
getConfig
- Specified by:
getConfig
in classWFSStrategy
-
encodePropertyName
-
buildGetFeatureParametersForGET
-
encodeGetFeatureGetFilter
Returns a single-line string containing the xml representation of the given filter, as appropriate for theFILTER
parameter in a GetFeature request.- Throws:
IOException
-
getServiceVersion
Description copied from class:WFSStrategy
Returns the WFS protocol version this facade talks to the WFS instance.- Specified by:
getServiceVersion
in classWFSStrategy
- Returns:
- the protocol version in use by this facade
- See Also:
-
getPrefixedTypeName
-
supportsOperation
Description copied from class:WFSStrategy
Returns whether the service supports the given operation for the given HTTP method.- Specified by:
supportsOperation
in classWFSStrategy
- Parameters:
operation
- the operation to check if the server supportsmethod
- 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- See Also:
-
getOperationURL
Description copied from class:WFSStrategy
Returns the URL for the given operation name and HTTP protocol as stated in the WFS capabilities.- Specified by:
getOperationURL
in classWFSStrategy
- Parameters:
operation
- the name of the WFS operationmethod
- 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:
-
getOperationURI
-
getDefaultOutputFormat
- Specified by:
getDefaultOutputFormat
in classWFSStrategy
-
dispose
public void dispose()Description copied from class:WFSStrategy
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.
- Specified by:
dispose
in classWFSStrategy
- See Also:
-
buildDescribeFeatureTypeParametersForGET
protected Map<String,String> buildDescribeFeatureTypeParametersForGET(DescribeFeatureTypeRequest request) -
buildDescribeFeatureTypeParametersForGET
-
buildDescribeStoredQueriesParametersForGET
protected Map<String,String> buildDescribeStoredQueriesParametersForGET(DescribeStoredQueriesRequest request) -
buildListStoredQueriesParametersForGET
protected Map<String,String> buildListStoredQueriesParametersForGET(ListStoredQueriesRequest request) -
prepareEncoder
-
splitFilters
Splits the filter provided by the geotools query into the server supported and unsupported ones.- Specified by:
splitFilters
in classWFSStrategy
- Returns:
- a two-element array where the first element is the supported filter and the second the one to post-process
- See Also:
-
simplify
-
buildUrlGET
- Specified by:
buildUrlGET
in classWFSStrategy
-
getPostContentType
- Specified by:
getPostContentType
in classWFSStrategy
-
getPostContents
Returns the input stream with the POST body contents for the given request.- Specified by:
getPostContents
in classWFSStrategy
- Throws:
IOException
- See Also:
-
getFieldTypeMappings
Description copied from class:WFSStrategy
Provide additional field type mappings- Specified by:
getFieldTypeMappings
in classWFSStrategy
- Returns:
- field type mappings
-