Implementation:Datahub project Datahub ServerConfig
| 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
JsonNodefor accessing any config property. - Version -- A parsed
Versionobject extracted fromversions.acryldata/datahub.version. - Server environment -- The
datahub.serverEnvvalue (e.g., "core" for self-hosted). - Fetch timestamp -- When the config was retrieved, for cache TTL calculations.
Deployment type detection:
isCloud()returnstruewhenserverEnvis null or not "core".isCore()returnstruewhenserverEnvequals "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 aServerConfigwith timestamp set toSystem.currentTimeMillis().supportsFeature()returnstrue/falsebased on config flags or version thresholds.isCloud()/isCore()return deployment type booleans.toString()returnsServerConfig{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
- Datahub_project_Datahub_SemanticVersion -- Semantic version parsing used by ServerConfig
- Datahub_project_Datahub_DataHubClientConfigV2 -- Client config that controls config cache TTL
- Datahub_project_Datahub_RestEmitterEmitMode -- Emit mode influenced by server capabilities