public class TLcdWFSClient extends Object
TLcdWFSClient
class represents a client interface to an OpenGIS WFS server.
The supported WFS versions are 1.0.0, 1.1.0 and 2.0.0.
A new TLcdWFSClient
instance can be created by invoking
one of the static factory methods, given a URI of the server or an
TLcdWFSCapabilities
object representing the server's capabilities.
To customize the communication between client and server, an ILcdOWSTransport
can optionally be provided. This interface represents the transport layer, and can be used
to choose the communication protocol (HTTP GET, HTTP POST, ...), add authentication,
or configure any other parameter that relates to the communication channel. By default,
an instance of TLcdOWSHttpTransport
is used.
Once a TLcdWFSClient
instance is initialized, the following requests can be created:
createGetCapabilitiesRequest()
createGetFeatureRequest()
createDescribeFeatureTypeRequest()
createLockFeatureRequest()
createGetFeatureWithLockRequest()
createTransactionRequest()
To send requests to the server and receive the response, the following methods can be used:
getCachedCapabilities()
or getCapabilities(TLcdWFSGetCapabilitiesRequest)
getFeature(TLcdWFSGetFeatureRequest)
describeFeatureType(TLcdWFSDescribeFeatureTypeRequest)
lockFeature(TLcdWFSLockFeatureRequest)
getFeatureWithLock(TLcdWFSGetFeatureWithLockRequest)
transaction(TLcdWFSTransactionRequest)
Upon initialization, TLcdWFSClient
automatically performs a version negotiation process
with the server to agree on the version number. All created requests are initialized with the agreed
version number, and should therefore only be used by the TLcdWFSClient
instance that created them.
Modifier | Constructor and Description |
---|---|
protected |
TLcdWFSClient(TLcdWFSCapabilities aCapabilities,
ILcdOWSTransport aTransport)
Creates a new
TLcdWFSClient with the given parameters. |
protected |
TLcdWFSClient(URI aURI,
ILcdOWSTransport aTransport,
Object aTransportData)
Creates a new
TLcdWFSClient with the given parameters. |
Modifier and Type | Method and Description |
---|---|
TLcdWFSDescribeFeatureTypeRequest |
createDescribeFeatureTypeRequest()
Creates a new 'DescribeFeatureType' request object which is compatible with the WFS version implemented by the WFS
server this client communicates with.
|
TLcdWFSGetCapabilitiesRequest |
createGetCapabilitiesRequest()
Creates a new 'GetCapabilities' request object which is compatible with the WFS version implemented by the WFS
server this client communicates with.
|
TLcdWFSGetFeatureRequest |
createGetFeatureRequest()
Creates a new 'GetFeature' request object which is compatible with the WFS version implemented by the WFS server
this client communicates with.
|
TLcdWFSGetFeatureWithLockRequest |
createGetFeatureWithLockRequest()
Creates a new 'GetFeatureWithLock' request object which is compatible with the WFS version implemented by the WFS server
this client communicates with.
|
TLcdWFSLockFeatureRequest |
createLockFeatureRequest()
Creates a new 'LockFeature' request object which is compatible with the WFS version implemented by the WFS server
this client communicates with.
|
TLcdWFSTransactionRequest |
createTransactionRequest()
Creates a new 'Transaction' request object which is compatible with the WFS version implemented by the WFS server
this client communicates with.
|
static TLcdWFSClient |
createWFSClient(TLcdWFSCapabilities aCapabilities,
ILcdOWSTransport aTransport)
Creates a new WFS client using the specified capabilities.
|
static TLcdWFSClient |
createWFSClient(URI aURI)
Creates a new WFS client using the specified URI.
|
static TLcdWFSClient |
createWFSClient(URI aURI,
ILcdOWSTransport aTransport,
Object aTransportData)
Creates a new WFS client using the specified URI.
|
protected List |
decodeOperations(TLcdWFSCapabilities aCapabilities)
Returns a list of
TLcdOWSOperation instances based on the contents of the provided
TLcdWFSCapabilities instance. |
TLcdOWSInputStream |
describeFeatureType(TLcdWFSDescribeFeatureTypeRequest aRequest)
Performs the 'DescribeFeatureType' request.
|
TLcdWFSCapabilities |
getCachedCapabilities()
Returns the most recent capabilities object that was requested by this client.
|
TLcdWFSCapabilities |
getCapabilities(TLcdWFSGetCapabilitiesRequest aRequest)
Performs the 'GetCapabilities' request.
|
TLcdOWSInputStream |
getFeature(TLcdWFSGetFeatureRequest aRequest)
Performs the 'GetFeature' request.
|
TLcdOWSInputStream |
getFeatureWithLock(TLcdWFSGetFeatureWithLockRequest aRequest)
Performs the 'GetFeatureWithLock' request.
|
protected TLcdOWSOperation |
getOperation(String aOperationName)
Retrieves an operation based on the operation name.
|
URI |
getURI()
Returns the URI of the WFS server.
|
TLcdWFSLockFeatureResponse |
lockFeature(TLcdWFSLockFeatureRequest aRequest)
Performs the 'LockFeature' request.
|
protected TLcdOWSInputStream |
performRequest(String aOperationName,
ILcdOWSRequest aRequest)
Performs a WFS request.
|
String |
toString() |
TLcdWFSTransactionResponse |
transaction(TLcdWFSTransactionRequest aRequest)
Performs the 'Transaction' request.
|
protected TLcdWFSClient(TLcdWFSCapabilities aCapabilities, ILcdOWSTransport aTransport) throws TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSServerException, TLcdOWSUnsupportedVersionException
TLcdWFSClient
with the given parameters.aCapabilities
- the capabilities of the WFS serveraTransport
- the transport to useTLcdOWSDecodingException
- if an error occurs while decoding the initial WFS responseTLcdOWSServerException
- if an exception report is received from the serverTLcdOWSTransportException
- if an error occurs in the transport layer while negotiation the versionTLcdOWSUnsupportedVersionException
- if the specified WFS server does not support any of the WFS versions
implemented by this clientprotected TLcdWFSClient(URI aURI, ILcdOWSTransport aTransport, Object aTransportData) throws TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSServerException, TLcdOWSUnsupportedVersionException
TLcdWFSClient
with the given parameters.aURI
- the URI of the WFS serveraTransport
- the transport to useaTransportData
- the transport data to use for the initial capabilities requests (may be null)IllegalArgumentException
- if the specified URI is not compatible with the specified transportTLcdOWSDecodingException
- if an error occurs while decoding the initial WFS responseTLcdOWSServerException
- if an exception report is received from the serverTLcdOWSTransportException
- if an error occurs in the transport layer while negotiation the versionTLcdOWSUnsupportedVersionException
- if the specified WFS server does not support any of the WFS versions
implemented by this clientpublic static TLcdWFSClient createWFSClient(URI aURI) throws TLcdOWSTransportException, TLcdOWSServerException, TLcdOWSDecodingException, TLcdOWSUnsupportedVersionException
aURI
- the URI of the WFS serverNullPointerException
- if the URI is nullIllegalArgumentException
- if the specified URI is not compatible with the default transportTLcdOWSDecodingException
- if an error occurs while decoding the intial WFS responseTLcdOWSServerException
- if an exception report is received from the serverTLcdOWSTransportException
- if an error occurs in the transport layer while negotiation the versionTLcdOWSUnsupportedVersionException
- if the specified WFS server does not support any of the WFS versions
implemented by this clientcreateWFSClient(java.net.URI, ILcdOWSTransport, Object)
public static TLcdWFSClient createWFSClient(TLcdWFSCapabilities aCapabilities, ILcdOWSTransport aTransport) throws TLcdOWSUnsupportedVersionException, TLcdOWSDecodingException, TLcdOWSServerException, TLcdOWSTransportException
aCapabilities
- the capabilities of the WFS serveraTransport
- the transport to useNullPointerException
- if either the capabilities or the transport is nullTLcdOWSDecodingException
- if an error occurs while decoding the intial WFS responseTLcdOWSServerException
- if an exception report is received from the serverTLcdOWSTransportException
- if an error occurs in the transport layer while negotiation the versionTLcdOWSUnsupportedVersionException
- if the specified WFS server does not support any of the WFS versions
implemented by this clientpublic static TLcdWFSClient createWFSClient(URI aURI, ILcdOWSTransport aTransport, Object aTransportData) throws TLcdOWSUnsupportedVersionException, TLcdOWSDecodingException, TLcdOWSServerException, TLcdOWSTransportException
aURI
- the URI of the WFS serveraTransport
- the transport to useaTransportData
- the transport data to use for the initial capabilities requests (may be null)NullPointerException
- if either the URI or the transport is nullIllegalArgumentException
- if the specified URI is not compatible with the specified transportTLcdOWSDecodingException
- if an error occurs while decoding the intial WFS responseTLcdOWSServerException
- if an exception report is received from the serverTLcdOWSTransportException
- if an error occurs in the transport layer while negotiation the versionTLcdOWSUnsupportedVersionException
- if the specified WFS server does not support any of the WFS versions
implemented by this clientpublic URI getURI()
GetCapabilities
request, the address associated
with this request is used. If the GET request method is supported, the corresponding address is used;
otherwise, it is assumed that the POST request method is supported and the corresponding address is used;
if this check also fails, null
is returned and the client will not be able to connect with
the WFS server.protected final TLcdOWSOperation getOperation(String aOperationName)
aOperationName
- the name of the operationprotected List decodeOperations(TLcdWFSCapabilities aCapabilities)
TLcdOWSOperation
instances based on the contents of the provided
TLcdWFSCapabilities
instance. By default, this method will return a list of operations
that are read from the 'Capability/Request' section of the WFS capabilities object.aCapabilities
- the capabilities from which to derive the list of operationspublic TLcdWFSGetCapabilitiesRequest createGetCapabilitiesRequest()
public TLcdWFSDescribeFeatureTypeRequest createDescribeFeatureTypeRequest()
public TLcdWFSGetFeatureRequest createGetFeatureRequest()
public TLcdWFSTransactionRequest createTransactionRequest()
public TLcdWFSLockFeatureRequest createLockFeatureRequest()
public TLcdWFSGetFeatureWithLockRequest createGetFeatureWithLockRequest()
public TLcdWFSCapabilities getCachedCapabilities()
getCapabilities(TLcdWFSGetCapabilitiesRequest)
is
called.public TLcdWFSCapabilities getCapabilities(TLcdWFSGetCapabilitiesRequest aRequest) throws TLcdOWSServerException, TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSUnsupportedVersionException
aRequest
- the request object containing the parameters to pass to the WFS serverTLcdOWSServerException
- if the server returned an OpenGIS Web Service exceptionTLcdOWSDecodingException
- if an error occurred while decoding the 'GetCapabilities' responseTLcdOWSTransportException
- if an error occurred in the transport while accessing the web serviceTLcdOWSUnsupportedVersionException
- if the server only supports WFS specification versions that are not supported by this clientpublic TLcdOWSInputStream describeFeatureType(TLcdWFSDescribeFeatureTypeRequest aRequest) throws TLcdOWSServerException, TLcdOWSDecodingException, TLcdOWSTransportException
aRequest
- the request object containing the parameters to pass to the WFS serverTLcdOWSServerException
- if the server returned an OpenGIS Web Service exceptionTLcdOWSDecodingException
- if an error occurred while decoding the 'DescribeFeatureType' responseTLcdOWSTransportException
- if an error occurred in the transport while accessing the web servicepublic TLcdOWSInputStream getFeature(TLcdWFSGetFeatureRequest aRequest) throws TLcdOWSServerException, TLcdOWSDecodingException, TLcdOWSTransportException
If GML is used as exchange format (default), the returned stream can be decoded into an ILcdModel
using a TLcdWFSModelDecoderDecorator
. Next to supporting the GML output from a WFS,
this class also supports the handling of service exception reports.
aRequest
- the request object containing the parameters to pass to the WFS serverTLcdOWSServerException
- if the server returned an OpenGIS Web Service exceptionTLcdOWSDecodingException
- if an error occurred while decoding the 'GetFeature' responseTLcdOWSTransportException
- if an error occurred in the transport while accessing the web serviceTLcdWFSModelDecoderDecorator
public TLcdOWSInputStream getFeatureWithLock(TLcdWFSGetFeatureWithLockRequest aRequest) throws TLcdOWSServerException, TLcdOWSDecodingException, TLcdOWSTransportException
If GML is used as exchange format (default), the returned stream can be decoded into an ILcdModel
using a TLcdWFSModelDecoderDecorator
. Next to supporting the GML output from a WFS,
this class also supports the handling of service exception reports.
aRequest
- the request object containing the parameters to pass to the WFS serverTLcdOWSServerException
- if the server returned an OpenGIS Web Service exceptionTLcdOWSDecodingException
- if an error occurred while decoding the 'GetFeature' responseTLcdOWSTransportException
- if an error occurred in the transport while accessing the web serviceTLcdWFSModelDecoderDecorator
public TLcdWFSLockFeatureResponse lockFeature(TLcdWFSLockFeatureRequest aRequest) throws TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSServerException
aRequest
- the request object containing the parameters to pass to the WFS serverTLcdWFSLockFeatureResponse
containing the response from the server.TLcdOWSServerException
- if the server returned an OpenGIS Web Service exceptionTLcdOWSDecodingException
- if an error occurred while decoding the 'LockFeature' responseTLcdOWSTransportException
- if an error occurred in the transport while accessing the web servicepublic TLcdWFSTransactionResponse transaction(TLcdWFSTransactionRequest aRequest) throws TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSServerException
aRequest
- the request object containing the parameters to pass to the WFS serverTLcdWFSTransactionResponse
containing the response from the server.TLcdOWSServerException
- if the server returned an OpenGIS Web Service exceptionTLcdOWSDecodingException
- if an error occurred while decoding the 'Transaction' responseTLcdOWSTransportException
- if an error occurred in the transport while accessing the web serviceprotected final TLcdOWSInputStream performRequest(String aOperationName, ILcdOWSRequest aRequest) throws TLcdOWSTransportException, TLcdOWSServerException, TLcdOWSDecodingException
aOperationName
- the name of the operation to invokeaRequest
- the request object that should be sentTLcdOWSServerException
- if the server returned an OpenGIS Web Service exceptionTLcdOWSDecodingException
- if an error occurred while decoding the processing the responseTLcdOWSTransportException
- if an error occurred in the transport while accessing the web service