Search in sources :

Example 31 with RequestResult

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

the class ContainerController method getContainerToken.

@RequestMapping(value = "getContainerToken", method = RequestMethod.GET)
public RequestResult getContainerToken(HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    try {
        Object containerToken = containerService.getContainerToken();
        requestResult.setSuccess(true);
        requestResult.setObj(containerToken);
    } catch (SaturnJobConsoleException e) {
        requestResult.setSuccess(false);
        requestResult.setMessage(e.getMessage());
    } catch (Throwable t) {
        requestResult.setSuccess(false);
        requestResult.setMessage(t.toString());
    }
    return requestResult;
}
Also used : RequestResult(com.vip.saturn.job.console.domain.RequestResult) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 32 with RequestResult

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

the class ContainerController method updateContainerInstances.

@RequestMapping(value = "/updateContainerInstances", method = RequestMethod.POST)
public RequestResult updateContainerInstances(String taskId, Integer instances, HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    try {
        if (taskId == null) {
            throw new SaturnJobConsoleException("The taskId cannot be null");
        }
        if (instances == null || instances < 0) {
            throw new SaturnJobConsoleException("Please input the positive instances");
        }
        containerService.updateContainerInstances(taskId, instances);
        requestResult.setSuccess(true);
    } catch (SaturnJobConsoleException e) {
        requestResult.setSuccess(false);
        requestResult.setMessage(e.getMessage());
    } catch (Throwable t) {
        requestResult.setSuccess(false);
        requestResult.setMessage(t.toString());
    }
    return requestResult;
}
Also used : RequestResult(com.vip.saturn.job.console.domain.RequestResult) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 33 with RequestResult

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

the class ContainerController method getContainerVos.

@RequestMapping(value = "/getContainerVos", method = RequestMethod.GET)
public RequestResult getContainerVos(HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    try {
        List<ContainerVo> containerVos = containerService.getContainerVos();
        requestResult.setSuccess(true);
        requestResult.setObj(containerVos);
    } catch (SaturnJobConsoleException e) {
        requestResult.setSuccess(false);
        requestResult.setMessage(e.getMessage());
    } catch (Throwable t) {
        requestResult.setSuccess(false);
        requestResult.setMessage(t.toString());
    }
    return requestResult;
}
Also used : RequestResult(com.vip.saturn.job.console.domain.RequestResult) ContainerVo(com.vip.saturn.job.console.domain.container.vo.ContainerVo) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 34 with RequestResult

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

the class DashboardRefreshController method dashboardRefresh.

@RequestMapping(value = "dashboardRefresh", method = RequestMethod.POST)
@ResponseBody
public RequestResult dashboardRefresh(String zkClusterKey, HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    try {
        long beforeRefresh = System.currentTimeMillis();
        doDashboardRefresh(zkClusterKey);
        long afterRefresh = System.currentTimeMillis();
        long takeTime = afterRefresh - beforeRefresh;
        requestResult.setSuccess(true);
        requestResult.setObj(takeTime);
    } 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) 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 35 with RequestResult

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

the class JobConfigController method load.

@RequestMapping(value = "jobconfig/getExportRegList", method = RequestMethod.GET)
@ResponseBody
public RequestResult load(HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    try {
        List<RegistryCenterConfiguration> regCenterConfList = jobConfigInitializationService.getRegistryCenterConfigurations();
        requestResult.setSuccess(true);
        requestResult.setObj(regCenterConfList);
    } 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) RegistryCenterConfiguration(com.vip.saturn.job.console.domain.RegistryCenterConfiguration) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

RequestResult (com.vip.saturn.job.console.domain.RequestResult)49 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 Gson (com.google.gson.Gson)1 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