Skip to content

Commit

Permalink
make getWriterDataSourceFactoryGetter avoid to get reader dbFactoryId
Browse files Browse the repository at this point in the history
  • Loading branch information
baisui1981 committed Mar 9, 2023
1 parent 04a485b commit b2983c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -872,10 +872,11 @@ public static IDataSourceFactoryGetter getWriterDataSourceFactoryGetter(Configur

public static IDataSourceFactoryGetter getReaderDataSourceFactoryGetter(Configuration config, IJobContainerContext containerContext) {
return getDataSourceFactoryGetter(config, containerContext, (res) -> {
final DBIdentity dbFactoryId = DBIdentity.parseId(config.getString(DataxUtils.DATASOURCE_FACTORY_IDENTITY));
return new IDataSourceFactoryGetter() {
@Override
public DataSourceFactory getDataSourceFactory() {
return TIS.getDataBasePlugin(new PostedDSProp(res.dbFactoryId));
return TIS.getDataBasePlugin(new PostedDSProp(dbFactoryId));
}

@Override
Expand All @@ -893,14 +894,11 @@ private static IDataSourceFactoryGetter getDataSourceFactoryGetter(
String dataXName = containerContext.getTISDataXName(); // originalConfig.getString(DataxUtils.DATAX_NAME);
StoreResourceType resType = StoreResourceType.parse(
originalConfig.getString(StoreResourceType.KEY_STORE_RESOURCE_TYPE));

final DBIdentity dbFactoryId = DBIdentity.parseId(originalConfig.getString(DataxUtils.DATASOURCE_FACTORY_IDENTITY));

if (StringUtils.isEmpty(dataXName)) {
throw new IllegalArgumentException("param dataXName:" + dataXName + "can not be null");
}
try {
Object dataxPlugin = callable.apply(new DataXResourceName(() -> dataXName, resType, dbFactoryId));
Object dataxPlugin = callable.apply(new DataXResourceName(() -> dataXName, resType));
Objects.requireNonNull(dataxPlugin, "dataXName:" + dataXName + " relevant instance can not be null");
if (!(dataxPlugin instanceof IDataSourceFactoryGetter)) {
throw new IllegalStateException("dataxWriter:" + dataxPlugin.getClass() + " mus be type of " + IDataSourceFactoryGetter.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.qlangtech.tis.datax.IDataXNameAware;
import com.qlangtech.tis.plugin.StoreResourceType;
import com.qlangtech.tis.plugin.ds.DBIdentity;

/**
* @author: 百岁([email protected]
Expand All @@ -11,12 +10,12 @@
public class DataXResourceName {
private final IDataXNameAware name;
public final StoreResourceType resType;
public final DBIdentity dbFactoryId;
// public final DBIdentity dbFactoryId;

public DataXResourceName(IDataXNameAware name, StoreResourceType resType, DBIdentity dbFactoryId) {
public DataXResourceName(IDataXNameAware name, StoreResourceType resType) {
this.name = name;
this.resType = resType;
this.dbFactoryId = dbFactoryId;
// this.dbFactoryId = dbFactoryId;
}

public String getDataXName() {
Expand Down

0 comments on commit b2983c6

Please sign in to comment.