Package org.geotools.data.wfs.internal
Class AbstractWFSStrategy
- Object
-
- Specification
-
- WFSStrategy
-
- AbstractWFSStrategy
-
- Direct Known Subclasses:
StrictWFS_1_x_Strategy
,StrictWFS_2_0_Strategy
public abstract class AbstractWFSStrategy extends WFSStrategy
Base template-method class forWFSStrategy
implementations that leverage the GeoToolsxml-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
Fields Modifier and Type Field Description protected WFSConfig
config
static Configuration
FILTER_1_0_CONFIGURATION
static Configuration
FILTER_1_1_CONFIGURATION
static Configuration
FILTER_2_0_CONFIGURATION
protected static Logger
LOGGER
static Configuration
WFS_1_0_CAPABILITIES_CONFIGURATION
static Configuration
WFS_1_0_CONFIGURATION
static Configuration
WFS_1_1_CONFIGURATION
static Configuration
WFS_2_0_CONFIGURATION
-
Constructor Summary
Constructors Constructor Description AbstractWFSStrategy()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Map<String,String>
buildDescribeFeatureTypeParametersForGET(Map<String,String> kvp, QName typeName)
protected Map<String,String>
buildDescribeFeatureTypeParametersForGET(DescribeFeatureTypeRequest request)
protected Map<String,String>
buildDescribeStoredQueriesParametersForGET(DescribeStoredQueriesRequest request)
protected Map<String,String>
buildGetFeatureParametersForGET(GetFeatureRequest request)
protected Map<String,String>
buildListStoredQueriesParametersForGET(ListStoredQueriesRequest request)
URL
buildUrlGET(WFSRequest request)
protected abstract EObject
createDescribeFeatureTypeRequestPost(DescribeFeatureTypeRequest request)
Creates the EMF object to be encoded with theWFS configuration
when a DescribeFeatureType POST request is to be made.protected abstract EObject
createDescribeStoredQueriesRequestPost(DescribeStoredQueriesRequest request)
GetCapabilitiesRequest
createGetCapabilitiesRequest(URL server)
Factory method to create GetCapabilities Requestprotected abstract EObject
createGetFeatureRequestPost(GetFeatureRequest query)
Creates the EMF object to be encoded with theWFS configuration
when a GetFeature POST request is to be made.protected abstract EObject
createListStoredQueriesRequestPost(ListStoredQueriesRequest request)
protected abstract EObject
createTransactionRequest(TransactionRequest request)
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)
WFSConfig
getConfig()
String
getDefaultOutputFormat(WFSOperationType operation)
Map<QName,Class<?>>
getFieldTypeMappings()
Provide additional field type mappingsprotected abstract Configuration
getFilterConfiguration()
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)
URL
getOperationURL(WFSOperationType operation, HttpMethod method)
Returns the URL for the given operation name and HTTP protocol as stated in the WFS capabilities.InputStream
getPostContents(WFSRequest request)
Returns the input stream with the POST body contents for the given request.String
getPostContentType(WFSRequest wfsRequest)
protected String
getPrefixedTypeName(QName qname)
abstract Version
getServiceVersion()
Returns the WFS protocol version this facade talks to the WFS instance.String
getVersion()
Expected version attribute for root element.abstract Configuration
getWfsConfiguration()
Returns the xml configuration used to encode all POST requests.protected Encoder
prepareEncoder(WFSRequest request)
void
setConfig(WFSConfig config)
protected Filter
simplify(Filter 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 Detail
-
LOGGER
protected static final Logger LOGGER
-
FILTER_1_0_CONFIGURATION
public static final Configuration FILTER_1_0_CONFIGURATION
-
WFS_1_0_CAPABILITIES_CONFIGURATION
public static final Configuration WFS_1_0_CAPABILITIES_CONFIGURATION
-
WFS_1_0_CONFIGURATION
public static final Configuration WFS_1_0_CONFIGURATION
-
FILTER_1_1_CONFIGURATION
public static final Configuration FILTER_1_1_CONFIGURATION
-
WFS_1_1_CONFIGURATION
public static final Configuration WFS_1_1_CONFIGURATION
-
FILTER_2_0_CONFIGURATION
public static final Configuration FILTER_2_0_CONFIGURATION
-
WFS_2_0_CONFIGURATION
public static final Configuration WFS_2_0_CONFIGURATION
-
config
protected WFSConfig config
-
-
Method Detail
-
getOperationName
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).
-
updatePropertyNames
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.- Parameters:
request
-unsupportedFilter
-
-
createDescribeFeatureTypeRequestPost
protected abstract EObject createDescribeFeatureTypeRequestPost(DescribeFeatureTypeRequest request)
Creates the EMF object to be encoded with theWFS configuration
when a DescribeFeatureType POST request is to be made.
-
createGetFeatureRequestPost
protected abstract EObject createGetFeatureRequestPost(GetFeatureRequest query) throws IOException
Creates the EMF object to be encoded with theWFS configuration
when a GetFeature POST request is to be made.- Throws:
IOException
-
createTransactionRequest
protected abstract EObject createTransactionRequest(TransactionRequest request) throws IOException
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
protected abstract Configuration getFilterConfiguration()
Returns the xml configuration used to encode a filter atencodeGetFeatureGetFilter(Filter)
-
getWfsConfiguration
public abstract Configuration getWfsConfiguration()
Returns the xml configuration used to encode all POST requests.- Specified by:
getWfsConfiguration
in classWFSStrategy
- See Also:
getPostContents(WFSRequest)
-
getVersion
public String getVersion()
Description copied from class:Specification
Expected version attribute for root element.- Specified by:
getVersion
in classSpecification
- Returns:
- the version as a String
-
createGetCapabilitiesRequest
public GetCapabilitiesRequest createGetCapabilitiesRequest(URL server)
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
public void setConfig(WFSConfig config)
- Specified by:
setConfig
in classWFSStrategy
-
getConfig
public WFSConfig getConfig()
- Specified by:
getConfig
in classWFSStrategy
-
buildGetFeatureParametersForGET
protected Map<String,String> buildGetFeatureParametersForGET(GetFeatureRequest request)
-
encodeGetFeatureGetFilter
protected String encodeGetFeatureGetFilter(Filter filter) throws IOException
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
public abstract Version 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:
WFSStrategy.getServiceVersion()
-
supportsOperation
public boolean supportsOperation(WFSOperationType operation, HttpMethod method)
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:
WFSStrategy.supportsOperation(org.geotools.data.wfs.internal.WFSOperationType, org.geotools.data.wfs.internal.HttpMethod)
-
getOperationURL
public URL getOperationURL(WFSOperationType operation, HttpMethod method)
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:
WFSStrategy.getOperationURL(org.geotools.data.wfs.internal.WFSOperationType, org.geotools.data.wfs.internal.HttpMethod)
-
getOperationURI
protected abstract String getOperationURI(WFSOperationType operation, HttpMethod method)
-
getDefaultOutputFormat
public String getDefaultOutputFormat(WFSOperationType operation)
- 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:
WFSStrategy.dispose()
-
buildDescribeFeatureTypeParametersForGET
protected Map<String,String> buildDescribeFeatureTypeParametersForGET(DescribeFeatureTypeRequest request)
-
buildDescribeFeatureTypeParametersForGET
protected Map<String,String> buildDescribeFeatureTypeParametersForGET(Map<String,String> kvp, QName typeName)
-
buildDescribeStoredQueriesParametersForGET
protected Map<String,String> buildDescribeStoredQueriesParametersForGET(DescribeStoredQueriesRequest request)
-
buildListStoredQueriesParametersForGET
protected Map<String,String> buildListStoredQueriesParametersForGET(ListStoredQueriesRequest request)
-
prepareEncoder
protected Encoder prepareEncoder(WFSRequest request)
-
splitFilters
public Filter[] splitFilters(QName typeName, Filter filter)
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:
WFSStrategy.splitFilters(QName, Filter)
-
buildUrlGET
public URL buildUrlGET(WFSRequest request)
- Specified by:
buildUrlGET
in classWFSStrategy
-
getPostContentType
public String getPostContentType(WFSRequest wfsRequest)
- Specified by:
getPostContentType
in classWFSStrategy
-
getPostContents
public InputStream getPostContents(WFSRequest request) throws IOException
Returns the input stream with the POST body contents for the given request.- Specified by:
getPostContents
in classWFSStrategy
- Throws:
IOException
- See Also:
createDescribeFeatureTypeRequestPost(org.geotools.data.wfs.internal.DescribeFeatureTypeRequest)
,createGetFeatureRequestPost(org.geotools.data.wfs.internal.GetFeatureRequest)
,prepareEncoder(org.geotools.data.wfs.internal.WFSRequest)
,getOperationName(org.geotools.data.wfs.internal.WFSOperationType)
-
getFieldTypeMappings
public Map<QName,Class<?>> getFieldTypeMappings()
Description copied from class:WFSStrategy
Provide additional field type mappings- Specified by:
getFieldTypeMappings
in classWFSStrategy
- Returns:
- field type mappings
-
-