Class WFSStrategy
- Object
-
- Specification
-
- WFSStrategy
-
- Direct Known Subclasses:
AbstractWFSStrategy
public abstract class WFSStrategy extends Specification
Facade interface to interact with a WFS instance.Implementations of this interface know how to send and get information back from a WFS service for a specific protocol version, but are not meant to provide any logic other than the conversation with the service. For instance,
WFSProtocol
implementations are not required to transformfilters
to something appropriate for the service capabilities, nor any other control logic than creating and sending the requests mapping what is given to the operation methods.This interface provides enough information extracted or derived from the WFS capabilities document as for the client code to issue requests appropriate for the server capabilities.
-
-
Constructor Summary
Constructors Constructor Description WFSStrategy()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract URL
buildUrlGET(WFSRequest request)
boolean
canLimit()
boolean
canOffset()
Indicates whether the server supports adjusting the starting position of the result set.abstract void
dispose()
Allows to free any resource held.abstract List<String>
getClientSupportedOutputFormats(WFSOperationType operation)
abstract WFSConfig
getConfig()
abstract String
getDefaultOutputFormat(WFSOperationType operation)
abstract FeatureTypeInfo
getFeatureTypeInfo(QName typeName)
Returns the feature type metadata object parsed from the capabilities document for the giventypeName
abstract Set<QName>
getFeatureTypeNames()
Returns the set of type names as extracted from the capabilities document, including the namespace and prefix.abstract Map<QName,Class<?>>
getFieldTypeMappings()
Provide additional field type mappingsabstract FilterCapabilities
getFilterCapabilities()
Returns the parsed version of the FilterCapabilities section in the capabilities documentabstract URL
getOperationURL(WFSOperationType operation, HttpMethod method)
Returns the URL for the given operation name and HTTP protocol as stated in the WFS capabilities.abstract InputStream
getPostContents(WFSRequest wfsRequest)
Returns the input stream with the POST body contents for the given request.abstract String
getPostContentType(WFSRequest wfsRequest)
abstract Set<String>
getServerSupportedOutputFormats(QName typeName, WFSOperationType operation)
abstract Set<String>
getServerSupportedOutputFormats(WFSOperationType operation)
abstract WFSServiceInfo
getServiceInfo()
abstract Version
getServiceVersion()
Returns the WFS protocol version this facade talks to the WFS instance.abstract Set<String>
getSupportedCRSIdentifiers(QName typeName)
Returns the union of the default CRS and the other supported CRS's of the given feature type as declared in the corresponding FeatureType element in the capabilities document, as well as any globally supported CRS identifier declared as a parameter of the GetFeature oepration in the capabilities document.abstract Configuration
getWfsConfiguration()
String
newRequestHandle(WFSOperationType operation)
abstract void
setCapabilities(WFSGetCapabilities capabilities)
abstract void
setConfig(WFSConfig config)
abstract Filter[]
splitFilters(QName typeName, Filter filter)
Splits the filter provided by the geotools query into the server supported and unsupported ones.abstract boolean
supports(GetFeatureRequest.ResultType resultType)
abstract boolean
supportsOperation(WFSOperationType operation, HttpMethod method)
Returns whether the service supports the given operation for the given HTTP method.abstract boolean
supportsTransaction(QName typeName)
-
Methods inherited from class Specification
createGetCapabilitiesRequest, getVersion
-
-
-
-
Method Detail
-
setCapabilities
public abstract void setCapabilities(WFSGetCapabilities capabilities)
-
setConfig
public abstract void setConfig(WFSConfig config)
-
getFeatureTypeInfo
public abstract FeatureTypeInfo getFeatureTypeInfo(QName typeName)
Returns the feature type metadata object parsed from the capabilities document for the giventypeName
- Parameters:
typeName
- the typeName as stated in the capabilitiesFeatureTypeList
to get the info for- Returns:
- the WFS capabilities metadata for
typeName
- Throws:
IllegalArgumentException
- iftypeName
is not the name of a FeatureType stated in the capabilities document.
-
getConfig
public abstract WFSConfig getConfig()
-
getServiceVersion
public abstract Version getServiceVersion()
Returns the WFS protocol version this facade talks to the WFS instance.- Returns:
- the protocol version in use by this facade
-
getServerSupportedOutputFormats
public abstract Set<String> getServerSupportedOutputFormats(WFSOperationType operation)
- Returns:
- the output formats the server advertises for the given operation;
-
getServerSupportedOutputFormats
public abstract Set<String> getServerSupportedOutputFormats(QName typeName, WFSOperationType operation)
- Parameters:
typeName
- the feature type name for which to return the supported output formats- Returns:
- the output formats the server supports for the given type name and operation
-
getClientSupportedOutputFormats
public abstract List<String> getClientSupportedOutputFormats(WFSOperationType operation)
- Returns:
- the list of output formats supported by the client for the given operation, in preferred order.
-
getFeatureTypeNames
public abstract Set<QName> getFeatureTypeNames()
Returns the set of type names as extracted from the capabilities document, including the namespace and prefix.- Returns:
- the set of feature type names as extracted from the capabilities document
-
getFilterCapabilities
public abstract FilterCapabilities getFilterCapabilities()
Returns the parsed version of the FilterCapabilities section in the capabilities document- Returns:
- a
FilterCapabilities
out of the FilterCapabilities section in the getcapabilities document
-
splitFilters
public abstract Filter[] splitFilters(QName typeName, Filter filter)
Splits the filter provided by the geotools query into the server supported and unsupported ones.- Returns:
- a two-element array where the first element is the supported filter and the second the one to post-process
-
supportsOperation
public abstract boolean supportsOperation(WFSOperationType operation, HttpMethod method)
Returns whether the service supports the given operation for the given HTTP method.- 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
-
supports
public abstract boolean supports(GetFeatureRequest.ResultType resultType)
-
supportsTransaction
public abstract boolean supportsTransaction(QName typeName)
-
getOperationURL
public abstract URL getOperationURL(WFSOperationType operation, HttpMethod method)
Returns the URL for the given operation name and HTTP protocol as stated in the WFS capabilities.- 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:
supportsOperation(WFSOperationType, HttpMethod)
-
getSupportedCRSIdentifiers
public abstract Set<String> getSupportedCRSIdentifiers(QName typeName)
Returns the union of the default CRS and the other supported CRS's of the given feature type as declared in the corresponding FeatureType element in the capabilities document, as well as any globally supported CRS identifier declared as a parameter of the GetFeature oepration in the capabilities document.- Parameters:
typeName
- the featuretype name as declared in the FeatureType/Name element of the WFS capabilities- Returns:
- the list of supported CRS identifiers for the given feature type
-
dispose
public abstract void dispose()
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.
-
getDefaultOutputFormat
public abstract String getDefaultOutputFormat(WFSOperationType operation)
-
buildUrlGET
public abstract URL buildUrlGET(WFSRequest request)
-
getPostContentType
public abstract String getPostContentType(WFSRequest wfsRequest)
-
getPostContents
public abstract InputStream getPostContents(WFSRequest wfsRequest) throws IOException
Returns the input stream with the POST body contents for the given request.- Throws:
IOException
-
getServiceInfo
public abstract WFSServiceInfo getServiceInfo()
-
getWfsConfiguration
public abstract Configuration getWfsConfiguration()
-
newRequestHandle
public String newRequestHandle(WFSOperationType operation)
-
getFieldTypeMappings
public abstract Map<QName,Class<?>> getFieldTypeMappings()
Provide additional field type mappings- Returns:
- field type mappings
-
canLimit
public boolean canLimit()
- Returns:
-
canOffset
public boolean canOffset()
Indicates whether the server supports adjusting the starting position of the result set. Defaults to false, as not all servers provide support for paging.- Returns:
- true if the server supports setting an offset for the results, otherwise false
-
-