コード例 #1
0
 /**
  * Request removal of an existing resource definition (stream or job).
  *
  * @param name the name of an existing definition (required)
  */
 @RequestMapping(value = "/definitions/{name}", method = RequestMethod.DELETE)
 @ResponseStatus(HttpStatus.OK)
 public void delete(@PathVariable("name") String name) throws Exception {
   super.delete(name);
   if (moduleDefinitionService.findDefinition(
           ComposedJobUtil.getComposedJobModuleName(name), ModuleType.job)
       != null) {
     moduleDefinitionService.delete(
         ComposedJobUtil.getComposedJobModuleName(name), ModuleType.job);
   }
 }
コード例 #2
0
 /** Request removal of all definitions. */
 @RequestMapping(value = "/definitions", method = RequestMethod.DELETE)
 @ResponseStatus(HttpStatus.OK)
 public void deleteAll() throws Exception {
   Iterable<JobDefinition> jobDefinitions = deployer.findAll();
   super.deleteAll();
   for (JobDefinition jobDefinition : jobDefinitions) {
     if (moduleDefinitionService.findDefinition(
             ComposedJobUtil.getComposedJobModuleName(jobDefinition.getName()), ModuleType.job)
         != null) {
       moduleDefinitionService.delete(
           ComposedJobUtil.getComposedJobModuleName(jobDefinition.getName()), ModuleType.job);
     }
   }
 }
コード例 #3
0
 @Override
 @RequestMapping(value = "/definitions", method = RequestMethod.POST)
 @ResponseStatus(HttpStatus.CREATED)
 public void save(
     @RequestParam("name") String name,
     @RequestParam("definition") String definition,
     @RequestParam(value = "deploy", defaultValue = "true") boolean deploy)
     throws Exception {
   // Verify if the batch job repository already has the job with the same name.
   if (distributedJobLocator.getJobNames().contains(name)) {
     throw new BatchJobAlreadyExistsException(name);
   }
   if (ComposedJobUtil.isComposedJobDefinition(definition)) {
     moduleDefinitionService.compose(
         ComposedJobUtil.getComposedJobModuleName(name), ModuleType.job, definition, false);
   } else {
     ComposedJobUtil.validateNotSingleJobInstance(definition, distributedJobLocator.getJobNames());
   }
   super.save(name, definition, deploy);
 }