diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobInstance.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobInstance.java index da967b099..14fcd8d62 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobInstance.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobInstance.java @@ -46,7 +46,7 @@ public class JobInstance extends Entity { public JobInstance(Long id, JobParameters jobParameters) { super(id); - Assert.notNull(jobParameters, "JobInstanceProperties must not be null."); + Assert.notNull(jobParameters, "JobParameters must not be null."); this.jobParameters = jobParameters; } @@ -84,9 +84,9 @@ public class JobInstance extends Entity { } /** - * @return JobInstanceProperties + * @return {@link JobParameters} */ - public JobParameters getJobInstanceProperties() { + public JobParameters getJobParameters() { return jobParameters; } @@ -102,7 +102,7 @@ public class JobInstance extends Entity { } public String toString() { - return super.toString()+", JobInstanceProperties=["+ jobParameters +"]" + + return super.toString()+", JobParameters=["+ jobParameters +"]" + ", Job=[" + job + "]"; } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobParametersBuilder.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobParametersBuilder.java index 56e8ffe99..53a8e36f2 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobParametersBuilder.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/JobParametersBuilder.java @@ -4,7 +4,7 @@ package org.springframework.batch.core.domain; import java.util.Date; -import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.Map; import org.springframework.util.Assert; @@ -34,9 +34,9 @@ public class JobParametersBuilder { */ public JobParametersBuilder() { - this.stringMap = new HashMap(); - this.longMap = new HashMap(); - this.dateMap = new HashMap(); + this.stringMap = new LinkedHashMap(); + this.longMap = new LinkedHashMap(); + this.dateMap = new LinkedHashMap(); } /** diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/JobLauncher.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/JobLauncher.java index de5b28c50..a0c654758 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/JobLauncher.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/JobLauncher.java @@ -35,7 +35,7 @@ import org.springframework.batch.core.repository.JobExecutionAlreadyRunningExcep public interface JobLauncher { /** - * Start a job execution for the given Job and JobInstanceProperties. + * Start a job execution for the given {@link Job} and {@link JobParameters}. * * @return the exit code from the job if it returns synchronously. If the * implementation is asynchronous, the status might well be unknown. diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/SimpleJobLauncher.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/SimpleJobLauncher.java index 4a1b74b42..d2fb28e68 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/SimpleJobLauncher.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/launch/SimpleJobLauncher.java @@ -19,6 +19,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.batch.core.domain.Job; import org.springframework.batch.core.domain.JobExecution; +import org.springframework.batch.core.domain.JobInstance; import org.springframework.batch.core.domain.JobParameters; import org.springframework.batch.core.executor.JobExecutor; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; @@ -63,12 +64,12 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean{ private TaskExecutor taskExecutor = new SyncTaskExecutor(); /** - * Run the provided job with the given JobInstanceProperties. The JobInstanceProperties will + * Run the provided job with the given {@link JobParameters}. The {@link JobParameters} will * be used to determine if this is an execution of an existing job instance, or if a new * one should be created. * - * @param Job, the job to be run. - * @param JobInstanceProperties, the JobInstanceProperties for this particular execution. + * @param job, the job to be run. + * @param jobParameters, the {@link JobParameters} for this particular execution. * @return JobExecutionAlreadyRunningException if the JobInstance already exists and has * an execution already running. */ @@ -76,7 +77,7 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean{ throws JobExecutionAlreadyRunningException { Assert.notNull(job, "The Job must not be null."); - Assert.notNull(jobParameters, "The JobInstanceProperties must not be null."); + Assert.notNull(jobParameters, "The JobParameters must not be null."); final JobExecution jobExecution = jobRepository.createJobExecution(job, jobParameters); diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java index ce2b40b13..08b701a06 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java @@ -136,7 +136,7 @@ public class SimpleJobRepository implements JobRepository { throws JobExecutionAlreadyRunningException { Assert.notNull(job, "Job must not be null."); - Assert.notNull(jobParameters, "JobInstanceProperties must not be null."); + Assert.notNull(jobParameters, "JobParameters must not be null."); List jobs = new ArrayList(); JobInstance jobInstance; diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobDao.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobDao.java index da87b710b..b8dc53837 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobDao.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobDao.java @@ -122,7 +122,7 @@ public class JdbcJobDao implements JobDao, InitializingBean { public JobInstance createJobInstance(String jobName, JobParameters jobParameters) { Assert.notNull(jobName, "Job Name must not be null."); - Assert.notNull(jobParameters, "JobInstanceProperties must not be null."); + Assert.notNull(jobParameters, "JobParameters must not be null."); Long jobId = new Long(jobIncrementer.nextLongValue()); Object[] parameters = new Object[] { jobId, jobName, createJobKey(jobParameters) }; @@ -168,7 +168,7 @@ public class JdbcJobDao implements JobDao, InitializingBean { public List findJobInstances(final String jobName, final JobParameters jobParameters) { Assert.notNull(jobName, "Job Name must not be null."); - Assert.notNull(jobParameters, "JobInstanceProperties must not be null."); + Assert.notNull(jobParameters, "JobParameters must not be null."); Object[] parameters = new Object[] { jobName, createJobKey(jobParameters) }; diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/MapJobDao.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/MapJobDao.java index ea2a9c8e1..e4bccc8c3 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/MapJobDao.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/repository/dao/MapJobDao.java @@ -57,7 +57,7 @@ public class MapJobDao implements JobDao { List list = new ArrayList(); for (Iterator iter = jobsById.values().iterator(); iter.hasNext();) { JobInstance jobInstance = (JobInstance) iter.next(); - if (jobInstance.getJobName().equals(jobName) && jobInstance.getJobInstanceProperties().equals(jobParameters)) { + if (jobInstance.getJobName().equals(jobName) && jobInstance.getJobParameters().equals(jobParameters)) { list.add(jobInstance); } } diff --git a/spring-batch-execution/src/main/java/org/springframework/batch/execution/resource/DefaultJobInstanceLabelGenerator.java b/spring-batch-execution/src/main/java/org/springframework/batch/execution/resource/DefaultJobInstanceLabelGenerator.java index 10f1a7c95..a78b65eb2 100644 --- a/spring-batch-execution/src/main/java/org/springframework/batch/execution/resource/DefaultJobInstanceLabelGenerator.java +++ b/spring-batch-execution/src/main/java/org/springframework/batch/execution/resource/DefaultJobInstanceLabelGenerator.java @@ -49,7 +49,7 @@ public class DefaultJobInstanceLabelGenerator implements JobInstanceLabelGenerat return null; } StringBuilder builder = new StringBuilder(""+jobInstance.getJobName()); - Map map = jobInstance.getJobInstanceProperties().getParameters(); + Map map = jobInstance.getJobParameters().getParameters(); for (Iterator iterator = map.values().iterator(); iterator.hasNext();) { Object value = iterator.next(); builder.append("-" + ((value instanceof Date) ? dateFormat.format(value) : ""+value)); diff --git a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java index 770110451..2898fc561 100644 --- a/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java +++ b/spring-batch-execution/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java @@ -107,7 +107,7 @@ public abstract class AbstractJobDaoTests extends assertTrue(jobs.size() == 1); JobInstance tempJob = (JobInstance) jobs.get(0); assertTrue(jobInstance.equals(tempJob)); - assertEquals(jobParameters, tempJob.getJobInstanceProperties()); + assertEquals(jobParameters, tempJob.getJobParameters()); } public void testFindJobWithNullRuntime() { @@ -138,7 +138,7 @@ public abstract class AbstractJobDaoTests extends jobs = jobDao.findJobInstances("ScheduledJob", jobParameters); assertEquals(1, jobs.size()); JobInstance jobInstance = (JobInstance) jobs.get(0); - assertEquals(jobParameters, jobInstance.getJobInstanceProperties()); + assertEquals(jobParameters, jobInstance.getJobParameters()); jobs = jobDao.findJobInstances("ScheduledJob", tempProps); assertEquals(0, jobs.size()); @@ -263,7 +263,7 @@ public abstract class AbstractJobDaoTests extends assertEquals(1, jobs.size()); assertEquals(jobParameters.getString("job.key"), ((JobInstance) jobs.get(0)) - .getJobInstanceProperties().getString("job.key")); + .getJobParameters().getString("job.key")); }