public abstract class AbstractOpenWebService<C extends Capabilities,R> extends Object
This class provides version negotiation, Capabilities document retrieval, and a request/response infrastructure. Implementing subclasses need to provide their own Specifications (representing versions of the OWS to be implemented) and their own request/response instances.
Modifier and Type | Field and Description |
---|---|
protected C |
capabilities |
protected Map<String,Object> |
hints
Hints, now used for the XML parsing *
|
protected ServiceInfo |
info |
protected static Logger |
LOGGER |
protected Map<R,ResourceInfo> |
resourceInfo |
protected URL |
serverURL |
protected Specification |
specification |
protected Specification[] |
specs
Contains the specifications that are to be used with this service
|
Constructor and Description |
---|
AbstractOpenWebService(C capabilties,
URL serverURL)
Deprecated.
use
#AbstractOpenWebService(OWSConfig, Capabilities) |
AbstractOpenWebService(URL serverURL)
Set up the specifications used and retrieve the Capabilities document given by serverURL.
|
AbstractOpenWebService(URL serverURL,
HTTPClient httpClient,
C capabilities) |
AbstractOpenWebService(URL serverURL,
HTTPClient httpClient,
C capabilities,
Map<String,Object> hints) |
AbstractOpenWebService(URL serverURL,
int requestTimeout)
Deprecated.
use
#AbstractOpenWebService(OWSConfig) |
Modifier and Type | Method and Description |
---|---|
protected abstract ServiceInfo |
createInfo()
Implemented by a subclass to describe service
|
protected abstract ResourceInfo |
createInfo(R resource) |
abstract C |
getCapabilities()
Get the getCapabilities document.
|
Map<String,Object> |
getHints()
Returns the hints affecting the service operations
|
HTTPClient |
getHTTPClient() |
ServiceInfo |
getInfo()
Description of this service.
|
ResourceInfo |
getInfo(R resource) |
protected Response |
internalIssueRequest(Request request)
Issues a request to the server and returns that server's response.
|
GetCapabilitiesResponse |
issueRequest(GetCapabilitiesRequest request) |
protected C |
negotiateVersion()
Version number negotiation occurs as follows (credit OGC):
1) If the server implements the requested version number, the server shall send
that version.
|
void |
setHints(Map<String,Object> hints)
Sets the hints affecting the service operations
|
void |
setHttpClient(HTTPClient httpClient) |
void |
setLoggingLevel(Level newLevel) |
protected abstract void |
setupSpecifications()
Sets up the specifications/versions that this server is capable of communicating with.
|
protected final URL serverURL
protected C extends Capabilities capabilities
protected ServiceInfo info
protected Map<R,ResourceInfo> resourceInfo
protected Specification[] specs
protected Specification specification
protected static final Logger LOGGER
public AbstractOpenWebService(URL serverURL) throws IOException, ServiceException
serverURL
- a URL that points to the capabilities document of a serverIOException
- if there is an error communicating with the serverServiceException
- if the server responds with an errorpublic AbstractOpenWebService(URL serverURL, int requestTimeout) throws IOException, ServiceException
#AbstractOpenWebService(OWSConfig)
IOException
ServiceException
public AbstractOpenWebService(C capabilties, URL serverURL) throws ServiceException, IOException
#AbstractOpenWebService(OWSConfig, Capabilities)
ServiceException
IOException
public AbstractOpenWebService(URL serverURL, HTTPClient httpClient, C capabilities) throws ServiceException, IOException
ServiceException
IOException
public AbstractOpenWebService(URL serverURL, HTTPClient httpClient, C capabilities, Map<String,Object> hints) throws ServiceException, IOException
ServiceException
IOException
public void setHttpClient(HTTPClient httpClient)
public HTTPClient getHTTPClient()
public abstract C getCapabilities()
public ServiceInfo getInfo()
Provides a very quick description of the service, for more information please review the capabilitie document.
protected abstract ServiceInfo createInfo()
public ResourceInfo getInfo(R resource)
protected abstract ResourceInfo createInfo(R resource)
protected abstract void setupSpecifications()
protected C negotiateVersion() throws IOException, ServiceException
The OGC tells us to repeat this process (or give up). This means we are actually going to come up with a bit of setup cost in figuring out our GetCapabilities request. This means that it is possible that we may make multiple requests before being satisfied with a response.
Also, if we are unable to parse a given version for some reason, for example, malformed XML, we will request a lower version until we have run out of versions to request with. Thus, a server that does not play nicely may take some time to parse and might not even succeed.
IOException
- if there is an error communicating with the server, or the XML cannot be
parsedServiceException
- if the server returns a ServiceExceptionprotected Response internalIssueRequest(Request request) throws IOException, ServiceException
request
- the request to be issuedIOException
- if there was a problem communicating with the serverServiceException
- if the server responds with an exception or returns bad contentpublic GetCapabilitiesResponse issueRequest(GetCapabilitiesRequest request) throws IOException, ServiceException
IOException
ServiceException
public void setLoggingLevel(Level newLevel)
Copyright © 1996–2019 Geotools. All rights reserved.