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:Apache Dolphinscheduler BaseDataSourceParamDTO Extension

From Leeroopedia
Revision as of 14:12, 16 February 2026 by Admin (talk | contribs) (Auto-imported from implementations/Apache_Dolphinscheduler_BaseDataSourceParamDTO_Extension.md)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


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

Overview

Concrete tool for defining datasource connection parameters by extending BaseDataSourceParamDTO and BaseConnectionParam base classes.

Description

BaseDataSourceParamDTO is the abstract base class for all datasource parameter DTOs. It provides common fields (host, port, database, userName, password, other) and the setHostAndPortByAddress() utility for parsing "host:port" strings. BaseConnectionParam holds the resolved internal connection parameters with JDBC URL, encoded password, driver class name, and validation query. Database-specific plugins extend both classes to add type-specific fields.

Usage

Extend BaseDataSourceParamDTO when creating a new datasource plugin to define the user-facing parameters, and extend BaseConnectionParam for the internal connection representation.

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-spi/src/main/java/org/apache/dolphinscheduler/spi/datasource/BaseConnectionParam.java (L29-49)

Signature

@Data
public abstract class BaseDataSourceParamDTO {
    // Fields
    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;

    // Methods
    public abstract DbType getType();
    public void setHostAndPortByAddress(String address);  // L143-158
}

@Data
public class BaseConnectionParam implements ConnectionParam {
    protected String user;
    protected String password;
    protected String address;
    protected String database;
    protected String jdbcUrl;
    protected String driverClassName;
    protected String validationQuery;
    protected Map<String, String> other;
}

Import

import org.apache.dolphinscheduler.plugin.datasource.api.datasource.BaseDataSourceParamDTO;
import org.apache.dolphinscheduler.spi.datasource.BaseConnectionParam;

I/O Contract

Inputs

Name Type Required Description
host String Yes Database server hostname or IP address
port Integer Yes Database server port number
database String Yes Target database name
userName String Yes Authentication username
password String Yes Authentication password (plain text at DTO level)
other Map<String, String> No Additional JDBC parameters

Outputs

Name Type Description
BaseDataSourceParamDTO subclass Object User-facing DTO for API/UI transport
BaseConnectionParam subclass Object Internal connection params with encoded password and JDBC URL

Usage Examples

MySQL Parameter DTO

@Data
public class MySQLDataSourceParamDTO extends BaseDataSourceParamDTO {

    @Override
    public DbType getType() {
        return DbType.MYSQL;
    }
}

MySQL Connection Parameters

@Data
public class MySQLConnectionParam extends BaseConnectionParam {
    // MySQL uses all base fields without extension
    // JDBC URL format: jdbc:mysql://host:port/database?params
}

HDFS-Based Parameter DTO

// For Hive, Spark, etc. that need Kerberos authentication
@Data
public abstract class BaseHDFSDataSourceParamDTO extends BaseDataSourceParamDTO {
    private String principal;
    private String javaSecurityKrb5Conf;
    private String loginUserKeytabUsername;
    private String loginUserKeytabPath;
}

Related Pages

Implements Principle

Page Connections

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