Interface ILcdWMSCapabilitiesProvider

All Known Implementing Classes:
ALcdWMSCapabilitiesProvider

public interface ILcdWMSCapabilitiesProvider

Provides the WMS capabilities, or parts of it. The capabilities describe what this server has to offer, which layers, styles etc. This is a core extension point when implementing your own server. Alternatively, you can use the Fusion Platform, where the capabilities are configured through the Studio web application.

As the capabilities are retrieved for every request, it for example allows to easily add or remove layers without having to restart the server. Furthermore, the request that is being handled is provided as a parameter, which allows for tailor-made capabilities based on that information. It could for example be used to implement access control: grant certain users access to more layers than others. Access control is described in some more detail in the ILcdWCSCapabilitiesProvider.

As this interface is called for every request, the implementation must be fast and efficient. It could for example apply caching, to avoid any work if no changes to the capabilities are needed. The simplest implementation would ignore the provided request parameter and always provide the same capabilities object.

The method getCapabilities is used for the GetCapabilities request. The other methods are used for the other WMS requests. They allow for retrieving only a sub-set of the information that is needed for validation and processing of the WMS request. A default implementation of these methods, in function of the full capabilities, is available within ALcdWMSCapabilitiesProvider. Implement them directly when you can obtain the sub-set of the needed information in a more efficient way than using the full capabilities object.

Since:
2017.0
  • Method Details

    • getCapabilities

      ALcdWMSCapabilities getCapabilities(ILcdRequest aRequest) throws TLcdWMSServiceException
      Creates a ALcdWMSCapabilities object for a given request. This method is called within the context of a GetCapabilities request performed by a client application or user.

      The ILcdRequest can be used to determine whether the request is done by an authenticated user. This allows to return a capabilities response that is tailored to the authorization the user has. Main use is to filter out layers for which the user has not been granted permissions.

      Parameters:
      aRequest - the user request.
      Returns:
      the capabilities for the user request.
      Throws:
      TLcdWMSServiceException - if there is an issue to create the capabilities.
    • getLayers

      List<ALcdWMSLayer> getLayers(List<String> aLayerNames, ILcdRequest aRequest) throws TLcdWMSServiceException
      Returns the corresponding WMS layers for the requested layer names. The returned WMS layers should be constructed such that calling the method ALcdWMSLayer.getParentWMSLayer() returns a valid result (may always be NULL. The parent layer may be needed to validate whether named styles are applicable for a layer. They may have been inherited from the parent.

      If there is no corresponding WMS layer the method should throw a TLcdWMSServiceException with the exception code LAYER_NOT_DEFINED. Include the undefined layer name as the entity name of the exception to allow returning a proper message to the client application.

      This method allows to differentiate access to layers based on the user's authorization information. The user's authorization information can be extracted from the request using the getUserPrincipal method. Use the following exception codes for handling access control.

      • LAYER_NOT_AUTHORIZED: to indicate the user has requested a layer he does not have access to.
      • AUTHENTICATION_REQUIRED: to indicate the user has request a layer for which authentication is required but no authentication has been provided yet.
      The resulting exception is translated in a proper response to the client application.
      Parameters:
      aLayerNames - the names of the layers.
      aRequest - the request.
      Returns:
      the corresponding WMS layers.
      Throws:
      TLcdWMSServiceException - if there is an exception in retrieving the layers or if incorrect layers are requested.
      See Also:
    • getServiceMetaData

      ALcdWMSServiceMetaData getServiceMetaData(ILcdRequest aRequest) throws TLcdWMSServiceException
      Returns the WMS service metadata part of the WMS capabilities.
      Parameters:
      aRequest - the request being handled.
      Returns:
      the WMS service metadata.
      Throws:
      TLcdWMSServiceException - if there is an issue to create the WMS service meta data.