use of com.dtstack.taier.develop.dto.devlop.DataSourceVO in project Taier by DTStack.
the class AddDatasourceController method getPrincipalsWithConf.
@ApiOperation(value = "解析kerberos文件获取principal列表")
@PostMapping("/getPrincipalsWithConf")
@FileUpload
public R<List<String>> getPrincipalsWithConf(@RequestParam(value = "file", required = false) MultipartFile file, Map<String, Object> params) {
Pair<String, String> resource = (Pair<String, String>) params.get("resource");
params.remove(RESOURCE);
DataSourceVO dataSourceVo = PublicUtil.mapToObject(params, DataSourceVO.class);
params.put(RESOURCE, resource);
return R.ok(datasourceService.getPrincipalsWithConf(dataSourceVo, resource, dataSourceVo.getUserId()));
}
use of com.dtstack.taier.develop.dto.devlop.DataSourceVO in project Taier by DTStack.
the class DatasourceService method convertParamToVO.
/**
* 转换成datasourceVo
* @param tenantId
* @param userId
* @param dscJson
* @param dataName
* @param dataSourceType
* @param dbName
* @return
*/
private DataSourceVO convertParamToVO(Long tenantId, Long userId, String dscJson, String dataName, Integer dataSourceType, String dbName) {
DataSourceVO dataSourceVO = new DataSourceVO();
dataSourceVO.setUserId(userId);
dataSourceVO.setTenantId(tenantId);
dataSourceVO.setGmtCreate(new Date());
dataSourceVO.setGmtModified(new Date());
dataSourceVO.setDataName(dataName);
dataSourceVO.setType(dataSourceType);
dataSourceVO.setSchemaName(dbName);
DataSourceTypeEnum typeEnum = DataSourceTypeEnum.valOf(dataSourceType);
Asserts.notNull(typeEnum, ErrorCode.CAN_NOT_FITABLE_SOURCE_TYPE);
dataSourceVO.setDataType(typeEnum.getDataType());
dataSourceVO.setDataVersion(typeEnum.getDataVersion());
if (Strings.isNotBlank(dscJson)) {
dataSourceVO.setDataJson(DataSourceUtils.getDataSourceJson(dscJson));
}
dataSourceVO.setIsMeta(1);
return dataSourceVO;
}
use of com.dtstack.taier.develop.dto.devlop.DataSourceVO in project Taier by DTStack.
the class DataSourceParam2SourceVOConverter method doConvert.
@Override
protected DataSourceVO doConvert(AddDataSourceParam source) {
DataSourceVO returnVo = new DataSourceVO();
returnVo.setId(source.getId());
returnVo.setUserId(source.getUserId());
returnVo.setTenantId(source.getTenantId());
returnVo.setTenantId(source.getTenantId());
returnVo.setDataName(source.getDataName());
returnVo.setDataDesc(source.getDataDesc());
returnVo.setDataType(source.getDataType());
returnVo.setDataVersion(source.getDataVersion());
returnVo.setDataJsonString(source.getDataJsonString());
if (Strings.isNotBlank(source.getDataJsonString())) {
returnVo.setDataJson(DataSourceUtils.getDataSourceJson(source.getDataJsonString()));
}
return returnVo;
}
use of com.dtstack.taier.develop.dto.devlop.DataSourceVO in project Taier by DTStack.
the class DatasourceService method initDefaultSource.
public void initDefaultSource(Long clusterId, EComponentType eComponentType, Long tenantId, String dataSourceName, String dataSourceDesc, Long userId) {
JdbcInfo jdbcInfo = Engine2DTOService.getJdbcInfoByClusterId(clusterId, eComponentType);
JSONObject dataJson = buildDataSourceDataJson(clusterId, eComponentType, jdbcInfo, dataSourceName);
DataSourceVO dataSourceVO = new DataSourceVO();
dataSourceVO.setDataDesc(org.apache.commons.lang3.StringUtils.isNotEmpty(dataSourceDesc) ? dataSourceDesc : "");
dataSourceVO.setDataJson(dataJson);
dataSourceVO.setCreateUserId(userId);
dataSourceVO.setActive(1);
dataSourceVO.setDataName(String.format("%s_%s", dataSourceName, eComponentType.getName().toUpperCase(Locale.ROOT)));
dataSourceVO.setTenantId(tenantId);
dataSourceVO.setDataType(getDatasourceTypeByComponent(eComponentType, jdbcInfo).getDataType());
dataSourceVO.setIsMeta(1);
addOrUpdate(dataSourceVO, userId);
}
use of com.dtstack.taier.develop.dto.devlop.DataSourceVO in project Taier by DTStack.
the class DatasourceService method checkConnectionById.
/**
* 测试联通性
* @param id
* @return
*/
public Boolean checkConnectionById(Long id) {
BatchDataSource dataSource = getOne(id);
DataSourceVO dataSourceVO = new DataSourceVO();
BeanUtils.copyProperties(dataSource, dataSourceVO);
dataSourceVO.setDataJson(JSONObject.parseObject(dataSource.getDataJson()));
return checkConnectionWithConf(dataSourceVO, null, null);
}
Aggregations