public class TLcdCSWClient extends Object
A new TLcdCSWClient
instance can be created by invoking one of the static factory methods.
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 TLcdCSWClient
instance is initialized, the following requests can be created:
createGetRecordsRequest()
To send requests to the server and receive the response, the following methods can be used:
getCapabilities()
getRecords(TLcdCSWGetRecordsRequest)
Upon initialization, TLcdCSWClient
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 TLcdCSWClient
instance that created them.
TLcdOWSHttpTransport
,
TLcdCSWGetRecordsRequest
Modifier and Type | Method and Description |
---|---|
static TLcdCSWClient |
createCSWClient(URI aURI)
Creates a new CSW client using the specified URI.
|
static TLcdCSWClient |
createCSWClient(URI aURI,
ILcdOWSTransport aTransport,
Object aTransportData)
Creates a new CSW client using the specified URI.
|
static TLcdCSWClient |
createCSWClient(URI aURI,
ILcdOWSTransport aTransport,
Object aTransportData,
Collection<TLcdDataModel> aUsedDataModels)
Creates a new CSW client using the specified URI.
|
TLcdCSWGetRecordsRequest |
createGetRecordsRequest()
Creates a GetRecords request initialized with the negotiated version of the current server.
|
TLcdCSWCapabilities |
getCapabilities()
Returns the capabilities of the connected CSW server.
|
TLcdCSWGetRecordsResponse |
getRecords(TLcdCSWGetRecordsRequest aRequest)
Sends the given GetRecords request to the server.
|
URI |
getURI()
Returns the URI of the CSW server.
|
public static TLcdCSWClient createCSWClient(URI aURI) throws TLcdOWSServerException, TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSUnsupportedVersionException
aURI
- the URI of the CSW serverNullPointerException
- if the URI is nullIllegalArgumentException
- if the specified URI is not compatible
with the default transportTLcdOWSServerException
- if the server returned an OpenGIS Web Service exceptionTLcdOWSDecodingException
- if an error
occurs while decoding the initial CSW responseTLcdOWSTransportException
- if an error
occurs in the transport layer while negotiation the versionTLcdOWSUnsupportedVersionException
- if the
specified CSW server does not support any of the CSW versions
implemented by this clientpublic static TLcdCSWClient createCSWClient(URI aURI, ILcdOWSTransport aTransport, Object aTransportData) throws TLcdOWSServerException, TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSUnsupportedVersionException
aURI
- the URI of the CSW 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 transportTLcdOWSServerException
- if the server returned an OpenGIS Web Service exceptionTLcdOWSDecodingException
- if an error occurs while decoding the
initial CSW responseTLcdOWSTransportException
- if an error occurs in the transport layer
while negotiation the versionTLcdOWSUnsupportedVersionException
- if the specified CSW server does
not support any of the CSW versions implemented by this
clientpublic static TLcdCSWClient createCSWClient(URI aURI, ILcdOWSTransport aTransport, Object aTransportData, Collection<TLcdDataModel> aUsedDataModels) throws TLcdOWSServerException, TLcdOWSDecodingException, TLcdOWSTransportException, TLcdOWSUnsupportedVersionException
aURI
- the URI of the CSW serveraTransport
- the transport to useaTransportData
- the transport data to use for the initial
capabilities requests (may be null)aUsedDataModels
- additional data models used by this client (such as AIXM, GML), or nullNullPointerException
- if either the URI or the transport is nullIllegalArgumentException
- if the specified URI is not compatible
with the specified transportTLcdOWSServerException
- if the server returned an OpenGIS Web Service exceptionTLcdOWSDecodingException
- if an error occurs while decoding the
initial CSW responseTLcdOWSTransportException
- if an error occurs in the transport layer
while negotiation the versionTLcdOWSUnsupportedVersionException
- if the specified CSW server does
not support any of the CSW 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 CSW server.public TLcdCSWGetRecordsRequest createGetRecordsRequest()
public TLcdCSWCapabilities getCapabilities()
public TLcdCSWGetRecordsResponse getRecords(TLcdCSWGetRecordsRequest aRequest) throws IOException, XMLStreamException
TLcdCSWGetRecordsRequest request = new TLcdCSWGetRecordsRequest("3.0.0");
TLcdCSWQuery query = new TLcdCSWQuery();
query.getTypeNames().add(TLcdCSWRecordType.CSW_300.getTypeName());
query.setElementSetName(TLcdCSWElementSetName.FULL);
request.setQuery(query);
TLcdCSWGetRecordsResponse records = client.getRecords(request);
aRequest
- the request to pass to the serverXMLStreamException
- if the decoding of the result failsIOException