Components of a Core Connector template

This section gives an overview of the components of the generic Core Connector REST template.

.circleci folder

The config.yml file in the .circleci folder contains configuration code that is used to build and deploy Core Connector.

client-adapter-interface folder

Inside src/main/resources/, there is a file called api.yaml. This file contains the definition of the Payment Manager API.

The client-adapter-interface folder also contains a pom.xml configuration file (this is required by Maven practices) to specify the dependencies and plugins that the client-adapter-interface component relies on.

Some details to point out in pom.xml are as follows.

Make sure that the version number of the template indicated between <version> tags (see below) matches the version number specified in the pom.xml file located in the root folder of the project.

<parent>
    <artifactId>mambu-client-adapter</artifactId>
    <groupId>com.modusbox</groupId>
    <version>1.1.0-SNAPSHOT</version>
</parent>

The version number of the module itself (client-adapter-interface) may also be defined separately, for example:

<artifactId>client-adapter-interface</artifactId>
<version>1.1.0</version>

The plugin called openapi-generator-maven-plugin has special significance, it is used to generate client stub files from an OpenAPI specification. In other words, this is the resource that translates the api.yml file into Java classes.

Within the configuration of openapi-generator-maven-plugin, the following line defines the path pointing to the .yaml file that originates the Java class definitions. If the location of the .yaml file changes, remember to update this line:

<inputSpec>${project.basedir}/src/main/resources/api.yaml</inputSpec>

Finally, the following lines define the names of the packages that the generated classes will have (they can be changed if required):

<apiPackage>com.modusbox.client.api</apiPackage>
<modelPackage>com.modusbox.client.model</modelPackage>

Part of the configuration of openapi-generator-maven-plugin is also incorporated into the pom.xml file that is in the root folder of the project.

client-adapter-it folder

The client-adapter-it folder contains integration tests (generated using Cucumber). It comes with:

  • An src/test/resources folder, which contains:

    • Test scenarios declared in the com/modus/client/it/client-adapter-tests.feature file.

    • The configuration of the Log4j logging utility specified in the log4j.xml file.

  • An src/test/java/com/modus/client/it/ folder, which contains:

    • An ApplicationCucumberSteps.java file, which has the implementation for the declared test scenarios.

    • A CucumberTestRunnerIT.java file, which is used to run the test scenarios .feature file.

  • A pom.xml configuration file to specify the dependencies and plugins that the client-adapter-it component relies on.

client-adapter folder

Contains the implementations of the Payment Manager API endpoints, as well as the routers, processors, and beans required to translate and route messages from one endpoint to another (in our case, from DFSP backend endpoints to Payment Manager API endpoints, and the other way around).

It comes with:

  • A lib folder. This folder stores those libraries that are not hosted in a public repository.

  • A src/main folder with all of the source material for building the Core Connector project:

    • java/com/modusbox/client/jaxrs/: The classes that implement the Payment Manager API endpoint interfaces.

    • java/com/modusbox/client/router/: The routers that define the rules for moving messages between endpoints.

    • java/com/modusbox/client/Application.java: This is the main class of the application, and this what will run the project as a Spring Boot application.

    • resources/mappings/: The DataSonnet mappings between the Payment Manager API and the DFSP backend API (referenced by the router).

    • resources/spring/application.xml: This is one of the Spring beans configuration files which loads the resources necessary to run the application. This file acts as the main configuration file and contains mappings to the other configuration files (spring/cxf.xml and spring/mappings.xml).

    • resources/spring/cxf.xml: This file handles the Apache CXF configuration. It has a Camel context declaration and also a Camel CXF REST server declaration.

    • resources/spring/mappings.xml: This file contains the DataSonnet file mappings and their configuration. It maps each DataSonnet file as a Spring bean and makes it available for other application resources.

    • resources/application.yml: This is another format for the application.xml file. It acts as a properties file with values that can be used in testing or in other environments. The resources/spring/application.xml file is pointing to this file.

    • resources/log4j2.xml: A configuration file for the Log4j logging utility.

  • A src/test folder with source material for testing the Core Connector application:

    • java/com/modus/client: Contains tests for the DataSonnet mappings

    • Mock requests and responses for each endpoint (for example: resources/getLoanByIdResponse.ds/input/inputs, and so on).

    • resources/log4j.xml: A configuration file for the Log4j logging utility.

  • A pom.xml configuration file (required by Maven practices) to specify the dependencies and plugins that the client-adapter component relies on.

  • A settings.xml file, which defines values that are required for configuring Maven execution. These include values such as local repository location, alternate remote repository servers, and authentication information.

Dockerfile file

The Dockerfile for building the Core Connector image.

pom.xml configuration file

Contains the Project Object Model (POM) for the project. The POM is the basic unit of work in Maven. It is an XML file that contains information about the project and configuration details (such as modules, dependencies, plugins) used by Maven to build the project. For more information on how pom.xml is structured, see Maven documentation.

run.sh file

A script to run Core Connector.