Search in sources :

Example 1 with GetJobConfigVo

use of com.vip.saturn.job.console.vo.GetJobConfigVo in project Saturn by vipshop.

the class JobServiceImpl method getJobConfigVo.

@Override
public GetJobConfigVo getJobConfigVo(String namespace, String jobName) throws SaturnJobConsoleException {
    JobConfig4DB jobConfig4DB = currentJobConfigService.findConfigByNamespaceAndJobName(namespace, jobName);
    if (jobConfig4DB == null) {
        throw new SaturnJobConsoleException(ERROR_CODE_NOT_EXISTED, String.format("该作业(%s)不存在", jobName));
    }
    GetJobConfigVo getJobConfigVo = new GetJobConfigVo();
    JobConfig jobConfig = new JobConfig();
    SaturnBeanUtils.copyProperties(jobConfig4DB, jobConfig);
    jobConfig.setDefaultValues();
    getJobConfigVo.copyFrom(jobConfig);
    getJobConfigVo.setTimeZonesProvided(Arrays.asList(TimeZone.getAvailableIDs()));
    getJobConfigVo.setPreferListProvided(getCandidateExecutors(namespace, jobName));
    getJobConfigVo.setUpStreamProvided(getCandidateUpStream(namespace, jobConfig));
    getJobConfigVo.setDownStreamProvided(getCandidateDownStream(namespace, jobConfig));
    CuratorRepository.CuratorFrameworkOp curatorFrameworkOp = registryCenterService.getCuratorFrameworkOp(namespace);
    getJobConfigVo.setStatus(getJobStatus(getJobConfigVo.getJobName(), curatorFrameworkOp, getJobConfigVo.getEnabled()));
    return getJobConfigVo;
}
Also used : CuratorRepository(com.vip.saturn.job.console.repository.zookeeper.CuratorRepository) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) CuratorFrameworkOp(com.vip.saturn.job.console.repository.zookeeper.CuratorRepository.CuratorFrameworkOp) JobConfig4DB(com.vip.saturn.job.console.mybatis.entity.JobConfig4DB) GetJobConfigVo(com.vip.saturn.job.console.vo.GetJobConfigVo)

Aggregations

SaturnJobConsoleException (com.vip.saturn.job.console.exception.SaturnJobConsoleException)1 JobConfig4DB (com.vip.saturn.job.console.mybatis.entity.JobConfig4DB)1 CuratorRepository (com.vip.saturn.job.console.repository.zookeeper.CuratorRepository)1 CuratorFrameworkOp (com.vip.saturn.job.console.repository.zookeeper.CuratorRepository.CuratorFrameworkOp)1 GetJobConfigVo (com.vip.saturn.job.console.vo.GetJobConfigVo)1