Search in sources :

Example 1 with RequestResult

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

the class ExecutorServiceImpl method shardAllAtOnce.

@Override
public RequestResult shardAllAtOnce() throws SaturnJobConsoleException {
    try {
        RequestResult requestResult = new RequestResult();
        CuratorFrameworkOp curatorFrameworkOp = curatorRepository.inSessionClient();
        String shardAllAtOnceNodePath = ExecutorNodePath.getExecutorShardingNodePath("shardAllAtOnce");
        if (curatorFrameworkOp.checkExists(shardAllAtOnceNodePath)) {
            curatorFrameworkOp.deleteRecursive(shardAllAtOnceNodePath);
        }
        curatorFrameworkOp.create(shardAllAtOnceNodePath);
        requestResult.setMessage("");
        requestResult.setSuccess(true);
        return requestResult;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        throw new SaturnJobConsoleException(e);
    }
}
Also used : RequestResult(com.vip.saturn.job.console.domain.RequestResult) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) SaturnJobConsoleHttpException(com.vip.saturn.job.console.exception.SaturnJobConsoleHttpException) SaturnJobConsoleException(com.vip.saturn.job.console.exception.SaturnJobConsoleException) CuratorFrameworkOp(com.vip.saturn.job.console.repository.zookeeper.CuratorRepository.CuratorFrameworkOp)

Example 2 with RequestResult

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

the class ContainerController method getTimeZoneIds.

@RequestMapping(value = "/getTimeZoneIds", method = RequestMethod.GET)
public RequestResult getTimeZoneIds(HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    requestResult.setSuccess(true);
    requestResult.setObj(SaturnConstants.TIME_ZONE_IDS);
    return requestResult;
}
Also used : RequestResult(com.vip.saturn.job.console.domain.RequestResult) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with RequestResult

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

the class ContainerController method getRegistryRepositoryTags.

@RequestMapping(value = "/getRegistryRepositoryTags", method = RequestMethod.GET)
public RequestResult getRegistryRepositoryTags(String repository, HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    try {
        if (repository == null) {
            throw new SaturnJobConsoleException("The repository cannot be null");
        }
        String constraints = containerService.getRegistryRepositoryTags(repository);
        requestResult.setSuccess(true);
        requestResult.setObj(constraints);
    } 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 4 with RequestResult

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

the class ContainerController method getRegistryCatalog.

@RequestMapping(value = "/getRegistryCatalog", method = RequestMethod.GET)
public RequestResult getRegistryCatalog(HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    try {
        String registryCatalog = containerService.getRegistryCatalog();
        requestResult.setSuccess(true);
        requestResult.setObj(registryCatalog);
    } 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 5 with RequestResult

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

the class ContainerController method removeContainer.

@RequestMapping(value = "/removeContainer", method = RequestMethod.POST)
public RequestResult removeContainer(String taskId, HttpServletRequest request) {
    RequestResult requestResult = new RequestResult();
    try {
        if (taskId == null) {
            throw new SaturnJobConsoleException("The taskId cannot be null");
        }
        containerService.removeContainer(taskId);
        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)

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