Skip to content

cognitedata/cdf-sdk-java

Repository files navigation

java-main Actions Status

Cognite logo

Java sdk for CDF

The Java SDK provides convenient access to Cognite Data Fusion's capabilities. It covers a large part of CDF's capability surface, including experimental features. In addition, it is designed to handle a lot of the client "chores" for you so you can spend more time on your core client logic.

Some of the SDK's capabilities:

  • Upsert support. It will automatically handle createand update for you.
  • Streaming reads. Subscribe to a stream of created and updated data.
  • Retries with backoff. Transient failures will automatically be retried.
  • Performance optimization. The SDK will handle batching and parallelization of requests.

Requirements SDK v2:

  • Java 17

Requirements SDK v1:

  • Java 11

Please refer to the documentation for more information: ./docs/index.md.

Upcoming SDK v2

We have a new major version of the Java SDK in the pipeline. It is based on the v1 code line, but with a few breaking changes, so we bump it to a new major version. The main breaking changes include:

  • Move to Java 17
  • Remove deprecated methods from the SDK
  • Refactor the diagram annotation data transfer object to accommodate the new annotations api endpoint.

It should not be too hard to move from v1 to v2 and we'll provide a migration guide for you.

Installing the sdk

SDK v2

<dependency>    
    <groupId>com.cognite</groupId>
    <artifactId>cdf-sdk-java</artifactId>
    <version>2.3.0</version>
</dependency>

SDK v1

<dependency>    
    <groupId>com.cognite</groupId>
    <artifactId>cdf-sdk-java</artifactId>
    <version>1.19.1</version>
</dependency>

Features

Core resource types

  • Time series
  • Assets
  • Events
  • Files
  • Sequences
  • Relationships
  • Raw

Data organization

  • Data sets
  • Labels
  • Extraction Pipelines

Contextualization

  • Entity matching
  • Interactive P&ID

3D

  • 3D Models
  • 3D Model Revisions
  • 3D File Download
  • 3D Asset Mapping

TRANSFORMATIONS

  • Transformations
  • Transformation Jobs
  • Transformation Schedules
  • Transformation Notifications

Quickstart

// Create the Cognite client with client credentials (OpenID Connect)
CogniteClient client = CogniteClient.ofClientCredentials(
        <cdfProject>,
        <clientId>,
        <clientSecret>,
        TokenUrl.generateAzureAdURL(<azureAdTenantId>))
        .withBaseUrl("https://yourBaseURL.cognitedata.com"); //optional parameter     
        
// List all assets
List<Asset> listAssetsResults = new ArrayList<>();
client.assets()
        .list(Request.create()
                .withFilterParameter("key", "value"))       //optionally add filter parameters
        .forEachRemaining(assetBatch -> listAssetsResults.addAll(assetBatch));        //results are read in batches

// List all events
List<Event> listEventsResults = new ArrayList<>();
client.events()
        .list(Request.create()
                .withFilterParameter("key", "value"))       //optionally add filter parameters
        .forEachRemaining(eventBatch -> listEventsResults.addAll(eventBatch));        //results are read in batches

Open in Cloud Shell

About

Java SDK for Cognite Data Fusion

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages