Skip to content

Commit dc540b3

Browse files
committed
remove kingbase8 dependency from tis-datax-kingbase-plugin
1 parent 12063e5 commit dc540b3

7 files changed

Lines changed: 105 additions & 18 deletions

File tree

tis-datax/tis-datax-kingbase-plugin/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@
3838
<dependency>
3939
<groupId>cn.com.kingbase</groupId>
4040
<artifactId>kingbase8</artifactId>
41-
<!-- <version>8.6.1</version>-->
4241
<version>9.0.1</version>
42+
<scope>provided</scope>
4343
</dependency>
4444

4545

tis-datax/tis-datax-kingbase-plugin/src/main/java/com/qlangtech/tis/plugin/datax/kingbase/dispatch/Off.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@
1818

1919
package com.qlangtech.tis.plugin.datax.kingbase.dispatch;
2020

21-
import com.kingbase8.KBProperty;
2221
import com.qlangtech.tis.extension.Descriptor;
2322
import com.qlangtech.tis.extension.TISExtension;
2423
import com.qlangtech.tis.plugin.datax.kingbase.KingBaseDispatch;
24+
import com.qlangtech.tis.plugin.ds.kingbase.TISStubForKBProperty;
2525

2626
import java.util.Properties;
2727

@@ -32,7 +32,7 @@
3232
public class Off extends KingBaseDispatch {
3333
@Override
3434
public void extractSetJdbcProps(Properties props) {
35-
props.setProperty(KBProperty.USEDISPATCH.getName(), String.valueOf(Boolean.FALSE));
35+
props.setProperty(TISStubForKBProperty.USEDISPATCH, String.valueOf(Boolean.FALSE));
3636
}
3737

3838
@TISExtension

tis-datax/tis-datax-kingbase-plugin/src/main/java/com/qlangtech/tis/plugin/datax/kingbase/dispatch/On.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020

2121
import com.alibaba.citrus.turbine.Context;
2222
import com.google.common.collect.Lists;
23-
import com.kingbase8.KBProperty;
2423
import com.qlangtech.tis.extension.Descriptor;
2524
import com.qlangtech.tis.extension.TISExtension;
2625
import com.qlangtech.tis.plugin.annotation.FormField;
2726
import com.qlangtech.tis.plugin.annotation.FormFieldType;
2827
import com.qlangtech.tis.plugin.annotation.Validator;
2928
import com.qlangtech.tis.plugin.datax.kingbase.KingBaseDispatch;
29+
import com.qlangtech.tis.plugin.ds.kingbase.TISStubForKBProperty;
3030
import com.qlangtech.tis.realtime.utils.NetUtils;
3131
import com.qlangtech.tis.runtime.module.misc.IFieldErrorHandler;
3232
import com.qlangtech.tis.runtime.module.misc.impl.AdapterFieldErrorHandler;
@@ -59,13 +59,13 @@ public void extractSetJdbcProps(Properties props) {
5959

6060
List<KingBaseSlaver> nodes = parseSlaverNodes();
6161

62-
props.setProperty(KBProperty.USEDISPATCH.getName(), String.valueOf(Boolean.TRUE));
63-
props.setProperty(KBProperty.SLAVE_ADD.getName()
62+
props.setProperty(TISStubForKBProperty.USEDISPATCH, String.valueOf(Boolean.TRUE));
63+
props.setProperty(TISStubForKBProperty.SLAVE_ADD
6464
, nodes.stream().map((node) -> node.addr).collect(Collectors.joining(",")));
65-
props.setProperty(KBProperty.SLAVE_PORT.getName()
65+
props.setProperty(TISStubForKBProperty.SLAVE_PORT
6666
, nodes.stream().map((node) -> String.valueOf(node.port)).collect(Collectors.joining(",")));
67-
props.setProperty(KBProperty.HOSTLOADRATE.getName(), String.valueOf(this.loadRate));
68-
props.setProperty(KBProperty.USECONNECT_POOL.getName(), String.valueOf(Boolean.FALSE));
67+
props.setProperty(TISStubForKBProperty.HOSTLOADRATE, String.valueOf(this.loadRate));
68+
props.setProperty(TISStubForKBProperty.USECONNECT_POOL, String.valueOf(Boolean.FALSE));
6969
}
7070

7171
private List<KingBaseSlaver> parseSlaverNodes() {

tis-datax/tis-datax-kingbase-plugin/src/main/java/com/qlangtech/tis/plugin/ds/kingbase/BasicKingBaseDataSourceFactory.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package com.qlangtech.tis.plugin.ds.kingbase;
2020

2121
import com.alibaba.citrus.turbine.Context;
22-
import com.kingbase8.KBProperty;
2322
import com.qlangtech.tis.lang.TisException;
2423
import com.qlangtech.tis.plugin.annotation.FormField;
2524
import com.qlangtech.tis.plugin.annotation.Validator;
@@ -47,15 +46,15 @@
4746
* Kingbase 数据库DataSource <br>
4847
* <p>
4948
* 读写分离配置:
50-
* https://bbs.kingbase.com.cn/docHtml?recId=218c307e5f3d72bf20bb84a51859344a&url=aHR0cHM6Ly9iYnMua2luZ2Jhc2UuY29tLmNuL2tpbmdiYXNlLWRvYy92OS4xLjEuMjQvZmFxL2ZhcS1uZXcvaW50ZXJmYWNlL2pkYmMuaHRtbCNpZDQ
49+
* <a href="https://bbs.kingbase.com.cn/docHtml?recId=218c307e5f3d72bf20bb84a51859344a&url=aHR0cHM6Ly9iYnMua2luZ2Jhc2UuY29tLmNuL2tpbmdiYXNlLWRvYy92OS4xLjEuMjQvZmFxL2ZhcS1uZXcvaW50ZXJmYWNlL2pkYmMuaHRtbCNpZDQ">...</a>
5150
*
5251
* @author: 百岁(baisui@qlangtech.com)
5352
* @create: 2025-01-14 14:34
5453
**/
5554
public abstract class BasicKingBaseDataSourceFactory extends PGLikeDataSourceFactory {
5655
public static final String KingBase_NAME = "KingBase";
57-
public static final String KingBase_Ver8 = "-V8.x";
58-
public static final String KingBase_Ver9 = "-V9.x";
56+
public static final String KingBase_Ver8 = "-V8x";
57+
public static final String KingBase_Ver9 = "-V9x";
5958
public static final String JDBC_SCHEMA_TYPE_V9 = "kingbase8";
6059
public static final String JDBC_SCHEMA_TYPE_V8 = JDBC_SCHEMA_TYPE_V9;
6160
public static final String FIELD_DB_MODE = "dbMode";
@@ -72,7 +71,7 @@ protected java.util.Properties extractSetJdbcProps(java.util.Properties props) {
7271
if (StringUtils.isEmpty(this.encode)) {
7372
throw new IllegalStateException("param encode can not be empty");
7473
}
75-
props.setProperty(KBProperty.CLIENT_ENCODING.getName(), this.encode);
74+
props.setProperty(TISStubForKBProperty.CLIENT_ENCODING, this.encode);
7675
return props;
7776
}
7877

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
* <p>
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
* <p>
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
package com.qlangtech.tis.plugin.ds.kingbase;
20+
21+
import com.kingbase8.KBProperty;
22+
23+
/**
24+
* Stub for KBProperty constants from com.kingbase8.KBProperty.
25+
* These constant values are hardcoded to avoid runtime dependency on kingbase8 driver.
26+
*
27+
* Original values extracted from:
28+
* - KBProperty.HOSTLOADRATE.getName() = "HOSTLOADRATE"
29+
* - KBProperty.USECONNECT_POOL.getName() = "USECONNECT_POOL"
30+
* - KBProperty.SLAVE_PORT.getName() = "SLAVE_PORT"
31+
* - KBProperty.USEDISPATCH.getName() = "USEDISPATCH"
32+
* - KBProperty.CLIENT_ENCODING.getName() = "clientEncoding"
33+
* - KBProperty.SLAVE_ADD.getName() = "SLAVE_ADD"
34+
*
35+
* NOTE: If KingBase driver updates these property names in the future,
36+
* these values need to be manually updated accordingly.
37+
*
38+
* @author 百岁 (baisui@qlangtech.com)
39+
* @date 2025/12/11
40+
*/
41+
public class TISStubForKBProperty {
42+
43+
/**
44+
* Property name for host load rate.
45+
* Extracted from KBProperty.HOSTLOADRATE.getName()
46+
*/
47+
public static final String HOSTLOADRATE = "HOSTLOADRATE";
48+
49+
/**
50+
* Property name for connection pool usage.
51+
* Extracted from KBProperty.USECONNECT_POOL.getName()
52+
* @see KBProperty#USECONNECT_POOL
53+
*/
54+
55+
public static final String USECONNECT_POOL = "USECONNECT_POOL";
56+
57+
/**
58+
* Property name for slave port.
59+
* Extracted from KBProperty.SLAVE_PORT.getName()
60+
* @see KBProperty#SLAVE_PORT
61+
*/
62+
public static final String SLAVE_PORT = "SLAVE_PORT";
63+
64+
/**
65+
* Property name for dispatch usage.
66+
* Extracted from KBProperty.USEDISPATCH.getName()
67+
*/
68+
public static final String USEDISPATCH = "USEDISPATCH";
69+
70+
/**
71+
* Property name for client encoding.
72+
* Extracted from KBProperty.CLIENT_ENCODING.getName()
73+
*/
74+
public static final String CLIENT_ENCODING = "clientEncoding";
75+
76+
/**
77+
* Property name for slave address.
78+
* Extracted from KBProperty.SLAVE_ADD.getName()
79+
*/
80+
public static final String SLAVE_ADD = "SLAVE_ADD";
81+
82+
/**
83+
* Private constructor to prevent instantiation.
84+
*/
85+
private TISStubForKBProperty() {
86+
throw new AssertionError("Utility class should not be instantiated");
87+
}
88+
}

tis-datax/tis-datax-kingbase-plugin/src/main/resources/com/qlangtech/tis/plugin/datax/kingbase/DataXKingBaseReader.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
{
22
"dbName": {
3-
"enum": "com.qlangtech.tis.util.PluginItems.getExistDbs(\"KingBase-V8.x\",\"KingBase-V9.x\")",
3+
"enum": "com.qlangtech.tis.util.PluginItems.getExistDbs(\"KingBase-V8x\",\"KingBase-V9x\")",
44
"creator": {
55
"plugin": [
66
{
7-
"descName": "KingBase-V8.x",
7+
"descName": "KingBase-V8x",
88
"hetero": "datasource",
99
"extraParam": "type_detailed,update_false,disableBizStore_true"
1010
},
1111
{
12-
"descName": "KingBase-V9.x",
12+
"descName": "KingBase-V9x",
1313
"hetero": "datasource",
1414
"extraParam": "type_detailed,update_false,disableBizStore_true"
1515
}

tis-datax/tis-datax-kingbase-v8-plugin/src/main/java/com/qlangtech/tis/plugin/ds/kingbase/KingBaseDataSourceFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import com.qlangtech.tis.extension.TISExtension;
44

55
/**
6-
*
6+
* kingbase V8.x版本数据源
77
* @author 百岁 (baisui@qlangtech.com)
88
* @date 2025/11/30
99
*/

0 commit comments

Comments
 (0)