Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Apache Dolphinscheduler BaseDataSourceParamDTO Configuration

From Leeroopedia


Knowledge Sources
Domains Data_Integration, Configuration_Management
Last Updated 2026-02-10 00:00 GMT

Overview

Concrete tool for configuring datasource connection parameters using BaseDataSourceParamDTO hierarchy with JSON deserialization and the DataSourceUtils facade.

Description

BaseDataSourceParamDTO provides standard JDBC fields and setHostAndPortByAddress(String) for parsing combined host:port strings. BaseHDFSDataSourceParamDTO extends it with Kerberos fields. DataSourceUtils.buildDatasourceParam(String) provides a facade for deserialization. Each database types DataSourceProcessor.castDatasourceParamDTO() handles type-specific deserialization.

Usage

Called by the API layer when processing datasource creation/update requests. The JSON payload is deserialized into the appropriate DTO subclass.

Code Reference

Source Location

  • Repository: dolphinscheduler
  • File: dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseDataSourceParamDTO.java (L27-161)
  • File: dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/datasource/BaseHDFSDataSourceParamDTO.java (L20-58)
  • File: dolphinscheduler-datasource-plugin/dolphinscheduler-datasource-api/src/main/java/org/apache/dolphinscheduler/plugin/datasource/api/utils/DataSourceUtils.java (L96)

Signature

@Data
public abstract class BaseDataSourceParamDTO {
    protected Integer id;
    protected String name;
    protected String note;
    protected String host;
    protected Integer port;
    protected String database;
    protected String userName;
    protected String password;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    protected Map<String, String> other;

    public abstract DbType getType();
    public void setHostAndPortByAddress(String address);
}

@Data
public abstract class BaseHDFSDataSourceParamDTO extends BaseDataSourceParamDTO {
    private String principal;
    private String javaSecurityKrb5Conf;
    private String loginUserKeytabUsername;
    private String loginUserKeytabPath;
}

Import

import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.plugin.datasource.api.utils.DataSourceUtils;

I/O Contract

Inputs

Name Type Required Description
JSON parameter string String Yes JSON payload from API request body

Outputs

Name Type Description
BaseDataSourceParamDTO subclass DTO Populated DTO ready for validation

Usage Examples

Standard JDBC Configuration

// JSON from API
String paramJson = "{\"host\":\"localhost\",\"port\":3306,\"database\":\"mydb\","
    + "\"userName\":\"root\",\"password\":\"secret\"}";

// Deserialize via processor
MySQLDataSourceProcessor processor = new MySQLDataSourceProcessor();
BaseDataSourceParamDTO dto = processor.castDatasourceParamDTO(paramJson);
// dto.getHost() = "localhost", dto.getPort() = 3306, etc.

Kerberos HDFS Configuration

// Hive with Kerberos
String hiveJson = "{\"host\":\"hive-server:10000\",\"database\":\"analytics\","
    + "\"principal\":\"hive/_HOST@REALM\","
    + "\"javaSecurityKrb5Conf\":\"/etc/krb5.conf\","
    + "\"loginUserKeytabPath\":\"/etc/hive.keytab\"}";

HiveDataSourceProcessor hiveProcessor = new HiveDataSourceProcessor();
BaseHDFSDataSourceParamDTO hiveDto =
    (BaseHDFSDataSourceParamDTO) hiveProcessor.castDatasourceParamDTO(hiveJson);

Related Pages

Implements Principle

Requires Environment

Page Connections

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