LuciadFusion Platform is the server-side component of the LuciadFusion Studio web application. It is a Spring based application and as such, you can use the Spring framework to plug in your own custom service endpoints.

Your custom service endpoints have no direct access to the database used by LuciadFusion Studio. The only way to access the information from LuciadFusion Studio is through the LuciadFusion Studio REST API.

This article describes how to add a custom REST service to the LuciadFusion Platform. This is demonstrated in the samples.fusion.platform.service sample by adding a 'hello world' service. This sample shows which steps are needed to add an additional service. The following steps are required:

  1. Create a custom (REST) controller. The controller added in the sample is a simple Spring REST controller that returns a Hello world response for a GET request, or a Hello <name> response for a GET request with a parameter. See Program: Custom hello world REST controller for an example controller.

  2. Make sure that the application can find the controller. To find the new controller, we need to tell the Spring framework where to look for it. The LuciadFusion Platform allows you to specify additional packages that should be scanned by the Spring framework using the fusion.config.additionalScanPackages configuration property. See config/fusion.common.yml for more information on how to use this configuration property. The result is that you can run the LuciadFusion Platform main class, TLfnFusionPlatformApplication, with this extra property value. All Spring components/services in that additional package (or imported by a class in that new package) are also picked up by the LuciadFusion Platform framework.

Program: Custom hello world REST controller (from samples/fusion/platform/service/controller/HelloWorldController)
@Controller
@RequestMapping(path = "/hello")
public class HelloWorldController {

  @GetMapping
  public @ResponseBody String helloWorld() {
    return "Hello World";
  }

  @GetMapping(path = "{name}")
  public @ResponseBody String hello(@PathVariable("name") String name) {
    return "Hello " + name;
  }
}

Adding a custom service type to LuciadFusion is discussed in the Example: adding a custom service using height data article.