Creating a new controller

In this chapter you will discover how to extend lightblue to integrate with others databases. Note that you can ask questions on http://dev.forum.lightblue.io and you can also make a PR or new features for the existing extentions, such as MongoDB and RDBMS

Overview

As the previous chapters already introduced many internal concepts, this chapter assume that you already read those previous chapters or you are going to loop them up first efore asking in the http://dev.forum.lightblue.io.

The Basic structure of a new ontroller will need the following sub-modules:common, config, crud, hystrix and metadata. Each of them have a propose already described on other chapter but we can summarize as following:

  • common: will have the classes which are neeeded in different sub-modules, so you will not have cyclic (also aka circular) dependencies problem. A common practice used in the lightblue projects is to have a class with all the error/exception codes (such as the RDBMSConstants). For more information about the class used to handle the execption that a look on Error;
  • config: You will put the implementation of the classes resposible for the configuration, the required ones for lightblue are: com.redhat.lightblue.config.DataSourceConfiguration and com.redhat.lightblue.config.ControllerFactory;
  • crud: This sub-module is basically the implementation of com.redhat.lightblue.crud.CRUDController class which it will be used to handle the lightblue operations calls (e.g. save, update, etc) and call the hystrix classes to interact with the data.
  • hystrix: This module holds the classes that implements com.netflix.hystrix.HystrixCommand which should be used to interact with the data as we can monitor each service;
  • metadata: This class is resposible to implement com.redhat.lightblue.metadata.parser.DataStoreParser to deal with the datasource of the database you are going to build and com.redhat.lightblue.metadata.parser.PropertyParser that will be used to convert the data from the JSON format to the model you already defined and vice versa. You may also need to define the json-schema (for example the rdbms.json which is used to described the format of the JSON data;

results matching ""

    No results matching ""