Search in sources :

Example 46 with RequestResult

use of com.vip.saturn.job.console.domain.RequestResult in project Saturn by vipshop.

the class SystemConfigController method queryValue.

@RequestMapping(value = "system_config/queryValue", method = RequestMethod.POST)
@ResponseBody
public RequestResult queryValue(HttpServletRequest request, String property1) {
    RequestResult requestResult = new RequestResult();
    try {
        List<String> properties = new ArrayList<>();
        if (property1 != null) {
            String[] split = property1.split(",");
            if (split != null) {
                for (String s : split) {
                    if (s != null && s.trim().length() > 0) {
                        String tmp = s.trim();
                        if (!properties.contains(tmp)) {
                            properties.add(tmp);
                        }
                    }
                }
            }
        }
        List<SystemConfig> systemConfigs = systemConfigService.getSystemConfigsDirectly(properties);
        requestResult.setSuccess(true);
        requestResult.setObj(systemConfigs);
    } catch (SaturnJobConsoleException e) {
        requestResult.setSuccess(false);
        requestResult.setMessage(e.getMessage());
        return requestResult;
    } catch (Exception e) {
        LOGGER.error(e.getMessage(), e);
        requestResult.setSuccess(false);
        requestResult.setMessage(e.toString());
    }
    return requestResult;
}
Also used : RequestResult(com.vip.saturn.job.console.domain.RequestResult) SystemConfig(com.vip.saturn.job.console.mybatis.entity.SystemConfig) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) ArrayList(java.util.ArrayList) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 47 with RequestResult

use of com.vip.saturn.job.console.domain.RequestResult in project Saturn by vipshop.

the class ZKDBDiffController method diffByJob.

/**
 * 对比zk和db的job config数据差异。所有对比都在当前console进行。
 *
 * @param request
 * @param jobName   作业名
 * @param namespace
 * @return
 */
@RequestMapping(value = "zk_db_diff/diffByJob", method = RequestMethod.GET)
@ResponseBody
public RequestResult diffByJob(HttpServletRequest request, String jobName, String namespace) {
    RequestResult requestResult = new RequestResult();
    try {
        JobDiffInfo jobDiffInfo = zkDBDiffService.diffByJob(namespace, jobName);
        requestResult.setSuccess(true);
        requestResult.setObj(jobDiffInfo);
    } catch (Exception e) {
        requestResult.setSuccess(false);
        requestResult.setMessage(e.toString());
    }
    return requestResult;
}
Also used : RequestResult(com.vip.saturn.job.console.domain.RequestResult) JobDiffInfo(com.vip.saturn.job.console.domain.JobDiffInfo) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) IOException(java.io.IOException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 48 with RequestResult

use of com.vip.saturn.job.console.domain.RequestResult in project Saturn by vipshop.

the class ZkClusterInfoController method getAllZkClusterInfo.

@RequestMapping(value = "getAllZkClusterInfo", method = RequestMethod.GET)
public RequestResult getAllZkClusterInfo(HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    try {
        List<ZkClusterInfo> allZkClusterInfo = zkClusterInfoService.getAllZkClusterInfo();
        requestResult.setObj(allZkClusterInfo);
        requestResult.setSuccess(true);
    } catch (Throwable t) {
        LOGGER.error(t.getMessage(), t);
        requestResult.setSuccess(false);
        requestResult.setMessage(t.toString());
    }
    return requestResult;
}
Also used : RequestResult(com.vip.saturn.job.console.domain.RequestResult) ZkClusterInfo(com.vip.saturn.job.console.mybatis.entity.ZkClusterInfo) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

RequestResult (com.vip.saturn.job.console.domain.RequestResult)48 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)45 SaturnJobConsoleException (com.vip.saturn.job.console.exception.SaturnJobConsoleException)38 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)12 ParseException (java.text.ParseException)11 IOException (java.io.IOException)3 ExecutorProvided (com.vip.saturn.job.console.domain.ExecutorProvided)2 ExportJobConfigPageStatus (com.vip.saturn.job.console.domain.ExportJobConfigPageStatus)2 JobDiffInfo (com.vip.saturn.job.console.domain.JobDiffInfo)2 JobMigrateInfo (com.vip.saturn.job.console.domain.JobMigrateInfo)2 SystemConfig (com.vip.saturn.job.console.mybatis.entity.SystemConfig)2 CuratorFrameworkOp (com.vip.saturn.job.console.repository.zookeeper.CuratorRepository.CuratorFrameworkOp)2 MultipartFile (org.springframework.web.multipart.MultipartFile)2 JobBriefInfo (com.vip.saturn.job.console.domain.JobBriefInfo)1 JobConfig (com.vip.saturn.job.console.domain.JobConfig)1 MoveNamespaceBatchStatus (com.vip.saturn.job.console.domain.MoveNamespaceBatchStatus)1 NamespaceZkClusterMappingVo (com.vip.saturn.job.console.domain.NamespaceZkClusterMappingVo)1 RegistryCenterConfiguration (com.vip.saturn.job.console.domain.RegistryCenterConfiguration)1 SaturnJunkData (com.vip.saturn.job.console.domain.SaturnJunkData)1 ZkTree (com.vip.saturn.job.console.domain.ZkTree)1