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

@@ -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);
}