use of com.dtstack.taier.develop.service.develop.IComponentService in project Taier by DTStack.
the class TenantService method initDataDevelop.
@Transactional(rollbackFor = Exception.class)
public void initDataDevelop(Long clusterId, Long tenantId, Long userId, String tenantName, String tenantDesc, List<ComponentBindDBDTO> bindDBDTOList) throws Exception {
// 初始化目录
List<Component> components = componentService.listAllComponents(clusterId);
List<ComponentVO> componentVOS = ComponentVO.toVOS(components);
batchCatalogueService.initCatalogue(tenantId, userId, componentVOS);
// 初始化数据源相关的信息
IComponentService componentService = null;
for (ComponentBindDBDTO componentBindDBDTO : bindDBDTOList) {
EComponentType eComponentType = EComponentType.getByCode(componentBindDBDTO.getComponentCode());
String componentIdentity = tenantName;
// db相关的操作
if (BooleanUtils.isTrue(componentBindDBDTO.getCreateFlag())) {
componentService = multiEngineServiceFactory.getComponentService(eComponentType.getTypeCode());
componentService.createDatabase(clusterId, eComponentType, componentIdentity, tenantDesc);
} else {
componentIdentity = componentBindDBDTO.getDbName();
}
// 初始化数据源
datasourceService.initDefaultSource(clusterId, eComponentType, tenantId, componentIdentity, tenantDesc, userId);
// 初始化租户引擎关系
TenantComponent tenantEngine = new TenantComponent();
tenantEngine.setTaskType(ComponentTypeToEScheduleJobMapping.getEScheduleTypeByComponentCode(eComponentType.getTypeCode()).getType());
tenantEngine.setTenantId(tenantId);
tenantEngine.setComponentIdentity(componentIdentity);
tenantEngine.setCreateUserId(userId);
tenantEngine.setStatus(0);
developTenantComponentService.insert(tenantEngine);
}
}
use of com.dtstack.taier.develop.service.develop.IComponentService in project Taier by DTStack.
the class BatchComponentService method getAllDataBases.
/**
* 获取集群对应组件下数据源中的databases
*
* @param clusterId 集群ID
* @param componentTypeCode 组件类型
* @return
*/
public List<String> getAllDataBases(Long clusterId, Integer componentTypeCode) {
EComponentType eComponentType = EComponentType.getByCode(componentTypeCode);
IComponentService componentService = multiEngineServiceFactory.getComponentService(componentTypeCode);
return componentService.getAllDataBases(clusterId, eComponentType, "");
}
Aggregations