OPEN - issue BATCH-429: Combine the core and execution modules

Consolidate some random packages and classes with odd names.
This commit is contained in:
dsyer
2008-03-09 12:52:54 +00:00
parent 94b067be39
commit 6d4dad0788
41 changed files with 84 additions and 524 deletions

View File

@@ -1,7 +1,7 @@
<html>
<body>
<p>
Specific implementations of facade concerns.
Interfaces and simple implementations of launch concerns.
</p>
</body>
</html>

View File

@@ -24,8 +24,8 @@ import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.configuration.JobLocator;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.runtime.DefaultJobParametersFactory;
import org.springframework.batch.core.runtime.JobParametersFactory;
import org.springframework.batch.core.support.DefaultJobParametersConverter;
import org.springframework.batch.core.support.JobParametersConverter;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.beans.factory.BeanDefinitionStoreException;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
@@ -127,7 +127,7 @@ public class CommandLineJobRunner {
private SystemExiter systemExiter = new JvmSystemExiter();
private JobParametersFactory jobParametersFactory = new DefaultJobParametersFactory();
private JobParametersConverter jobParametersConverter = new DefaultJobParametersConverter();
/**
* Injection setter for the {@link JobLauncher}.
@@ -190,7 +190,7 @@ public class CommandLineJobRunner {
job = (Job) context.getBean(jobName);
}
JobParameters jobParameters = jobParametersFactory
JobParameters jobParameters = jobParametersConverter
.getJobParameters(StringUtils
.splitArrayElementsIntoProperties(parameters, "="));

View File

@@ -26,13 +26,13 @@ import java.util.Map.Entry;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.runtime.JobParametersFactory;
import org.springframework.batch.core.support.JobParametersConverter;
/**
* @author Lucas Ward
*
*/
public class ScheduledJobParametersFactory implements JobParametersFactory {
public class ScheduledJobParametersFactory implements JobParametersConverter {
public static String SCHEDULE_DATE_KEY = "schedule.date";
@@ -75,7 +75,7 @@ public class ScheduledJobParametersFactory implements JobParametersFactory {
* Convert schedule date to Date, and assume all other parameters can be
* represented by their default string value.
*
* @see org.springframework.batch.core.runtime.JobParametersFactory#getProperties(org.springframework.batch.core.JobParameters)
* @see org.springframework.batch.core.support.JobParametersConverter#getProperties(org.springframework.batch.core.JobParameters)
*/
public Properties getProperties(JobParameters params) {

View File

@@ -29,8 +29,8 @@ import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobRestartException;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.NoSuchJobException;
import org.springframework.batch.core.runtime.DefaultJobParametersFactory;
import org.springframework.batch.core.runtime.JobParametersFactory;
import org.springframework.batch.core.support.DefaultJobParametersConverter;
import org.springframework.batch.core.support.JobParametersConverter;
import org.springframework.batch.support.PropertiesConverter;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.util.Assert;
@@ -47,7 +47,7 @@ public class SimpleExportedJobLauncher implements ExportedJobLauncher, Initializ
private Map registry = new HashMap();
private JobParametersFactory jobParametersFactory = new DefaultJobParametersFactory();
private JobParametersConverter jobParametersConverter = new DefaultJobParametersConverter();
/* (non-Javadoc)
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
@@ -75,10 +75,10 @@ public class SimpleExportedJobLauncher implements ExportedJobLauncher, Initializ
/**
* Public setter for the JobParametersFactory.
* @param jobParametersFactory the jobParametersFactory to set
* @param jobParametersConverter the jobParametersFactory to set
*/
public void setJobParametersFactory(JobParametersFactory jobParametersFactory) {
this.jobParametersFactory = jobParametersFactory;
public void setJobParametersFactory(JobParametersConverter jobParametersConverter) {
this.jobParametersConverter = jobParametersConverter;
}
/*
@@ -153,7 +153,7 @@ public class SimpleExportedJobLauncher implements ExportedJobLauncher, Initializ
JobParameters jobParameters = new JobParameters();
if (params != null) {
jobParameters = jobParametersFactory.getJobParameters(PropertiesConverter.stringToProperties(params));
jobParameters = jobParametersConverter.getJobParameters(PropertiesConverter.stringToProperties(params));
}
JobExecution execution;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.launch;
package org.springframework.batch.core.launch.support;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -21,6 +21,7 @@ import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobInstance;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.repository.JobRestartException;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.repository.JobRepository;

View File

@@ -1,7 +1,7 @@
<html>
<body>
<p>
Support classes for use in bootstrap implementations or configurations.
Support classes for use in bootstrap and launch implementations or configurations.
</p>
</body>
</html>

View File

@@ -0,0 +1,7 @@
<html>
<body>
<p>
Generic implementations of core batch listener interfaces.
</p>
</body>
</html>

View File

@@ -1,7 +0,0 @@
<html>
<body>
<p>
Interfaces and generic implementations of runtime concerns.
</p>
</body>
</html>

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.runtime;
package org.springframework.batch.core.step;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.support.ExceptionClassifier;

View File

@@ -27,7 +27,6 @@ import org.springframework.batch.core.StepListener;
import org.springframework.batch.core.UnexpectedJobExecutionException;
import org.springframework.batch.core.listener.CompositeStepListener;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.core.runtime.ExitStatusExceptionClassifier;
import org.springframework.batch.core.tasklet.Tasklet;
import org.springframework.batch.item.ItemReader;
import org.springframework.batch.item.ItemStream;

View File

@@ -21,7 +21,6 @@ import java.io.StringWriter;
import org.springframework.batch.core.JobInterruptedException;
import org.springframework.batch.core.launch.support.ExitCodeMapper;
import org.springframework.batch.core.repository.NoSuchJobException;
import org.springframework.batch.core.runtime.ExitStatusExceptionClassifier;
import org.springframework.batch.repeat.ExitStatus;
/**

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.runtime;
package org.springframework.batch.core.support;
import java.text.DateFormat;
import java.text.DecimalFormat;
@@ -31,7 +31,7 @@ import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.util.StringUtils;
/**
* Factory for {@link JobParameters} instances using a simple naming convention
* Converter for {@link JobParameters} instances using a simple naming convention
* for property keys. Key names ending with "(&lt;type&gt;)" where type is one
* of string, date, long are converted to the corresponding type. The default
* type is string. E.g.
@@ -47,7 +47,7 @@ import org.springframework.util.StringUtils;
* @author Dave Syer
*
*/
public class DefaultJobParametersFactory implements JobParametersFactory {
public class DefaultJobParametersConverter implements JobParametersConverter {
public static String DATE_TYPE = "(date)";
@@ -66,7 +66,7 @@ public class DefaultJobParametersFactory implements JobParametersFactory {
* @throws IllegalArgumentException if a number or date is passed in that
* cannot be parsed, or cast to the correct type.
*
* @see org.springframework.batch.core.runtime.JobParametersFactory#getJobParameters(java.util.Properties)
* @see org.springframework.batch.core.support.JobParametersConverter#getJobParameters(java.util.Properties)
*/
public JobParameters getJobParameters(Properties props) {
@@ -124,7 +124,7 @@ public class DefaultJobParametersFactory implements JobParametersFactory {
* Use the same suffixes to create properties (omitting the string suffix
* because it is the default).
*
* @see org.springframework.batch.core.runtime.JobParametersFactory#getProperties(org.springframework.batch.core.JobParameters)
* @see org.springframework.batch.core.support.JobParametersConverter#getProperties(org.springframework.batch.core.JobParameters)
*/
public Properties getProperties(JobParameters params) {

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.batch.core.runtime;
package org.springframework.batch.core.support;
import java.util.Properties;
@@ -22,34 +22,30 @@ import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
/**
* A factory for {@link JobParameters} instances. A job can be
* executed with many possible runtime parameters, which identify the instance
* of the job. This factory allows job identifiers to be created with different
* properties according to the {@link JobParameters} strategy required. For
* example some projects or jobs need a schedule date as part of the
* {@link JobParameters} and some do not (e.g. for an ad-hoc execution a simple
* label might be enough).
* A factory for {@link JobParameters} instances. A job can be executed with
* many possible runtime parameters, which identify the instance of the job.
* This converter allows job parameters to be to and from Properties.
*
* @author Dave Syer
*
* @see JobParametersBuilder
*
*/
public interface JobParametersFactory {
public interface JobParametersConverter {
/**
* Get a new {@link JobParameters} instance. If given null, or an empty
* Get a new {@link JobParameters} instance. If given null, or an empty
* properties, an empty JobParameters will be returned.
*
* @param properties
* the runtime parameters in the form of String literals.
* @return a {@link JobParameters} properties converted to the correct types.
* @param properties the runtime parameters in the form of String literals.
* @return a {@link JobParameters} properties converted to the correct
* types.
*/
public JobParameters getJobParameters(Properties properties);
/**
* The inverse operation: get a {@link Properties} instance. If given
* null or empty JobParameters, an empty Properties should be returned.
* The inverse operation: get a {@link Properties} instance. If given null
* or empty JobParameters, an empty Properties should be returned.
*
* @param params
* @return a representation of the parameters as properties

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.batch.core.resource;
package org.springframework.batch.core.support;
import java.io.File;
import java.io.IOException;
@@ -29,8 +29,6 @@ import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.StepListener;
import org.springframework.batch.core.listener.StepListenerSupport;
import org.springframework.batch.core.runtime.DefaultJobParametersFactory;
import org.springframework.batch.core.runtime.JobParametersFactory;
import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.FileSystemResourceLoader;
import org.springframework.core.io.Resource;
@@ -61,11 +59,12 @@ import org.springframework.util.StringUtils;
*
* Note that the default pattern does not start with a separator. Because of the
* implementation of the Spring Core Resource abstractions, it would need to
* start with a double forward slash "//" to resolve to an absolute directory.<br/>
* start with a double forward slash "//" to resolve to an absolute directory
* (or else use a full URL with the file: prefix).<br/>
*
* To use this resource it must be initialised with a {@link StepExecution}.
* The best way to do that is to register it as a listener in the step that is
* going to need it. It is to enable this usage that the resource implements
* going to need it. For this reason the resource implements
* {@link StepListener}.
*
* @author Tomas Slanina
@@ -74,7 +73,7 @@ import org.springframework.util.StringUtils;
*
* @see Resource
*/
public class StepExecutionProxyResource extends StepListenerSupport implements Resource, ResourceLoaderAware,
public class StepExecutionResourceProxy extends StepListenerSupport implements Resource, ResourceLoaderAware,
StepListener {
private static final String JOB_NAME_PATTERN = "%JOB_NAME%";
@@ -85,7 +84,7 @@ public class StepExecutionProxyResource extends StepListenerSupport implements R
private String filePattern = DEFAULT_PATTERN;
private JobParametersFactory jobParametersFactory = new DefaultJobParametersFactory();
private JobParametersConverter jobParametersConverter = new DefaultJobParametersConverter();
private ResourceLoader resourceLoader = new FileSystemResourceLoader();
@@ -197,13 +196,13 @@ public class StepExecutionProxyResource extends StepListenerSupport implements R
}
/**
* Public setter for the {@link JobParametersFactory} used to translate
* Public setter for the {@link JobParametersConverter} used to translate
* {@link JobParameters} into {@link Properties}. Defaults to a
* {@link DefaultJobParametersFactory}.
* @param jobParametersFactory the {@link JobParametersFactory} to set
* {@link DefaultJobParametersConverter}.
* @param jobParametersConverter the {@link JobParametersConverter} to set
*/
public void setJobParametersFactory(JobParametersFactory jobParametersFactory) {
this.jobParametersFactory = jobParametersFactory;
public void setJobParametersFactory(JobParametersConverter jobParametersConverter) {
this.jobParametersConverter = jobParametersConverter;
}
/**
@@ -281,7 +280,7 @@ public class StepExecutionProxyResource extends StepListenerSupport implements R
public void beforeStep(StepExecution execution) {
String stepName = execution.getStepName();
String jobName = execution.getJobExecution().getJobInstance().getJobName();
Properties properties = jobParametersFactory.getProperties(execution.getJobExecution().getJobInstance()
Properties properties = jobParametersConverter.getProperties(execution.getJobExecution().getJobInstance()
.getJobParameters());
delegate = resourceLoader.getResource(createFileName(jobName, stepName, properties));
}

View File

@@ -0,0 +1,6 @@
<html>
<body>
<p>Support classes for implementations of the batch APIs. Things
like converters and resource location and management concerns.</p>
</body>
</html>

View File

@@ -20,8 +20,6 @@ import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.springframework.batch.core.BatchStatus;
import junit.framework.TestCase;
/**

View File

@@ -15,8 +15,6 @@
*/
package org.springframework.batch.core;
import org.springframework.batch.core.Entity;
import junit.framework.TestCase;
/**

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.batch.core;
import org.springframework.batch.core.JobExecutionException;
/**
* @author Dave Syer

View File

@@ -19,11 +19,8 @@ import java.util.Date;
import junit.framework.TestCase;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobInstance;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.job.JobSupport;
import org.springframework.batch.core.step.StepSupport;
import org.springframework.batch.repeat.ExitStatus;
/**

View File

@@ -15,11 +15,10 @@
*/
package org.springframework.batch.core;
import org.springframework.batch.core.JobInstance;
import org.springframework.batch.core.JobParameters;
import junit.framework.TestCase;
import org.springframework.batch.core.job.JobSupport;
/**
* @author dsyer
*

View File

@@ -15,7 +15,6 @@
*/
package org.springframework.batch.core;
import org.springframework.batch.core.JobInterruptedException;
/**
* @author Dave Syer

View File

@@ -6,9 +6,6 @@ package org.springframework.batch.core;
import java.util.Date;
import java.util.Iterator;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import junit.framework.TestCase;
/**

View File

@@ -9,8 +9,6 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import org.springframework.batch.core.JobParameters;
import junit.framework.TestCase;
/**

View File

@@ -1,145 +0,0 @@
/*
* Copyright 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core;
import java.util.ArrayList;
import java.util.List;
import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.Step;
import org.springframework.beans.factory.BeanNameAware;
import org.springframework.util.ClassUtils;
/**
* Batch domain object representing a job. Job is an explicit abstraction
* representing the configuration of a job specified by a developer. It should
* be noted that restart policy is applied to the job as a whole and not to a
* step.
*
* @author Lucas Ward
* @author Dave Syer
*/
public class JobSupport implements BeanNameAware, Job {
private List steps = new ArrayList();
private String name;
private boolean restartable = false;
private int startLimit = Integer.MAX_VALUE;
/**
* Default constructor.
*/
public JobSupport() {
super();
}
/**
* Convenience constructor to immediately add name (which is mandatory but
* not final).
*
* @param name
*/
public JobSupport(String name) {
super();
this.name = name;
}
/**
* Set the name property if it is not already set. Because of the order of
* the callbacks in a Spring container the name property will be set first
* if it is present. Care is needed with bean definition inheritance - if a
* parent bean has a name, then its children need an explicit name as well,
* otherwise they will not be unique.
*
* @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
*/
public void setBeanName(String name) {
if (this.name == null) {
this.name = name;
}
}
/**
* Set the name property. Always overrides the default value if this object
* is a Spring bean.
*
* @see #setBeanName(java.lang.String)
*/
public void setName(String name) {
this.name = name;
}
/* (non-Javadoc)
* @see org.springframework.batch.core.domain.IJob#getName()
*/
public String getName() {
return name;
}
/* (non-Javadoc)
* @see org.springframework.batch.core.domain.IJob#getSteps()
*/
public List getSteps() {
return steps;
}
public void setSteps(List steps) {
this.steps.clear();
this.steps.addAll(steps);
}
public void addStep(Step step) {
this.steps.add(step);
}
/* (non-Javadoc)
* @see org.springframework.batch.core.domain.IJob#getStartLimit()
*/
public int getStartLimit() {
return startLimit;
}
public void setStartLimit(int startLimit) {
this.startLimit = startLimit;
}
public void setRestartable(boolean restartable) {
this.restartable = restartable;
}
/* (non-Javadoc)
* @see org.springframework.batch.core.domain.IJob#isRestartable()
*/
public boolean isRestartable() {
return restartable;
}
/* (non-Javadoc)
* @see org.springframework.batch.core.domain.Job#run(org.springframework.batch.core.domain.JobExecution)
*/
public void execute(JobExecution execution) throws UnexpectedJobExecutionException {
throw new UnsupportedOperationException("JobSupport does not provide an implementation of run(). Use a smarter subclass.");
}
public String toString() {
return ClassUtils.getShortName(getClass()) + ": [name=" + name + "]";
}
}

View File

@@ -18,6 +18,7 @@ package org.springframework.batch.core;
import junit.framework.TestCase;
import org.springframework.batch.core.job.JobSupport;
import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.support.ChildBeanDefinition;
import org.springframework.beans.factory.support.RootBeanDefinition;

View File

@@ -17,8 +17,6 @@ package org.springframework.batch.core;
import junit.framework.TestCase;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.item.ExecutionContext;
/**

View File

@@ -21,14 +21,8 @@ import java.util.Set;
import junit.framework.TestCase;
import org.springframework.batch.core.BatchStatus;
import org.springframework.batch.core.Entity;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobInstance;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepContribution;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.job.JobSupport;
import org.springframework.batch.core.step.StepSupport;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.batch.support.PropertiesConverter;

View File

@@ -1,116 +0,0 @@
/*
* Copyright 2006-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core;
import org.springframework.batch.core.JobInterruptedException;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepExecution;
import org.springframework.beans.factory.BeanNameAware;
/**
* Basic no-op support implementation for use as base class for {@link Step}. Implements {@link BeanNameAware} so that
* if no name is provided explicitly it will be inferred from the bean definition in Spring configuration.
*
* @author Dave Syer
*
*/
public class StepSupport implements Step, BeanNameAware {
private String name;
private int startLimit = Integer.MAX_VALUE;
private boolean allowStartIfComplete;
/**
* Default constructor for {@link StepSupport}.
*/
public StepSupport() {
super();
}
/**
* @param string
*/
public StepSupport(String string) {
super();
this.name = string;
}
public String getName() {
return this.name;
}
/**
* Set the name property if it is not already set. Because of the order of the callbacks in a Spring container the
* name property will be set first if it is present. Care is needed with bean definition inheritance - if a parent
* bean has a name, then its children need an explicit name as well, otherwise they will not be unique.
*
* @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
*/
public void setBeanName(String name) {
if (this.name == null) {
this.name = name;
}
}
/**
* Set the name property. Always overrides the default value if this object is a Spring bean.
*
* @see #setBeanName(java.lang.String)
*/
public void setName(String name) {
this.name = name;
}
public int getStartLimit() {
return this.startLimit;
}
/**
* Public setter for the startLimit.
*
* @param startLimit the startLimit to set
*/
public void setStartLimit(int startLimit) {
this.startLimit = startLimit;
}
public boolean isAllowStartIfComplete() {
return this.allowStartIfComplete;
}
/**
* Public setter for the shouldAllowStartIfComplete.
*
* @param allowStartIfComplete the shouldAllowStartIfComplete to set
*/
public void setAllowStartIfComplete(boolean allowStartIfComplete) {
this.allowStartIfComplete = allowStartIfComplete;
}
/**
* Not supported but provided so that tests can easily create a step.
*
* @throws UnsupportedOperationException always
*
* @see org.springframework.batch.core.Step#execute(org.springframework.batch.core.StepExecution)
*/
public void execute(StepExecution stepExecution) throws JobInterruptedException, UnexpectedJobExecutionException {
throw new UnsupportedOperationException(
"Cannot process a StepExecution. Use a smarter subclass of StepSupport.");
}
}

View File

@@ -26,7 +26,7 @@ import org.springframework.batch.core.Job;
import org.springframework.batch.core.JobExecution;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.job.JobSupport;
import org.springframework.batch.core.launch.SimpleJobLauncher;
import org.springframework.batch.core.launch.support.SimpleJobLauncher;
import org.springframework.batch.core.repository.JobRepository;
import org.springframework.batch.repeat.ExitStatus;
import org.springframework.core.task.TaskExecutor;

View File

@@ -32,8 +32,8 @@ import org.springframework.batch.core.job.JobSupport;
import org.springframework.batch.core.launch.JobLauncher;
import org.springframework.batch.core.launch.support.SimpleExportedJobLauncher;
import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException;
import org.springframework.batch.core.runtime.JobParametersFactory;
import org.springframework.batch.core.step.StepSupport;
import org.springframework.batch.core.support.JobParametersConverter;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.support.PropertiesConverter;
@@ -181,7 +181,7 @@ public class SimpleExportedJobLauncherTests extends TestCase {
*/
public void testRunJobWithParametersAndFactory() throws Exception {
jobLocator.register(new ReferenceJobFactory(new JobSupport("foo")));
launcher.setJobParametersFactory(new JobParametersFactory() {
launcher.setJobParametersFactory(new JobParametersConverter() {
public JobParameters getJobParameters(Properties properties) {
return new JobParametersBuilder().addString("foo", "spam").toJobParameters();
}

View File

@@ -29,7 +29,7 @@ import org.springframework.batch.core.job.JobSupport;
import org.springframework.batch.core.repository.support.dao.JobExecutionDao;
import org.springframework.batch.core.repository.support.dao.JobInstanceDao;
import org.springframework.batch.core.repository.support.dao.StepExecutionDao;
import org.springframework.batch.core.runtime.ExitStatusExceptionClassifier;
import org.springframework.batch.core.step.ExitStatusExceptionClassifier;
import org.springframework.batch.core.step.StepSupport;
import org.springframework.batch.item.ExecutionContext;
import org.springframework.batch.repeat.ExitStatus;

View File

@@ -19,7 +19,6 @@ package org.springframework.batch.core.step;
import org.springframework.batch.core.JobInterruptedException;
import org.springframework.batch.core.launch.support.ExitCodeMapper;
import org.springframework.batch.core.repository.NoSuchJobException;
import org.springframework.batch.core.runtime.ExitStatusExceptionClassifier;
import org.springframework.batch.repeat.ExitStatus;
import junit.framework.TestCase;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.batch.core.launch.support;
package org.springframework.batch.core.support;
import java.text.DateFormat;
import java.text.DecimalFormat;
@@ -25,16 +25,16 @@ import junit.framework.TestCase;
import org.springframework.batch.core.JobParameters;
import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.runtime.DefaultJobParametersFactory;
import org.springframework.batch.core.support.DefaultJobParametersConverter;
import org.springframework.util.StringUtils;
/**
* @author Dave Syer
*
*/
public class DefaultJobParametersFactoryTests extends TestCase {
public class DefaultJobParametersConverterTests extends TestCase {
DefaultJobParametersFactory factory = new DefaultJobParametersFactory();
DefaultJobParametersConverter factory = new DefaultJobParametersConverter();
DateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.batch.core.resource;
package org.springframework.batch.core.support;
import java.io.File;
import java.io.IOException;
@@ -28,25 +28,25 @@ import org.springframework.batch.core.JobParametersBuilder;
import org.springframework.batch.core.Step;
import org.springframework.batch.core.StepExecution;
import org.springframework.batch.core.job.JobSupport;
import org.springframework.batch.core.resource.StepExecutionProxyResource;
import org.springframework.batch.core.step.StepSupport;
import org.springframework.batch.core.support.StepExecutionResourceProxy;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.Resource;
/**
* Unit tests for {@link StepExecutionProxyResource}
* Unit tests for {@link StepExecutionResourceProxy}
*
* @author robert.kasanicky
* @author Lucas Ward
* @author Dave Syer
*/
public class StepExecutionProxyResourceTests extends TestCase {
public class StepExecutionResourceProxyTests extends TestCase {
/**
* Object under test
*/
private StepExecutionProxyResource resource = new StepExecutionProxyResource();
private StepExecutionResourceProxy resource = new StepExecutionResourceProxy();
private char pathsep = File.separatorChar;
@@ -105,7 +105,7 @@ public class StepExecutionProxyResourceTests extends TestCase {
}
public void testResoureLoaderAware() throws Exception {
resource = new StepExecutionProxyResource();
resource = new StepExecutionResourceProxy();
resource.setResourceLoader(new DefaultResourceLoader() {
public Resource getResource(String location) {
return new ByteArrayResource("foo".getBytes());

View File

@@ -1,41 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<bean id="dataSource" class="test.jdbc.datasource.InitializingDataSourceFactoryBean">
<property name="dataSource">
<bean class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver"/>
<property name="url" value="jdbc:hsqldb:mem:testdb;sql.enforce_strict_size=true"/>
</bean>
</property>
<property name="initScript" value="org/springframework/batch/core/repository/support/dao/init.sql" />
<property name="destroyScript" value="org/springframework/batch/core/repository/support/dao/destroy.sql" />
</bean>
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<bean id="incrementerParent" class="org.springframework.jdbc.support.incrementer.HsqlMaxValueIncrementer" abstract="true">
<property name="dataSource" ref="dataSource" />
<property name="columnName" value="ID" />
</bean>
<bean id="jobIncrementer" parent="incrementerParent">
<property name="incrementerName" value="BATCH_JOB_SEQ" />
</bean>
<bean id="jobExecutionIncrementer" parent="incrementerParent">
<property name="incrementerName" value="BATCH_JOB_EXECUTION_SEQ" />
</bean>
<bean id="stepIncrementer" parent="incrementerParent">
<property name="incrementerName" value="BATCH_STEP_SEQ" />
</bean>
<bean id="stepExecutionIncrementer" parent="incrementerParent">
<property name="incrementerName" value="BATCH_STEP_EXECUTION_SEQ" />
</bean>
</beans>

View File

@@ -1,10 +0,0 @@
-- Autogenerated: do not edit this file
DROP TABLE BATCH_STEP_EXECUTION_CONTEXT IF EXISTS;
DROP TABLE BATCH_STEP_EXECUTION IF EXISTS;
DROP TABLE BATCH_JOB_EXECUTION IF EXISTS;
DROP TABLE BATCH_JOB_PARAMS IF EXISTS;
DROP TABLE BATCH_JOB_INSTANCE IF EXISTS;
DROP TABLE BATCH_STEP_EXECUTION_SEQ IF EXISTS;
DROP TABLE BATCH_JOB_EXECUTION_SEQ IF EXISTS;
DROP TABLE BATCH_JOB_SEQ IF EXISTS;

View File

@@ -1,73 +0,0 @@
-- Autogenerated: do not edit this file
CREATE TABLE BATCH_JOB_INSTANCE (
JOB_INSTANCE_ID BIGINT IDENTITY PRIMARY KEY ,
VERSION BIGINT,
JOB_NAME VARCHAR(100) NOT NULL ,
JOB_KEY VARCHAR(2500)
);
CREATE TABLE BATCH_JOB_EXECUTION (
JOB_EXECUTION_ID BIGINT IDENTITY PRIMARY KEY ,
VERSION BIGINT,
JOB_INSTANCE_ID BIGINT NOT NULL,
START_TIME TIMESTAMP,
END_TIME TIMESTAMP ,
STATUS VARCHAR(10),
CONTINUABLE CHAR(1),
EXIT_CODE VARCHAR(20),
EXIT_MESSAGE VARCHAR(2500),
constraint JOB_INSTANCE_EXECUTION_FK foreign key (JOB_INSTANCE_ID)
references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
);
CREATE TABLE BATCH_JOB_PARAMS (
JOB_INSTANCE_ID BIGINT NOT NULL ,
TYPE_CD VARCHAR(6) NOT NULL ,
KEY_NAME VARCHAR(100) NOT NULL ,
STRING_VAL VARCHAR(250) ,
DATE_VAL TIMESTAMP ,
LONG_VAL BIGINT ,
DOUBLE_VAL DOUBLE PRECISION,
constraint JOB_INSTANCE_PARAMS_FK foreign key (JOB_INSTANCE_ID)
references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID)
);
CREATE TABLE BATCH_STEP_EXECUTION (
STEP_EXECUTION_ID BIGINT IDENTITY PRIMARY KEY ,
VERSION BIGINT NOT NULL,
STEP_NAME VARCHAR(100) NOT NULL,
JOB_EXECUTION_ID BIGINT NOT NULL,
START_TIME TIMESTAMP NOT NULL ,
END_TIME TIMESTAMP ,
STATUS VARCHAR(10),
COMMIT_COUNT BIGINT ,
TASK_COUNT BIGINT ,
CONTINUABLE CHAR(1),
EXIT_CODE VARCHAR(20),
EXIT_MESSAGE VARCHAR(2500),
constraint JOB_EXECUTION_STEP_FK foreign key (JOB_EXECUTION_ID)
references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
);
CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT (
STEP_EXECUTION_ID BIGINT NOT NULL ,
TYPE_CD VARCHAR(6) NOT NULL ,
KEY_NAME VARCHAR(1000) NOT NULL ,
STRING_VAL VARCHAR(1000) ,
DATE_VAL TIMESTAMP ,
LONG_VAL VARCHAR(10) ,
DOUBLE_VAL DOUBLE PRECISION ,
OBJECT_VAL LONGVARBINARY,
constraint STEP_EXECUTION_CONTEXT_FK foreign key (STEP_EXECUTION_ID)
references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID)
);
CREATE TABLE BATCH_STEP_EXECUTION_SEQ (
ID BIGINT IDENTITY
);
CREATE TABLE BATCH_JOB_EXECUTION_SEQ (
ID BIGINT IDENTITY
);
CREATE TABLE BATCH_JOB_SEQ (
ID BIGINT IDENTITY
);

View File

@@ -1,32 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
<import resource="data-source-context.xml" />
<bean id="jobRepository" class="org.springframework.batch.core.repository.support.SimpleJobRepository">
<constructor-arg ref="jobInstanceDao" />
<constructor-arg ref="jobExecutionDao" />
<constructor-arg ref="stepExecutionDao" />
</bean>
<bean id="jobInstanceDao" class="org.springframework.batch.core.repository.support.dao.JdbcJobInstanceDao" >
<property name="jdbcTemplate" ref="jdbcTemplate" />
<property name="jobIncrementer" ref="jobIncrementer" />
</bean>
<bean id="jobExecutionDao" class="org.springframework.batch.core.repository.support.dao.JdbcJobExecutionDao" >
<property name="jdbcTemplate" ref="jdbcTemplate" />
<property name="jobExecutionIncrementer" ref="jobExecutionIncrementer" />
</bean>
<bean id="stepExecutionDao" class="org.springframework.batch.core.repository.support.dao.JdbcStepExecutionDao" >
<property name="jdbcTemplate" ref="jdbcTemplate" />
<property name="stepExecutionIncrementer" ref="stepExecutionIncrementer" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" >
<property name="dataSource" ref="dataSource" />
</bean>
</beans>

View File

@@ -53,7 +53,7 @@ public class JobExecutionNotificationPublisher implements ApplicationListener, N
* close we log the event at INFO level and send a JMX notification if we
* are also an MBean.
*
* @see org.springframework.batch.core.launch.SimpleJobLauncher#onApplicationEvent(org.springframework.context.ApplicationEvent)
* @see org.springframework.batch.core.launch.support.SimpleJobLauncher#onApplicationEvent(org.springframework.context.ApplicationEvent)
*/
public void onApplicationEvent(ApplicationEvent applicationEvent) {
if (applicationEvent instanceof SimpleMessageApplicationEvent) {

View File

@@ -9,7 +9,7 @@
<!-- The tasklet used in this job will run in an infinite loop. This is useful for testing graceful shutdown from
multiple environments. -->
<bean id="jobLauncher" class="org.springframework.batch.core.launch.SimpleJobLauncher">
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
<property name="taskExecutor">
<bean class="org.springframework.core.task.SimpleAsyncTaskExecutor"/>

View File

@@ -14,7 +14,7 @@
<property name="jobRegistry" ref="jobConfigurationRegistry" />
</bean>
<bean id="jobLauncher" class="org.springframework.batch.core.launch.SimpleJobLauncher">
<bean id="jobLauncher" class="org.springframework.batch.core.launch.support.SimpleJobLauncher">
<property name="jobRepository" ref="jobRepository" />
</bean>