use of org.apache.inlong.manager.common.pojo.group.InlongGroupExtInfo in project incubator-inlong by apache.
the class InlongGroupTransfer method createTubeExtInfo.
public static List<InlongGroupExtInfo> createTubeExtInfo(TubeBaseConf tubeBaseConf) {
List<InlongGroupExtInfo> extInfos = new ArrayList<>();
if (StringUtils.isNotEmpty(tubeBaseConf.getTubeMasterUrl())) {
InlongGroupExtInfo tubeManagerUrl = new InlongGroupExtInfo();
tubeManagerUrl.setKeyName(InlongGroupSettings.TUBE_MANAGER_URL);
tubeManagerUrl.setKeyValue(tubeBaseConf.getTubeManagerUrl());
extInfos.add(tubeManagerUrl);
}
if (StringUtils.isNotEmpty(tubeBaseConf.getTubeMasterUrl())) {
InlongGroupExtInfo tubeMasterUrl = new InlongGroupExtInfo();
tubeMasterUrl.setKeyName(InlongGroupSettings.TUBE_MASTER_URL);
tubeMasterUrl.setKeyValue(tubeBaseConf.getTubeMasterUrl());
extInfos.add(tubeMasterUrl);
}
if (tubeBaseConf.getTubeClusterId() > 0) {
InlongGroupExtInfo tubeClusterId = new InlongGroupExtInfo();
tubeClusterId.setKeyName(InlongGroupSettings.TUBE_CLUSTER_ID);
tubeClusterId.setKeyValue(String.valueOf(tubeBaseConf.getTubeClusterId()));
extInfos.add(tubeClusterId);
}
return extInfos;
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupExtInfo in project incubator-inlong by apache.
the class InlongGroupTransfer method parseTubeConf.
private static TubeBaseConf parseTubeConf(InlongGroupResponse groupResponse) {
TubeBaseConf tubeBaseConf = new TubeBaseConf();
tubeBaseConf.setGroupName(groupResponse.getMqResourceObj());
List<InlongGroupExtInfo> groupExtInfos = groupResponse.getExtList();
for (InlongGroupExtInfo extInfo : groupExtInfos) {
if (extInfo.getKeyName().equals(InlongGroupSettings.TUBE_CLUSTER_ID)) {
tubeBaseConf.setTubeClusterId(Integer.parseInt(extInfo.getKeyValue()));
}
if (extInfo.getKeyName().equals(InlongGroupSettings.TUBE_MANAGER_URL)) {
tubeBaseConf.setTubeManagerUrl(extInfo.getKeyValue());
}
if (extInfo.getKeyName().equals(InlongGroupSettings.TUBE_MASTER_URL)) {
tubeBaseConf.setTubeMasterUrl(extInfo.getKeyValue());
}
}
return tubeBaseConf;
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupExtInfo in project incubator-inlong by apache.
the class InlongGroupTransfer method parseUdf.
private static UserDefinedSortConf parseUdf(List<InlongGroupExtInfo> groupExtInfos) {
UserDefinedSortConf sortConf = new UserDefinedSortConf();
for (InlongGroupExtInfo extInfo : groupExtInfos) {
if (extInfo.getKeyName().equals(InlongGroupSettings.SORT_NAME)) {
sortConf.setSortName(extInfo.getKeyValue());
}
if (extInfo.getKeyName().equals(InlongGroupSettings.SORT_PROPERTIES)) {
Map<String, String> properties = GsonUtil.fromJson(extInfo.getKeyValue(), new TypeToken<Map<String, String>>() {
}.getType());
sortConf.setProperties(properties);
}
}
return sortConf;
}
use of org.apache.inlong.manager.common.pojo.group.InlongGroupExtInfo in project incubator-inlong by apache.
the class InlongGroupTransfer method parseSortBaseConf.
public static SortBaseConf parseSortBaseConf(InlongGroupResponse groupResponse) {
List<InlongGroupExtInfo> groupExtInfos = groupResponse.getExtList();
if (CollectionUtils.isEmpty(groupExtInfos)) {
return null;
}
String type = null;
for (InlongGroupExtInfo extInfo : groupExtInfos) {
if (extInfo.getKeyName().equals(InlongGroupSettings.SORT_TYPE)) {
type = extInfo.getKeyValue();
break;
}
}
if (type == null) {
return null;
}
SortType sortType = SortType.forType(type);
switch(sortType) {
case FLINK:
return parseFlinkSortConf(groupExtInfos);
case USER_DEFINED:
return parseUdf(groupExtInfos);
default:
throw new IllegalArgumentException(String.format("Unsupport sort type=%s for Inlong", sortType));
}
}
Aggregations