BATCH-273: JobConfiguration renamed to Job

This commit is contained in:
lucasward
2008-01-14 22:57:57 +00:00
parent f39f6625fc
commit 46276c65fd
15 changed files with 48 additions and 47 deletions

View File

@@ -20,7 +20,7 @@ import java.util.ArrayList;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.batch.core.configuration.StepConfiguration;
import org.springframework.batch.core.domain.Step;
import org.springframework.batch.core.domain.StepExecution;
import org.springframework.batch.io.file.mapping.FieldSet;
import org.springframework.batch.io.file.mapping.FieldSetMapper;
@@ -76,7 +76,7 @@ public class OrderItemReader extends AbstractItemReader {
}
/**
* @see org.springframework.batch.execution.io.FieldSetCallback#process(StepConfiguration, StepExecution)
* @see org.springframework.batch.execution.io.FieldSetCallback#process(Step, StepExecution)
*/
private void process(FieldSet fieldSet) {
//finish processing if we hit the end of file

View File

@@ -121,7 +121,7 @@
<bean id="jobLauncher"
class="org.springframework.batch.execution.launch.SimpleJobLauncher">
<property name="jobRepository" ref="simpleJobRepository" />
<property name="jobConfigurationLocator"
<property name="jobLocator"
ref="jobConfigurationRegistry" />
<property name="jobExecutor">
<bean parent="jobExecutor">
@@ -139,11 +139,11 @@
class="org.springframework.core.task.SimpleAsyncTaskExecutor" />
</property>
<property name="autoStart" value="false" />
<property name="jobConfigurationName" value="loopJob" />
<property name="jobName" value="loopJob" />
</bean>
<bean id="loader"
class="org.springframework.batch.sample.DefaultJobConfigurationLoader">
class="org.springframework.batch.sample.DefaultJobLoader">
<property name="registry" ref="jobConfigurationRegistry" />
</bean>

View File

@@ -13,7 +13,7 @@
can be integrated into a batch job.
</description>
<bean class="org.springframework.batch.execution.configuration.JobConfigurationRegistryBeanPostProcessor">
<bean class="org.springframework.batch.execution.configuration.JobRegistryBeanPostProcessor">
<property name="jobConfigurationRegistry" ref="jobConfigurationRegistry"/>
</bean>

View File

@@ -13,13 +13,13 @@
<bean parent="jobConfigurationRegistryBeanPostProcessor" />
<bean id="footballJob"
class="org.springframework.batch.core.configuration.JobConfiguration">
class="org.springframework.batch.core.domain.Job">
<property name="restartable" value="true" />
<property name="startLimit" value="100" />
<property name="steps">
<list>
<bean id="playerload"
class="org.springframework.batch.execution.step.SimpleStepConfiguration">
class="org.springframework.batch.execution.step.SimpleStep">
<property name="commitInterval" value="100"></property>
<property name="startLimit" value="100" />
<property name="saveRestartData" value="true" />
@@ -44,7 +44,7 @@
</property>
</bean>
<bean id="gameLoad"
class="org.springframework.batch.execution.step.SimpleStepConfiguration">
class="org.springframework.batch.execution.step.SimpleStep">
<property name="commitInterval" value="1000" />
<property name="startLimit" value="100" />
<property name="saveRestartData" value="true" />
@@ -68,7 +68,7 @@
</property>
</bean>
<bean id="playerSummarization"
class="org.springframework.batch.execution.step.SimpleStepConfiguration">
class="org.springframework.batch.execution.step.SimpleStep">
<property name="commitInterval" value="100" />
<property name="startLimit" value="100" />
<property name="saveRestartData" value="true" />

View File

@@ -17,7 +17,7 @@
<bean id="hibernateJob" parent="simpleJob">
<property name="steps">
<bean id="step1"
class="org.springframework.batch.execution.step.RepeatOperationsStepConfiguration">
class="org.springframework.batch.execution.step.RepeatOperationsStep">
<property name="tasklet">
<bean
class="org.springframework.batch.execution.tasklet.RestartableItemOrientedTasklet">

View File

@@ -15,7 +15,7 @@
<!-- Override the default jobExecutorFacade to provide a listener that can interrupt the job -->
<bean id="jobExecutorFacade" class="org.springframework.batch.execution.launch.SimpleJobExecutorFacade">
<property name="jobRepository" ref="simpleJobRepository" />
<property name="jobConfigurationLocator" ref="jobConfigurationRegistry"/>
<property name="jobLocator" ref="jobConfigurationRegistry"/>
<property name="jobExecutor" ref="jobExecutor" />
<property name="jobExecutionListeners">
<list>

View File

@@ -52,7 +52,7 @@
<property name="allowStartIfComplete" value="false" />
</bean>
<bean id="loading"
class="org.springframework.batch.execution.step.RepeatOperationsStepConfiguration">
class="org.springframework.batch.execution.step.RepeatOperationsStep">
<property name="tasklet">
<bean
class="org.springframework.batch.execution.tasklet.ItemOrientedTasklet">

View File

@@ -18,7 +18,7 @@
<property name="steps">
<list>
<bean id="step1"
class="org.springframework.batch.execution.step.RepeatOperationsStepConfiguration">
class="org.springframework.batch.execution.step.RepeatOperationsStep">
<property name="chunkOperations">
<bean
class="org.springframework.batch.repeat.support.RepeatTemplate">

View File

@@ -16,7 +16,7 @@
class="org.springframework.batch.execution.scope.StepScope" />
<bean id="jobConfigurationRegistryBeanPostProcessor"
class="org.springframework.batch.execution.configuration.JobConfigurationRegistryBeanPostProcessor">
class="org.springframework.batch.execution.configuration.JobRegistryBeanPostProcessor">
<property name="jobConfigurationRegistry"
ref="jobConfigurationRegistry" />
</bean>
@@ -24,13 +24,13 @@
<bean id="jobLauncher"
class="org.springframework.batch.execution.launch.SimpleJobLauncher">
<property name="jobRepository" ref="simpleJobRepository" />
<property name="jobConfigurationLocator"
<property name="jobLocator"
ref="jobConfigurationRegistry" />
<property name="jobExecutor" ref="jobExecutor" />
</bean>
<bean id="jobConfigurationRegistry"
class="org.springframework.batch.execution.configuration.MapJobConfigurationRegistry" />
class="org.springframework.batch.execution.configuration.MapJobRegistry" />
<aop:config>
<aop:advisor
@@ -104,13 +104,13 @@
</bean>
<bean id="simpleJob"
class="org.springframework.batch.core.configuration.JobConfiguration"
class="org.springframework.batch.core.domain.Job"
abstract="true">
<property name="restartable" value="true" />
</bean>
<bean id="simpleStep"
class="org.springframework.batch.execution.step.SimpleStepConfiguration"
class="org.springframework.batch.execution.step.SimpleStep"
abstract="true">
<property name="allowStartIfComplete" value="true" />
<property name="saveRestartData" value="false" />

View File

@@ -16,7 +16,7 @@
package org.springframework.batch.sample;
import org.springframework.batch.core.configuration.JobConfiguration;
import org.springframework.batch.core.domain.Job;
import org.springframework.batch.execution.launch.JobLauncher;
import org.springframework.batch.execution.runtime.DefaultJobIdentifier;
import org.springframework.context.ApplicationContext;
@@ -41,7 +41,7 @@ public abstract class AbstractBatchLauncherTests extends
private static final String CONTAINER_DEFINITION_LOCATION = "simple-container-definition.xml";
JobLauncher launcher;
private JobConfiguration jobConfiguration;
private Job job;
/*
* (non-Javadoc)
@@ -60,26 +60,27 @@ public abstract class AbstractBatchLauncherTests extends
}
/**
* Public setter for the {@link JobConfiguration} property.
* Public setter for the {@link Job} property.
*
* @param jobConfiguration
* the jobConfiguration to set
* @param job the job to set
*/
public void setJobConfiguration(JobConfiguration jobConfiguration) {
this.jobConfiguration = jobConfiguration;
public void setJob(Job job) {
this.job = job;
}
protected String getJobName() {
return jobConfiguration.getName();
return job.getName();
}
/**
* @throws Exception
* @throws Exception
*
*/
public void testLaunchJob() throws Exception {
// Make sure the job is unique by the test case that runs it, not just its name:
launcher.run(new DefaultJobIdentifier(getJobName(), this.getClass().getName()));
// Make sure the job is unique by the test case that runs it, not just
// its name:
launcher.run(new DefaultJobIdentifier(getJobName(), this.getClass()
.getName()));
launcher.stop();
}
}

View File

@@ -7,9 +7,9 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.springframework.batch.core.configuration.JobConfiguration;
import org.springframework.batch.core.configuration.ListableJobConfigurationRegistry;
import org.springframework.batch.core.configuration.NoSuchJobConfigurationException;
import org.springframework.batch.core.domain.Job;
import org.springframework.batch.core.domain.ListableJobRegistry;
import org.springframework.batch.core.domain.NoSuchJobException;
import org.springframework.beans.BeanWrapperImpl;
import org.springframework.beans.BeansException;
import org.springframework.beans.PropertyAccessorUtils;
@@ -18,10 +18,10 @@ import org.springframework.context.ApplicationContextAware;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.util.Assert;
public class DefaultJobConfigurationLoader implements JobConfigurationLoader,
public class DefaultJobLoader implements JobLoader,
ApplicationContextAware {
private ListableJobConfigurationRegistry registry;
private ListableJobRegistry registry;
private ApplicationContext applicationContext;
private Map configurations = new HashMap();
@@ -30,7 +30,7 @@ public class DefaultJobConfigurationLoader implements JobConfigurationLoader,
this.applicationContext = applicationContext;
}
public void setRegistry(ListableJobConfigurationRegistry registry) {
public void setRegistry(ListableJobRegistry registry) {
this.registry = registry;
}
@@ -38,7 +38,7 @@ public class DefaultJobConfigurationLoader implements JobConfigurationLoader,
Map result = new HashMap(configurations);
for (Iterator iterator = registry.getJobConfigurations().iterator(); iterator
.hasNext();) {
JobConfiguration configuration = (JobConfiguration) iterator.next();
Job configuration = (Job) iterator.next();
String name = configuration.getName();
if (!configurations.containsKey(name)) {
result.put(name, "<unknown path>: " + configuration);
@@ -50,7 +50,7 @@ public class DefaultJobConfigurationLoader implements JobConfigurationLoader,
public void loadResource(String path) {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
new String[] { path }, applicationContext);
String[] names = context.getBeanNamesForType(JobConfiguration.class);
String[] names = context.getBeanNamesForType(Job.class);
for (int i = 0; i < names.length; i++) {
String name = names[i];
configurations.put(name, path);
@@ -59,8 +59,8 @@ public class DefaultJobConfigurationLoader implements JobConfigurationLoader,
public Object getJobConfiguration(String name) {
try {
return registry.getJobConfiguration(name);
} catch (NoSuchJobConfigurationException e) {
return registry.getJob(name);
} catch (NoSuchJobException e) {
return null;
}
}

View File

@@ -22,13 +22,13 @@ import java.util.Map;
* @author Dave Syer
*
*/
public interface ExportedJobConfigurationLoader {
public interface ExportedJobLoader {
void loadResource(String path);
Map getConfigurations();
String getJobConfiguration(String path);
String getJob(String path);
String getProperty(String path);

View File

@@ -22,7 +22,7 @@ import java.util.Map;
* @author Dave Syer
*
*/
public interface JobConfigurationLoader {
public interface JobLoader {
void loadResource(String path);

View File

@@ -17,7 +17,7 @@
package org.springframework.batch.sample;
/**
* This job differs from FixedLengthImportJob only in internal job configuration, therefore
* This job differs from FixedLengthImportJob only in internal job, therefore
* the test is reused, only the job config location is overridden
*/
public class SimpleTaskletJobFunctionalTests extends FixedLengthImportJobFunctionalTests {

View File

@@ -8,8 +8,8 @@ import java.util.Iterator;
import java.util.List;
import java.util.Set;
import org.springframework.batch.core.configuration.JobConfiguration;
import org.springframework.batch.core.domain.BatchStatus;
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.repository.JobExecutionAlreadyRunningException;
@@ -25,7 +25,7 @@ public class JdbcJobRepositoryTests extends AbstractTransactionalDataSourceSprin
private JobRepository repository;
private JobConfiguration jobConfiguration;
private Job jobConfiguration;
private Set jobExecutionIds = new HashSet();
@@ -44,7 +44,7 @@ public class JdbcJobRepositoryTests extends AbstractTransactionalDataSourceSprin
protected void onSetUpInTransaction() throws Exception {
jobIdentifier = new ScheduledJobIdentifier("Job1", "TestStream",
new SimpleDateFormat("yyyyMMdd").parse("20070505"));
jobConfiguration = new JobConfiguration("test-job");
jobConfiguration = new Job("test-job");
jobConfiguration.setRestartable(true);
}