public class TLcdWMSClient extends Object
TLcdWMSClient
class represents a client interface to an OpenGIS WMS server.
The supported WMS versions are 1.1.0, 1.1.1 and 1.3.0.
A new TLcdWMSClient
instance can be created by invoking
one of the static factory methods, given a URI of the server or an
ALcdOGCWMSCapabilities
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 TLcdWMSClient
instance is initialized, the following requests can be created:
createGetCapabilitiesRequest()
createGetMapRequest()
createGetFeatureInfoRequest()
createDescribeLayerRequest()
createGetLegendGraphicRequest()
To send requests to the server and receive the response, the following methods can be used:
getCachedCapabilities()
or getCapabilities(TLcdWMSGetCapabilitiesRequest)
getMap(TLcdWMSGetMapRequest)
getFeatureInfo(TLcdWMSGetFeatureInfoRequest)
describeLayer(TLcdWMSDescribeLayerRequest)
getLegendGraphic(TLcdWMSGetLegendGraphicRequest)
Upon initialization, TLcdWMSClient
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 TLcdWMSClient
instance that created them.
Modifier | Constructor and Description |
---|---|
protected |
TLcdWMSClient(ALcdOGCWMSCapabilities aCapabilities,
ILcdOWSTransport aTransport)
Creates a new
TLcdWMSClient with the given parameters. |
protected |
TLcdWMSClient(URI aURI,
ILcdOWSTransport aTransport,
Object aTransportData)
Creates a new
TLcdWMSClient with the given parameters. |
Modifier and Type | Method and Description |
---|---|
TLcdWMSDescribeLayerRequest |
createDescribeLayerRequest()
Creates a new 'DescribeLayer' request object which is compatible with the WMS version
implemented by the WMS server this client communicates with.
|
TLcdWMSGetCapabilitiesRequest |
createGetCapabilitiesRequest()
Creates a new 'GetCapabilities' request object which is compatible with the WMS version
implemented by the WMS server this client communicates with.
|
TLcdWMSGetFeatureInfoRequest |
createGetFeatureInfoRequest()
Creates a new 'GetFeatureInfo' request object which is compatible with the WMS version
implemented by the WMS server this client communicates with.
|
TLcdWMSGetLegendGraphicRequest |
createGetLegendGraphicRequest()
Creates a new 'GetLegendGraphic' request object which is compatible with the WMS version
implemented by the WMS server this client communicates with.
|
TLcdWMSGetMapRequest |
createGetMapRequest()
Creates a new 'GetMap' request object which is compatible with the WMS version implemented by
the WMS server this client communicates with.
|
static TLcdWMSClient |
createWMSClient(ALcdOGCWMSCapabilities aCapabilities,
ILcdOWSTransport aTransport)
Creates a new WMS client using the specified capabilities.
|
static TLcdWMSClient |
createWMSClient(URI aURI)
Creates a new WMS client using the specified URI.
|
static TLcdWMSClient |
createWMSClient(URI aURI,
ILcdOWSTransport aTransport,
Object aTransportData)
Creates a new WMS client using the specified URI.
|
protected List |
decodeOperations(ALcdOGCWMSCapabilities aCapabilities)
Returns a list of
TLcdOWSOperation instances based on the contents of the provided
ALcdOGCWMSCapabilities instance. |
TLcdOWSInputStream |
describeLayer(TLcdWMSDescribeLayerRequest aRequest)
Performs the 'DescribeLayer' request.
|
ALcdOGCWMSCapabilities |
getCachedCapabilities()
Returns the most recent capabilities object that was requested by this client.
|
ALcdOGCWMSCapabilities |
getCapabilities(TLcdWMSGetCapabilitiesRequest aRequest)
Performs the 'GetCapabilities' request.
|
TLcdOWSInputStream |
getFeatureInfo(TLcdWMSGetFeatureInfoRequest aRequest)
Performs the 'GetFeatureInfo' request.
|
TLcdOWSInputStream |
getLegendGraphic(TLcdWMSGetLegendGraphicRequest aRequest)
Performs the 'GetLegendGraphic' request.
|
TLcdOWSInputStream |
getMap(TLcdWMSGetMapRequest aRequest)
Performs the 'GetMap' request.
|
protected TLcdOWSOperation |
getOperation(String aOperationName)
Retrieves an operation based on the operation name.
|
URI |
getURI()
Returns the URI of the WMS server.
|
protected TLcdOWSInputStream |
performRequest(String aOperationName,
ILcdOWSRequest aRequest)
Performs a WMS request.
|
protected TLcdWMSClient(ALcdOGCWMSCapabilities aCapabilities, ILcdOWSTransport aTransport) throws TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSUnsupportedVersionException
TLcdWMSClient
with the given parameters.aCapabilities
- the capabilities of the WMS serveraTransport
- the transport to useTLcdOWSDecodingException
- if an error occurs while decoding the initial WMS responseTLcdOWSTransportException
- if an error occurs in the transport layer while negotiation
the versionTLcdOWSUnsupportedVersionException
- if the specified WMS server does not support any of the
WMS versions implemented by this clientprotected TLcdWMSClient(URI aURI, ILcdOWSTransport aTransport, Object aTransportData) throws TLcdOWSTransportException, TLcdOWSDecodingException, TLcdOWSUnsupportedVersionException, TLcdOWSServerException
TLcdWMSClient
with the given parameters.aURI
- the URI of the WMS 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 WMS responseTLcdOWSUnsupportedVersionException
- if the specified WMS server does not support any of the the
WMS versions implemented by this clientTLcdOWSTransportException
- if an error occurred in the transportation layerTLcdOWSServerException
- if the server returned a WMS service exceptionpublic static TLcdWMSClient createWMSClient(URI aURI) throws TLcdOWSServerException, TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSUnsupportedVersionException
aURI
- the URI of the WMS serverNullPointerException
- if the URI is nullIllegalArgumentException
- if the specified URI is not compatible with the default
transportTLcdOWSDecodingException
- if an error occurs while decoding the initial WMS responseTLcdOWSTransportException
- if an error occurs in the transport layer while negotiation
the versionTLcdOWSUnsupportedVersionException
- if the specified WMS server does not support any of the the
WMS versions implemented by this clientTLcdOWSServerException
public static TLcdWMSClient createWMSClient(ALcdOGCWMSCapabilities aCapabilities, ILcdOWSTransport aTransport) throws TLcdOWSUnsupportedVersionException, TLcdOWSDecodingException, TLcdOWSTransportException
aCapabilities
- the capabilities of the WMS server; both the version
(ALcdOGCWMSCapabilities#getVersion
) and the URL of the GET
access point of the GetCapabilities request (ALcdOGCWMSCapabilities#getOperationsMetadata()#getOperationByName("GetCapabilities").getDCP(0).getHTTP().getGet(0).getHref()
)
need to be filled in.aTransport
- the transport to useNullPointerException
- if either the capabilities or the transport is nullTLcdOWSDecodingException
- if an error occurs while decoding the initial WMS responseTLcdOWSTransportException
- if an error occurs in the transport layer while negotiation
the versionTLcdOWSUnsupportedVersionException
- if the specified WMS server does not support any of the the
WMS versions implemented by this clientpublic static TLcdWMSClient createWMSClient(URI aURI, ILcdOWSTransport aTransport, Object aTransportData) throws TLcdOWSServerException, TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSUnsupportedVersionException
aURI
- the URI of the WMS 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 initial WMS responseTLcdOWSTransportException
- if an error occurs in the transport layer while negotiation
the versionTLcdOWSUnsupportedVersionException
- if the specified WMS server does not support any of the the
WMS versions implemented by this clientTLcdOWSServerException
TLcdOGCWMSProxyModelDecoder.setEntityLocation(String, java.net.URL)
public 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
WMS server.public ALcdOGCWMSCapabilities getCachedCapabilities()
getCapabilities(TLcdWMSGetCapabilitiesRequest)
is called.public ALcdOGCWMSCapabilities getCapabilities(TLcdWMSGetCapabilitiesRequest aRequest) throws TLcdOWSTransportException, TLcdOWSServerException, TLcdOWSDecodingException, TLcdOWSUnsupportedVersionException
aRequest
- the request object containing the parameters to pass to the WMS serverTLcdOWSDecodingException
- 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 WMS specification versions that
are not supported by this clientTLcdOWSServerException
- if the server returned a service exceptionpublic TLcdOWSInputStream getMap(TLcdWMSGetMapRequest aRequest) throws TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSServerException
aRequest
- the request object containing the parameters to pass to the WMS serverTLcdOWSDecodingException
- if an error occurred while decoding the 'GetMap' responseTLcdOWSTransportException
- if an error occurred in the transport while accessing the web serviceTLcdOWSServerException
- if the server returned a service exceptionpublic TLcdOWSInputStream getFeatureInfo(TLcdWMSGetFeatureInfoRequest aRequest) throws TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSServerException
aRequest
- the request object containing the parameters to pass to the WMS serverTLcdOWSDecodingException
- if an error occurred while decoding the 'GetFeatureInfo' responseTLcdOWSTransportException
- if an error occurred in the transport while accessing the web serviceTLcdOWSServerException
- if the server returned a service exceptionpublic TLcdOWSInputStream getLegendGraphic(TLcdWMSGetLegendGraphicRequest aRequest) throws TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSServerException
aRequest
- the request object containing the parameters to pass to the WMS serverTLcdOWSDecodingException
- if an error occurred while decoding the 'GetLegendGraphic' responseTLcdOWSTransportException
- if an error occurred in the transport while accessing the web serviceTLcdOWSServerException
- if the server returned a service exceptionpublic TLcdOWSInputStream describeLayer(TLcdWMSDescribeLayerRequest aRequest) throws TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSServerException
aRequest
- the request object containing the parameters to pass to the WMS serverTLcdOWSDecodingException
- if an error occurred while decoding the 'DescribeLayer' responseTLcdOWSTransportException
- if an error occurred in the transport while accessing the web serviceTLcdOWSServerException
- if the server returned a service exceptionprotected final TLcdOWSOperation getOperation(String aOperationName)
aOperationName
- the name of the operationprotected final TLcdOWSInputStream performRequest(String aOperationName, ILcdOWSRequest aRequest) throws TLcdOWSTransportException, TLcdOWSDecodingException, TLcdOWSServerException
aOperationName
- the name of the operation to invokeaRequest
- the request object that should be sentTLcdOWSTransportException
- if an error occurred in the transport while accessing the
web serviceTLcdOWSServerException
- if the server returned a WMS Service exceptionTLcdOWSDecodingException
- if a decoding error occurred while performing the requestprotected List decodeOperations(ALcdOGCWMSCapabilities aCapabilities)
TLcdOWSOperation
instances based on the contents of the provided
ALcdOGCWMSCapabilities
instance. By default, this method will return a list of operations
that are read from the 'Capability/Request' section of the WMS capabilities object.aCapabilities
- the capabilities from which to derive the list of operationspublic TLcdWMSGetMapRequest createGetMapRequest()
public TLcdWMSGetFeatureInfoRequest createGetFeatureInfoRequest()
public TLcdWMSGetCapabilitiesRequest createGetCapabilitiesRequest()
public TLcdWMSDescribeLayerRequest createDescribeLayerRequest()
public TLcdWMSGetLegendGraphicRequest createGetLegendGraphicRequest()