Java Library

<< Click to Display Table of Contents >>

Navigation:  Development > Client >

Java Library

 

DTS provides a fully featured Client library for Java with its dts-client package. This section outlines how the library can be used for connecting to DTS and making requests and provides some insight into implementing custom DTS clients.

 

Library package

 

The Client library package is currently only available as a set of JARs which includes all dependencies. This means that you can import it into your project as is, or you can set it up in a custom repository (Maven, Gradle, etc.), depending on your development environment. For reference, the external dependencies are (Gradle format):

redis.clients:jedis:3.2.0

com.google.code.gson:gson:2.8.6

org.ow2.asm:asm-all:5.2

commons-codec:commons-codec:1.15

com.sun.mail:javax.mail:1.6.2

 

The Client library package is built and tested using Oracle JDK 8, which is the minimum version supported for development using the library.

 

Environment

 

While your implementation can make use of any environment variables it requires, the following are leveraged by the DTS client libraries.

Variable

Default

Function

DTS_REDIS_HOST_NAME

localhost

The host name or IP address of the DTS Redis server (Internal Communication Bus)

DTS_REDIS_PORT

6379

The port of the Redis server

DTS_CLIENT_NAME

anonymous

A name given to the client that will be used to tag it administrative purposes. This name will be suffixed with "@[hostname]".

DTS_DEBUG_LOGGING

false

Flag to toggle debug logging

DTS_ENABLE_SECURITY

false

Flag to toggle internal security (if the central DTS deployment is secured, clients are also required to be)

DTS_X509_CERTIFICATE_PATH

null

The local path to the X509 certificate file that was generated for this client (see Security Setup)

DTS_RSA_PRIVATE_KEY_PATH

null

The local path to the file containing the RSA Private Key corresponding to the X509 certificate in DER format.

DTS_CTRL_PUBLIC_KEY_PATH

null

The local path to the file containing the RSA Public Key of the DTS Controller in DER format.

In a standard secured DTS environment, the values for the Client environment variables may look something like this:

DTS_REDIS_HOST_NAME=dts-server # Host name for the machine running the Docker platform on which DTS is deployed

DTS_REDIS_PORT=7877 # The default port the DTS contained Redis server is mapped to

DTS_CLIENT_NAME=test1 # Assuming the host name of the machine running the client is "workstation0", the client will be known as "test1@workstation0"

DTS_DEBUG_LOGGING=true

DTS_ENABLE_SECURITY=true

DTS_X509_CERTIFICATE_PATH=/home/dts/client/security/test1.crt

DTS_RSA_PRIVATE_KEY_PATH=/home/dts/client/security/test1.key.der

DTS_CTRL_PUBLIC_KEY_PATH=/home/dts/client/security/ca.pubkey.der

 

Usage

 

The usage of the Java Client Library is best illustrated by example. Please see:

Direct Usage Example

Custom Implementation Example

The library is also accompanied by Javadoc describing the details of all classes, constants, methods, etc.