Package org.springframework.xd.dirt.plugins.job

Examples of org.springframework.xd.dirt.plugins.job.ExpandedJobParametersConverter


      throw new org.springframework.xd.dirt.job.JobExecutionAlreadyRunningException(
          "Job Execution for this job is already running: " + jobExecution.getJobInstance());
    }

    final JobInstance lastInstance = jobExecution.getJobInstance();
    final ExpandedJobParametersConverter expandedJobParametersConverter = new ExpandedJobParametersConverter();
    final JobParameters jobParameters = jobExecution.getJobParameters();

    final Job job;
    try {
      job = jobLocator.getJob(lastInstance.getJobName());
    }
    catch (NoSuchJobException e1) {
      throw new org.springframework.xd.dirt.job.NoSuchBatchJobException("The job '" + lastInstance.getJobName()
          + "' does not exist.");
    }
    try {
      job.getJobParametersValidator().validate(jobParameters);
    }
    catch (JobParametersInvalidException e) {
      throw new org.springframework.xd.dirt.job.JobParametersInvalidException(
          "The Job Parameters for Job Execution " + jobExecution.getId()
          + " are invalid.");
    }

    final BatchStatus status = jobExecution.getStatus();

    if (status == BatchStatus.COMPLETED || status == BatchStatus.ABANDONED) {
      throw new org.springframework.xd.dirt.job.JobInstanceAlreadyCompleteException(
          "Job Execution " + jobExecution.getId() + " is already complete.");
    }

    if (!job.isRestartable()) {
      throw new org.springframework.xd.dirt.job.JobRestartException(
          "The job '" + lastInstance.getJobName() + "' is not restartable.");
    }

    final String jobParametersAsString = expandedJobParametersConverter
        .getJobParametersAsString(jobParameters, true);
    jobDeployer.launch(lastInstance.getJobName(), jobParametersAsString);
  }
View Full Code Here

TOP

Related Classes of org.springframework.xd.dirt.plugins.job.ExpandedJobParametersConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.