public interface ILfnServiceTypeConfiguration
Defines the operations of a service type that can be published in LuciadFusion (WMS, WFS, WCS, etc). Implement this interface to add your own service type to LuciadFusion.
The ILfnServiceTypeConfiguration
interface requires 3 things:
LuciadFusion automatically picks up all ILfnServiceTypeConfiguration
implementations in the Spring application context
and creates a service type for every implementation it finds.
Add the package containing your ILfnServiceTypeConfiguration
implementation to the
fusion.config.additionalScanPackages
property so that LuciadFusion find it in the application context.
This property can be found in the config/fusion.common.yml
file.
Modifier and Type | Method and Description |
---|---|
default URI |
getEndpointBaseURI(URI aServerBaseURI)
|
String |
getEndpointPath(String aServiceName)
Returns an endpoint that can be used by clients to connect and send requests to a service of this service type.
|
ILfnServiceTypeProductValidator |
getProductValidator()
Returns a validator that limits what products and data that can be added to the service type.
|
String |
getServiceType()
Returns the type of the service.
|
String getServiceType()
Returns the type of the service. This is a string identifier of the service type.
Users of the LuciadFusion Studio REST API or LuciadFusion Studio web application use this identifier to specify the type when creating a service.
The returned type cannot be null
.
The type must be unique among all services (case insensitive). The following service types are already used by LuciadFusion:
wms
wmts
wfs
wcs
csw
lts
fileserver
ogc3dtiles
panoramics
hspc
ecwp
ILfnServiceTypeProductValidator getProductValidator()
SHP
.
The returned product validator cannot be null
.
ILfnServiceTypeProductValidator
String getEndpointPath(String aServiceName)
The endpoint path is appended to the URI returned by getEndpointBaseURI(URI)
to generate a URI
that is provided to LuciadFusion Studio users in the service details page.
It is also available to users of the REST api by requesting service resources.
Ensure that you add a component to the Spring application context that can handle requests sent to the endpoint path.
This can be done, for example, by using the @Controller
and @RequestMapping
annotations from the Spring MVC framework.
Use the aServiceName
parameter to create a unique endpoint for every service.
When a client connects to the endpoint, extract the name of the service from the path to look up the service using
TLfnServiceRepository#findByTypeAndName
.
Some examples:
/ogc/wms/{aServiceName}
/lts/{aServiceName}
aServiceName
- the name of the service for which to provide an endpoint path.null
.default URI getEndpointBaseURI(URI aServerBaseURI) throws URISyntaxException
URI
that can be used to create endpoint URI
s that clients can use to connect and send requests to a service of this service type.
A base URI consists of a protocol, hostname, server port and server context path.
Ensure that you add a component to the Spring application context that can handle requests sent to the endpoint path.
This can be done, for example, by using the @Controller
and @RequestMapping
annotations from the Spring MVC framework.
The default implementation returns the given aServerBaseURI
, which is the base uri the client used to request the endpoint uri.
Implement this method if you want to change the protocol, hostname, port or context path used to connect to the service.
For example, you can implement it if you want endpoint URI
s to be generated that use a protocol other than http(s).
Some examples:
https://www.yourdomain.com
http://www.yourdomain.com:8080/context-path
ecwp://www.yourdomain.com
ftp://www.yourdomain.com/context-path
The following snippet shows an example implementation, which replaces the http(s) protocol by ftp(s):
@Override
public URI getEndpointBaseURI(URI aServerBaseURI) throws URISyntaxException {
String protocol = aServerBaseURI.getScheme().endsWith("s") ? "ftps" : "ftp";
return new URI(protocol, aServerBaseURI.getUserInfo(), aServerBaseURI.getHost(), aServerBaseURI.getPort(), aServerBaseURI.getPath(), aServerBaseURI.getQuery(), aServerBaseURI.getFragment());
}
aServerBaseURI
- the base URI
used by the client requesting the endpoint URI.
This URL contains the protocol, hostname, port (if different from the standard http 80 or https 443 ports) and server context path (if any).URI
used to create endpoint URI
s to connect to service instances. The returned URI
cannot be null
.URISyntaxException