Java Client API

The CDAP Java Client API provides methods for interacting with CDAP from Java applications.

Note: Datasets are deprecated and will be removed in CDAP 7.0.0.

Maven Dependency

To use the Java Client API in your project, add this Maven dependency:

<dependency> <groupId>io.cdap.cdap</groupId> <artifactId>cdap-client</artifactId> <version>${cdap.version}</version> </dependency>

Components

The Java Client API allows you to interact with these CDAP components:

  • ApplicationClient: interacting with applications

  • DatasetClient: interacting with datasets

  • DatasetModuleClient: interacting with dataset Modules

  • DatasetTypeClient: interacting with dataset Types

  • MetricsClient: interacting with metrics

  • MonitorClient: monitoring system services

  • PreferencesClient: interacting with preferences

  • ProgramClient: interacting with MapReduce Programs, user services, workflows, and workers

  • QueryClient: querying datasets

  • ServiceClient: interacting with user services

  • StreamClient: interacting with streams

The above list links to the examples below for each portion of the API.

Configuring your *Client

Every *Client constructor requires a ClientConfig instance which configures the hostname and port of the CDAP instance that you wish to interact with.

In a non-secure (default) CDAP instance, instantiate as follows:

// Interact with the CDAP instance located at example.com, port 11015 ClientConfig clientConfig = ClientConfig.builder() .setConnectionConfig(new ConnectionConfig("example.com", 11015, false)) .build();

In a secure CDAP instance, first pull in the cdap-authentication-client Maven dependency:

<dependency> <groupId>io.cdap.cdap</groupId> <artifactId>cdap-authentication-client</artifactId> <version>${cdap.client.version}</version> </dependency>

Then, instantiate as follows:

ApplicationClient

DatasetClient

DatasetModuleClient

DatasetTypeClient

MetricsClient

MonitorClient

PreferencesClient

ProgramClient

ServiceClient

StreamClient

 

Created in 2020 by Google Inc.