Interface JobRepository

  • All Known Implementing Classes:
    SimpleJobRepository

    public interface JobRepository

    Repository responsible for persistence of batch meta-data entities.

    Author:
    Lucas Ward, Dave Syer, Robert Kasanicky, David Turanski, Michael Minella, Mahmoud Ben Hassine
    See Also:
    JobInstance, JobExecution, StepExecution
    • Method Detail

      • isJobInstanceExists

        boolean isJobInstanceExists​(java.lang.String jobName,
                                    JobParameters jobParameters)
        Check if an instance of this job already exists with the parameters provided.
        Parameters:
        jobName - the name of the job
        jobParameters - the parameters to match
        Returns:
        true if a JobInstance already exists for this job name and job parameters
      • createJobInstance

        JobInstance createJobInstance​(java.lang.String jobName,
                                      JobParameters jobParameters)
        Create a new JobInstance with the name and job parameters provided.
        Parameters:
        jobName - logical name of the job
        jobParameters - parameters used to execute the job
        Returns:
        the new JobInstance
      • createJobExecution

        JobExecution createJobExecution​(JobInstance jobInstance,
                                        JobParameters jobParameters,
                                        java.lang.String jobConfigurationLocation)
        Create a new JobExecution based upon the JobInstance it's associated with, the JobParameters used to execute it with and the location of the configuration file that defines the job.
        Parameters:
        jobInstance - JobInstance instance to initialize the new JobExecution.
        jobParameters - JobParameters instance to initialize the new JobExecution.
        jobConfigurationLocation - String instance to initialize the new JobExecution.
        Returns:
        the new JobExecution.
      • addAll

        void addAll​(java.util.Collection<StepExecution> stepExecutions)
        Save a collection of StepExecutions and each ExecutionContext. The StepExecution ID will be assigned - it is not permitted that an ID be assigned before calling this method. Instead, it should be left blank, to be assigned by JobRepository. Preconditions: StepExecution must have a valid Step.
        Parameters:
        stepExecutions - collection of StepExecution instances to be added to the repo.
      • getLastStepExecution

        @Nullable
        StepExecution getLastStepExecution​(JobInstance jobInstance,
                                           java.lang.String stepName)
        Parameters:
        jobInstance - JobInstance instance containing the step executions.
        stepName - the name of the step execution that might have run.
        Returns:
        the last execution of step for the given job instance.
      • getStepExecutionCount

        int getStepExecutionCount​(JobInstance jobInstance,
                                  java.lang.String stepName)
        Parameters:
        jobInstance - JobInstance instance containing the step executions.
        stepName - the name of the step execution that might have run.
        Returns:
        the execution count of the step within the given job instance.
      • getLastJobExecution

        @Nullable
        JobExecution getLastJobExecution​(java.lang.String jobName,
                                         JobParameters jobParameters)
        Parameters:
        jobName - the name of the job that might have run
        jobParameters - parameters identifying the JobInstance
        Returns:
        the last execution of job if exists, null otherwise