Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Datahub project Datahub ServerConfig

From Leeroopedia


Knowledge Sources
Domains Java_SDK, Metadata_Emission, Server_Discovery
Last Updated 2026-02-10 00:00 GMT

Overview

A class representing parsed DataHub server configuration fetched from the /config endpoint, providing version detection, feature support checking, and deployment type identification (Cloud vs Core).

Description

ServerConfig wraps the raw JSON response from the DataHub server's /config endpoint and provides a structured API for querying server capabilities. It stores:

  • Raw config -- The full JsonNode for accessing any config property.
  • Version -- A parsed Version object extracted from versions.acryldata/datahub.version.
  • Server environment -- The datahub.serverEnv value (e.g., "core" for self-hosted).
  • Fetch timestamp -- When the config was retrieved, for cache TTL calculations.

Deployment type detection:

  • isCloud() returns true when serverEnv is null or not "core".
  • isCore() returns true when serverEnv equals "core".

Feature support (supportsFeature(ServerFeature)): Features are detected through either config flags or version thresholds:

Feature Detection Method
PATCH_CAPABLE Config flag: patchCapable: true
STATEFUL_INGESTION Config flag: statefulIngestionCapable: true
IMPACT_ANALYSIS Config flag: supportsImpactAnalysis: true
DATAHUB_CLOUD Deployment type: isCloud()
OPENAPI_SDK Version threshold: Cloud >= 0.3.11, Core >= 1.0.1
API_TRACING Version threshold: Cloud >= 0.3.11, Core >= 1.0.1

Parsing: The static fromJson(JsonNode) factory method extracts the version string and server environment from the JSON structure, returning a fully initialized ServerConfig.

Usage

The V2 SDK client fetches and caches ServerConfig at startup (and periodically based on configRefreshIntervalMs) to adapt its behavior to the connected server's capabilities and version.

Code Reference

Source Location

metadata-integration/java/datahub-client/src/main/java/datahub/client/v2/config/ServerConfig.java

Signature

public class ServerConfig {

    public ServerConfig(
        @Nonnull JsonNode rawConfig,
        @Nonnull Version version,
        @Nullable String serverEnv,
        long fetchTimestamp)

    @Nonnull
    public static ServerConfig fromJson(@Nonnull JsonNode configJson)

    @Nonnull public Version getVersion()
    @Nonnull public JsonNode getRawConfig()
    @Nullable public String getServerEnv()
    public long getFetchTimestamp()

    public boolean isCloud()
    public boolean isCore()
    public boolean isVersionAtLeast(int major, int minor, int patch)
    public boolean isVersionAtLeast(int major, int minor, int patch, int build)
    public boolean supportsFeature(@Nonnull ServerFeature feature)
}

Import

import datahub.client.v2.config.ServerConfig;
import datahub.client.v2.config.ServerFeature;

I/O Contract

Inputs

Constructor:

Parameter Type Description
rawConfig JsonNode (@Nonnull) Raw JSON from /config endpoint
version Version (@Nonnull) Parsed server version
serverEnv String (@Nullable) Server environment string ("core" or null)
fetchTimestamp long Timestamp when the config was fetched

fromJson():

Parameter Type Description
configJson JsonNode (@Nonnull) JSON response from the /config endpoint

Expected JSON structure:

{
  "versions": {
    "acryldata/datahub": {
      "version": "v1.0.0",
      "commit": "abc123"
    }
  },
  "datahub": {
    "serverType": "prod",
    "serverEnv": "core"
  },
  "patchCapable": true,
  "statefulIngestionCapable": true
}

Outputs

  • fromJson() returns a ServerConfig with timestamp set to System.currentTimeMillis().
  • supportsFeature() returns true/false based on config flags or version thresholds.
  • isCloud()/isCore() return deployment type booleans.
  • toString() returns ServerConfig{version=..., serverEnv=..., isCloud=...}.

Usage Examples

// Parse from JSON
ObjectMapper mapper = new ObjectMapper();
JsonNode configJson = mapper.readTree(responseBody);
ServerConfig config = ServerConfig.fromJson(configJson);

// Check deployment type
if (config.isCloud()) {
    // Use cloud-specific endpoints
}

// Check feature support
if (config.supportsFeature(ServerFeature.PATCH_CAPABLE)) {
    // Use JSON patch for updates
}

// Version checks
if (config.isVersionAtLeast(1, 0, 1)) {
    // Use newer API features
}

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment