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 forWFSStrategyimplementations that leverage the GeoToolsxml-xsdsubsystem 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 WFSConfigconfigstatic ConfigurationFILTER_1_0_CONFIGURATIONstatic ConfigurationFILTER_1_1_CONFIGURATIONstatic ConfigurationFILTER_2_0_CONFIGURATIONprotected static LoggerLOGGERstatic ConfigurationWFS_1_0_CAPABILITIES_CONFIGURATIONstatic ConfigurationWFS_1_0_CONFIGURATIONstatic ConfigurationWFS_1_1_CONFIGURATIONstatic ConfigurationWFS_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)URLbuildUrlGET(WFSRequest request)protected abstract EObjectcreateDescribeFeatureTypeRequestPost(DescribeFeatureTypeRequest request)Creates the EMF object to be encoded with theWFS configurationwhen a DescribeFeatureType POST request is to be made.protected abstract EObjectcreateDescribeStoredQueriesRequestPost(DescribeStoredQueriesRequest request)GetCapabilitiesRequestcreateGetCapabilitiesRequest(URL server)Factory method to create GetCapabilities Requestprotected abstract EObjectcreateGetFeatureRequestPost(GetFeatureRequest query)Creates the EMF object to be encoded with theWFS configurationwhen a GetFeature POST request is to be made.protected abstract EObjectcreateListStoredQueriesRequestPost(ListStoredQueriesRequest request)protected abstract EObjectcreateTransactionRequest(TransactionRequest request)Creates 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)WFSConfiggetConfig()StringgetDefaultOutputFormat(WFSOperationType operation)Map<QName,Class<?>>getFieldTypeMappings()Provide additional field type mappingsprotected abstract ConfigurationgetFilterConfiguration()Returns 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)URLgetOperationURL(WFSOperationType operation, HttpMethod method)Returns the URL for the given operation name and HTTP protocol as stated in the WFS capabilities.InputStreamgetPostContents(WFSRequest request)Returns the input stream with the POST body contents for the given request.StringgetPostContentType(WFSRequest wfsRequest)protected StringgetPrefixedTypeName(QName qname)abstract VersiongetServiceVersion()Returns the WFS protocol version this facade talks to the WFS instance.StringgetVersion()Expected version attribute for root element.abstract ConfigurationgetWfsConfiguration()Returns the xml configuration used to encode all POST requests.protected EncoderprepareEncoder(WFSRequest request)voidsetConfig(WFSConfig config)protected Filtersimplify(Filter filter)Filter[]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 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 configurationwhen 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 configurationwhen 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 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
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:
getWfsConfigurationin classWFSStrategy- See Also:
getPostContents(WFSRequest)
-
getVersion
public String getVersion()
Description copied from class:SpecificationExpected version attribute for root element.- Specified by:
getVersionin classSpecification- Returns:
- the version as a String
-
createGetCapabilitiesRequest
public GetCapabilitiesRequest createGetCapabilitiesRequest(URL server)
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
public void setConfig(WFSConfig config)
- Specified by:
setConfigin classWFSStrategy
-
getConfig
public WFSConfig getConfig()
- Specified by:
getConfigin 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 theFILTERparameter in a GetFeature request.- Throws:
IOException
-
getServiceVersion
public abstract Version 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:
WFSStrategy.getServiceVersion()
-
supportsOperation
public boolean supportsOperation(WFSOperationType operation, HttpMethod method)
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:
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: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:
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:
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:
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:
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:
WFSStrategy.splitFilters(QName, Filter)
-
buildUrlGET
public URL buildUrlGET(WFSRequest request)
- Specified by:
buildUrlGETin classWFSStrategy
-
getPostContentType
public String getPostContentType(WFSRequest wfsRequest)
- Specified by:
getPostContentTypein classWFSStrategy
-
getPostContents
public InputStream getPostContents(WFSRequest request) throws IOException
Returns the input stream with the POST body contents for the given request.- Specified by:
getPostContentsin 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:WFSStrategyProvide additional field type mappings- Specified by:
getFieldTypeMappingsin classWFSStrategy- Returns:
- field type mappings
-
-