Skip to main content

Arango Adapter Overview

  • Arango Adapter was build using java spring boot framework. Arango Adapter consist of REST API’s which was used to perform CRUD operation in Arango DB
  • Inside Arango Adapter had many business logics and it supports some below document validations
    • AutoIncrement
    • AutoGenerate
    • Mandatory Validation
    • Min and Max Length check Validation
    • UUID generation
    • Dimention(refer and store document to another collection) etc.

Arango Adapter API Document

  • Please refer the Arango Adapter API document

Arango_Adapter_Document_Link > https://docs.google.com/document/d/1zQq6zpc7haE9q2P5UKrk1pWH4dVILhdzIYW975PGrIg/edit

Spring Boot

  • Spring Boot is an open-source Java-based framework used to create a Micro Service.

  • Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can "just run".

  • Spring Boot has inbuilt tomcat server. We don’t need to external install tomcat server.

Project Structure

  • In Arango Adapter had two projects in workspace. One project was spring boot web project and another was just java project.

  • In above, QDMDBService was a Spring boot project and QDMDBFramework was a java project.

ArangoDB Services Project Structure

  • The QDMDBService project was a Spring boot project. Below was the project folder structure.

  • All the REST API was written in controller file in this project. Each API will internally invoke the QDMDBFramework methods.

  • All the business logics was written in QDMDBFramework project.

Packages in QDMDBService project

This project has below files and packages.

com.qdm.ArangoDB.controller – This package contains Arango Adapter controller java file. All the API’s written in this file.

com.qdm.ArangoDB– This package contains pojo classes files.

Application.properties – This file has all configuration key’s like(DB server informations etc).

Pom.xml – This file has all maven dependencies in xml format.

Log4J2.xml – The Log file will generate based on the configuration written in the file.

lib folder – In this folder, QDMDBFramework project jar file will place in this folder. And this folder will be configured in pom.xml file.

ArangoDB Framework Project Structure

This project was the dependency project of the QDMDBService project. All the business logics was written in this project.

This project has below files and packages.

Packages in QDMDBFramework project

com.arangodb.data- This package consist of Database.java file, This file has all the ArangoDB CRUD operation methods.

com.arangodb.impl – This package has two files ImplClientData.java and ImplMetadata.java file. All the client DB methods would placed in implClientData.java file and all the metadata related methods would be placed in ImplMetadata.java file.

com.qdm.common – This package has all the logics which was commonly used throughout the project

Every time in the build, this project was converted into jar file and placed to QDMDBService Project. And this jar file will refer in the pom.xml file

Below was the pom.xml screenshot in QDMDBService Project.

Arango Adaptor API Flows

  • If we want to create any API in the Arango Adapter, first we need to understand the logics and decide whether this API will come under Client side or Metadata side.

  • If the API comes under client-side means, then all the logics will be placed in ImplClientData.java, ClientDataLogis.java file.

  • If the API comes under metadata side means, then all the logics will be placed in ImplMetaData.java, MetadataLogics.java file.

Sample API Flow:

Controller file has API’s

  • Below was one of the API in Arango Adapter Project. This API logics was comes under Metadata concept. So, this API’s business logics written in ImplMetaData.java and MetadataDataLogics.java file.

  • Here IMetaData service class internally invoke the methods from ImplMetaData.java file which was present in the dependency project QDMDBFramework.

  • Here “servicesPoints.METADATASEVICE” invoke the packages which was present in the QDMDBFramework project

  • So, the Client related logics will present in the ImplClientData file and Metadata related logics will present in the ImplMetaData file.

  • Here IMetadata was an interface file. This file only has method declaration. This interface will be implemented in ImplMetaData.java file, Under this file will have all logics.

Loggers

  • In Arango Adapter, for logging purposes, we were using log4j2 framework. This framework was widely used in java applications.

  • We already follow the logging mechanism. So, don’t use System.out.println functions anywhere in the project.

  • For Implementing log4j2 frameworks we included following maven dependencies in pom.xml file

Coding Standards

We follow some coding standards in arango adapter project. Please follow the same.

Request Mapping Path

The request mapping path should be in lower case format and use underscore to split the two words.

Ex:

Method Name

The method name should be start with small case and second word should be start with caps.

Ex: upsertDocument, readDocuments, deleteDocuments etc.

Variable Name

The variable name should be start with small case and second word should be start with caps.

Ex: isInsert, isRead, isDelete etc.

Method Definitions

  • Divide the big methods to smaller methods.
  • Avoid writing two or more try catch statements in single method.
  • Avoid writing more than 5 If statements in single method.
  • Every method should have error handling mechanism.
  • Avoid passing more than 5 parameters to the methods.

Class Name

  • The class name should be start with caps.

  • The filename and class name should be same.

Ex: ImplClienData.java, ImplMetaData.java etc.

Package Name

The package name should be in lowercase format.

Ex: com.arangodb, com.arangodb.services etc.

SOFTWARE REQUIREMENTS

TechnologyVersion
Java11
Arango Adapter2.1
Spring Boot2.3.4
ArangoDB3.7.11 and above