Search in sources :

Example 41 with RequestResult

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

the class NamespaceZkClusterMappingController method moveNamespaceBatch.

@RequestMapping(value = "moveNamespaceBatch", method = RequestMethod.POST)
public RequestResult moveNamespaceBatch(HttpServletRequest request, String namespaces, String zkClusterKeyNew, boolean updateDBOnly) {
    RequestResult requestResult = new RequestResult();
    try {
        if (namespaces == null || namespaces.trim().isEmpty()) {
            throw new SaturnJobConsoleException("The namespace cannot be null");
        }
        if (zkClusterKeyNew == null || zkClusterKeyNew.trim().isEmpty()) {
            throw new SaturnJobConsoleException("The zkClusterKeyNew cannot be null");
        }
        namespaceZkClusterMappingService.moveNamespaceBatchTo(namespaces, zkClusterKeyNew, "", updateDBOnly);
        requestResult.setSuccess(true);
    } catch (SaturnJobConsoleException e) {
        requestResult.setSuccess(false);
        requestResult.setMessage(e.getMessage());
    } 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) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 42 with RequestResult

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

the class NamespaceZkClusterMappingController method clearMoveNamespaceBatchStatus.

@RequestMapping(value = "clearMoveNamespaceBatchStatus", method = RequestMethod.POST)
public RequestResult clearMoveNamespaceBatchStatus(HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    try {
        namespaceZkClusterMappingService.clearMoveNamespaceBatchStatus();
        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) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 43 with RequestResult

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

the class NamespaceZkClusterMappingController method initNamespaceZkClusterMapping.

@RequestMapping(value = "initNamespaceZkClusterMapping", method = RequestMethod.POST)
public RequestResult initNamespaceZkClusterMapping(HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    try {
        namespaceZkClusterMappingService.initNamespaceZkClusterMapping("");
        requestResult.setSuccess(true);
    } catch (SaturnJobConsoleException e) {
        requestResult.setSuccess(false);
        requestResult.setMessage(e.getMessage());
    } 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) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 44 with RequestResult

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

the class SaturnJunkDataController method removeJunkData.

@ResponseBody
@RequestMapping(value = "removeJunkData", method = RequestMethod.POST)
public RequestResult removeJunkData(HttpServletRequest request, SaturnJunkData saturnJunkData, HttpSession session) {
    RequestResult requestResult = new RequestResult();
    try {
        saturnJunkDataService.removeSaturnJunkData(saturnJunkData);
        LOGGER.info("[removeJunkData success, saturnJunkData is {}]", saturnJunkData);
        requestResult.setSuccess(true);
    } catch (Throwable t) {
        requestResult.setSuccess(false);
        if (t instanceof SaturnJobConsoleException) {
            requestResult.setMessage(t.getMessage());
        } else {
            requestResult.setMessage(t.toString());
        }
        LOGGER.error("[removeJunkData error, saturnJunkData is " + saturnJunkData + "]", t);
    }
    return requestResult;
}
Also used : RequestResult(com.vip.saturn.job.console.domain.RequestResult) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 45 with RequestResult

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

the class SaturnJunkDataController method getJunkData.

@ResponseBody
@RequestMapping(value = "getJunkdata", method = RequestMethod.GET)
public RequestResult getJunkData(HttpServletRequest request, String newZkClusterKey) {
    RequestResult requestResult = new RequestResult();
    try {
        List<SaturnJunkData> junkData = saturnJunkDataService.getJunkData(newZkClusterKey);
        requestResult.setSuccess(true);
        requestResult.setObj(junkData);
    } catch (Throwable t) {
        requestResult.setSuccess(false);
        if (t instanceof SaturnJobConsoleException) {
            requestResult.setMessage(t.getMessage());
        } else {
            requestResult.setMessage(t.toString());
        }
        LOGGER.error(t.getMessage(), t);
    }
    return requestResult;
}
Also used : RequestResult(com.vip.saturn.job.console.domain.RequestResult) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) SaturnJunkData(com.vip.saturn.job.console.domain.SaturnJunkData) ResponseBody(org.springframework.web.bind.annotation.ResponseBody) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

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