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.

 

Dependency

 

To include the DTS Java Client Library as a dependency in your project, you have two options.

 

A. Use your build manager of choice to pull the dependency from the DTS repository:

 

Maven:

 

<dependency>

<groupId>com.alloy.dts</groupId>

<artifactId>dts-client</artifactId>

<version>2025.1.12</version>

</dependency>

 

Gradle:

 

implementation('com.alloy.dts:dts-client:2025.1.12')

 

Information-icon_16pxNote: To get credentials for authenticating to the DTS repository, please contact support.

 

B. Statically include the jars from [DTS]/lib/java on your classpath.

 

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.