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 WFSConfigstatic final Configurationstatic final Configurationstatic final Configurationprotected static final Loggerstatic final Configurationstatic final Configurationstatic final Configurationstatic final Configuration -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildDescribeFeatureTypeParametersForGET(Map<String, String> kvp, QName typeName) buildUrlGET(WFSRequest request) protected abstract EObjectCreates the EMF object to be encoded with theWFS configurationwhen a DescribeFeatureType POST request is to be made.protected abstract EObjectcreateGetCapabilitiesRequest(URL server) Factory method to create GetCapabilities Requestprotected abstract EObjectCreates the EMF object to be encoded with theWFS configurationwhen a GetFeature POST request is to be made.protected abstract EObjectprotected abstract EObjectCreates the EMF object to be encoded with theWFS configurationwhen a Transaction request is to be made.voiddispose()Allows to free any resource held.protected StringencodeGetFeatureGetFilter(Filter filter) Returns a single-line string containing the xml representation of the given filter, as appropriate for theFILTERparameter in a GetFeature request.protected StringencodePropertyName(String propertyName) getDefaultOutputFormat(WFSOperationType operation) Provide additional field type mappingsprotected abstract ConfigurationReturns the xml configuration used to encode a filter atencodeGetFeatureGetFilter(Filter)protected abstract QNamegetOperationName(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 StringgetOperationURI(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 StringgetPrefixedTypeName(QName qname) abstract VersionReturns the WFS protocol version this facade talks to the WFS instance.Expected version attribute for root element.abstract ConfigurationReturns the xml configuration used to encode all POST requests.protected EncoderprepareEncoder(WFSRequest request) voidprotected FilterFilter[]splitFilters(QName typeName, Filter filter) Splits the filter provided by the geotools query into the server supported and unsupported ones.booleansupportsOperation(WFSOperationType operation, HttpMethod method) Returns whether the service supports the given operation for the given HTTP method.protected voidupdatePropertyNames(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 configurationwhen a DescribeFeatureType POST request is to be made. -
createGetFeatureRequestPost
Creates the EMF object to be encoded with theWFS configurationwhen a GetFeature POST request is to be made.- Throws:
IOException
-
createTransactionRequest
Creates the EMF object to be encoded with theWFS configurationwhen 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:
getWfsConfigurationin classWFSStrategy- See Also:
-
getVersion
Description copied from class:SpecificationExpected version attribute for root element.- Specified by:
getVersionin classSpecification- Returns:
- the version as a String
-
createGetCapabilitiesRequest
Factory method to create GetCapabilities Request- Specified by:
createGetCapabilitiesRequestin 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:
setConfigin classWFSStrategy
-
getConfig
- Specified by:
getConfigin classWFSStrategy
-
encodePropertyName
-
buildGetFeatureParametersForGET
-
encodeGetFeatureGetFilter
Returns a single-line string containing the xml representation of the given filter, as appropriate for theFILTERparameter in a GetFeature request.- Throws:
IOException
-
getServiceVersion
Description copied from class:WFSStrategyReturns the WFS protocol version this facade talks to the WFS instance.- Specified by:
getServiceVersionin classWFSStrategy- Returns:
- the protocol version in use by this facade
- See Also:
-
getPrefixedTypeName
-
supportsOperation
Description copied from class:WFSStrategyReturns whether the service supports the given operation for the given HTTP method.- Specified by:
supportsOperationin 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:
trueif the operation/method is supported as stated in the WFS capabilities- See Also:
-
getOperationURL
Description copied from class:WFSStrategyReturns the URL for the given operation name and HTTP protocol as stated in the WFS capabilities.- Specified by:
getOperationURLin classWFSStrategy- Parameters:
operation- the name of the WFS operationmethod- the HTTP method- Returns:
- The URL access point for the given operation and method or
nullif the capabilities does not declare an access point for the operation/method combination - See Also:
-
getOperationURI
-
getDefaultOutputFormat
- Specified by:
getDefaultOutputFormatin classWFSStrategy
-
dispose
public void dispose()Description copied from class:WFSStrategyAllows 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:
disposein 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:
splitFiltersin 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:
buildUrlGETin classWFSStrategy
-
getPostContentType
- Specified by:
getPostContentTypein classWFSStrategy
-
getPostContents
Returns the input stream with the POST body contents for the given request.- Specified by:
getPostContentsin classWFSStrategy- Throws:
IOException- See Also:
-
getFieldTypeMappings
Description copied from class:WFSStrategyProvide additional field type mappings- Specified by:
getFieldTypeMappingsin classWFSStrategy- Returns:
- field type mappings
-