Package org.springframework.batch.core

Examples of org.springframework.batch.core.JobInstance


  @Override
  public JobInstance createJobInstance(String jobName, JobParameters jobParameters) {
    Assert.notNull(jobName, "Job name must not be null.");
    Assert.notNull(jobParameters, "JobParameters must not be null.");

    JobInstance jobInstance = null;
    try {
      CreateJobInstanceReq request = JobRepositoryRpcFactory.buildCreateJobInstanceReq(jobName, jobParameters);
      CreateJobInstanceRes response = (CreateJobInstanceRes) getAppmasterScOperations().doMindRequest(request);
      jobInstance = JobRepositoryRpcFactory.convertJobInstanceType(response.jobInstance);
    } catch (Exception e) {
View Full Code Here


    return JobRepositoryRpcFactory.convertStepExecutionType(response.stepExecution);
  }

  @Override
  public JobInstance getJobInstance(Long instanceId) {
    JobInstance jobInstance = null;
    try {
      GetJobInstanceReq request = JobRepositoryRpcFactory.buildGetJobInstanceReq(instanceId);
      GetJobInstanceRes response = (GetJobInstanceRes) getAppmasterScOperations().doMindRequest(request);
      jobInstance = JobRepositoryRpcFactory.convertJobInstanceType(response.jobInstance);
    } catch (Exception e) {
View Full Code Here

    return response;
  }

  private BaseResponseObject handleGetStepExecutionCountReq(GetStepExecutionCountReq request) {
    GetStepExecutionCountRes response = null;
    JobInstance jobInstance = JobRepositoryRpcFactory.convertJobInstanceType(request.jobInstance);
    int stepExecutionCount = jobRepository.getStepExecutionCount(jobInstance, request.stepName);
    response = new GetStepExecutionCountRes();
    response.count = stepExecutionCount;
    return response;
  }
View Full Code Here

    return response;
  }

  private BaseResponseObject handleGetLastStepExecutionReq(GetLastStepExecutionReq request) {
    GetLastStepExecutionRes response = null;
    JobInstance jobInstance = JobRepositoryRpcFactory.convertJobInstanceType(request.jobInstance);
    StepExecution lastStepExecution = jobRepository.getLastStepExecution(jobInstance, request.stepName);
    response = new GetLastStepExecutionRes();
    response.stepExecution = JobRepositoryRpcFactory.convertStepExecutionType(lastStepExecution);
    return response;
  }
View Full Code Here

   *
   * @param type the job execution type
   * @return converted job execution
   */
  public static JobExecution convertJobExecutionType(JobExecutionType type) {
    JobInstance jobInstance = convertJobInstanceType(type.jobInstance);
    JobParameters jobParameters = convertJobParametersType(type.jobParameters);

    JobExecution jobExecution = new JobExecution(jobInstance, type.id, jobParameters, type.jobConfigurationLocation);

    jobExecution.setVersion(type.version);
View Full Code Here

  public static JobInstance convertJobInstanceType(JobInstanceType type) {
    // TODO: null, really???
    if (type == null) {
      return null;
    }
    JobInstance jobInstance = new JobInstance(type.id, type.jobName);
    jobInstance.setVersion(type.version);
    return jobInstance;
  }
View Full Code Here

        return createJobExecutionInstance(jobName, jobParameters);
    }

    public void update(JobExecution jobExecution) {
        BatchStatus status = jobExecution.getStatus();
        JobInstance instance = jobExecution.getJobInstance();
        String jobName = instance.getJobName();
        if (BatchStatus.STARTING.equals(status)) {
            Assert.assertNull("Multiple executions for job=" + jobName, execsMap.put(jobName, jobExecution));
        } else if (BatchStatus.COMPLETED.equals(status)
                || BatchStatus.ABANDONED.equals(status)
                || BatchStatus.FAILED.equals(status)) {
View Full Code Here

        Assert.assertNotNull("No job name specified", jobName);
        Assert.assertFalse("Empty job name", jobName.length() <= 0);
        Assert.assertNotNull("No job parameters provided", jobParameters);

        Long id = Long.valueOf(idsGenerator.incrementAndGet());
        JobInstance instance = new JobInstance(id, jobName);
        return new JobExecution(instance, jobParameters);
    }
View Full Code Here

        return assertOperationPath(op, flowExecutor.getStepExecution());
    }

    protected Operation assertOperationPath(Operation op, StepExecution stepExecution) {
        JobExecution jobExecution = stepExecution.getJobExecution();
        JobInstance jobInstance = jobExecution.getJobInstance();
        return assertOperationPath(op, jobInstance.getJobName(), stepExecution.getStepName());
    }
View Full Code Here

        Mockito.when(stepExecution.getJobExecution()).thenReturn(jobExecution);
        return stepExecution;
    }

    protected JobExecution createJobExecution(String jobName) {
        JobInstance jobInstance = Mockito.mock(JobInstance.class);
        Mockito.when(jobInstance.getJobName()).thenReturn(jobName);
        JobExecution jobExecution = Mockito.mock(JobExecution.class);
        Mockito.when(jobExecution.getJobInstance()).thenReturn(jobInstance);
        return jobExecution;
    }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.JobInstance

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.