BATCH-1915: Change minimum compiler level to 1.6 and use @Override everywhere
This commit is contained in:
@@ -200,8 +200,8 @@
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.5</source>
|
||||
<target>1.5</target>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
||||
@@ -12,18 +12,6 @@
|
||||
<relativePath>../spring-batch-parent</relativePath>
|
||||
</parent>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>tiger</id>
|
||||
<activation>
|
||||
<jdk>1.5</jdk>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>stax</groupId>
|
||||
<artifactId>stax</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>default</id>
|
||||
<activation>
|
||||
|
||||
@@ -12,24 +12,6 @@
|
||||
<version>2.2.0.BUILD-SNAPSHOT</version>
|
||||
<relativePath>../spring-batch-parent</relativePath>
|
||||
</parent>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>tiger</id>
|
||||
<activation>
|
||||
<jdk>1.5</jdk>
|
||||
</activation>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>stax</groupId>
|
||||
<artifactId>stax</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.annotation</groupId>
|
||||
<artifactId>jsr250-api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</profile>
|
||||
</profiles>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.batch</groupId>
|
||||
|
||||
@@ -124,6 +124,7 @@ public class Entity implements Serializable {
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (id == null) {
|
||||
return super.hashCode();
|
||||
|
||||
@@ -139,6 +139,7 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
* @param status an {@link ExitStatus} to compare
|
||||
* @return 1,0,-1 according to the severity and exit code
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(ExitStatus status) {
|
||||
if (severity(status) > severity(this)) {
|
||||
return -1;
|
||||
@@ -180,6 +181,7 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format("exitCode=%s;exitDescription=%s", exitCode, exitDescription);
|
||||
}
|
||||
@@ -189,6 +191,7 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
@@ -201,6 +204,7 @@ public class ExitStatus implements Serializable, Comparable<ExitStatus> {
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return toString().hashCode();
|
||||
}
|
||||
|
||||
@@ -315,6 +315,7 @@ public class JobExecution extends Entity {
|
||||
*
|
||||
* @see org.springframework.batch.core.domain.Entity#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString()
|
||||
+ String.format(", startTime=%s, endTime=%s, lastUpdated=%s, status=%s, exitStatus=%s, job=[%s]",
|
||||
@@ -332,4 +333,4 @@ public class JobExecution extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ public class JobInstance extends Entity {
|
||||
return jobName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return super.toString() + ", JobParameters=[" + jobParameters + "]" + ", Job=[" + jobName + "]";
|
||||
}
|
||||
|
||||
@@ -112,6 +112,7 @@ public class JobParameter implements Serializable {
|
||||
: parameter.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 7 + 21 * (parameter == null ? parameterType.hashCode() : parameter.hashCode());
|
||||
}
|
||||
|
||||
@@ -186,6 +186,7 @@ public class StepContribution implements Serializable {
|
||||
*
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[StepContribution: read=" + readCount + ", written=" + writeCount + ", filtered=" + filterCount
|
||||
+ ", readSkips=" + readSkipCount + ", writeSkips=" + writeSkipCount + ", processSkips="
|
||||
|
||||
@@ -469,6 +469,7 @@ public class StepExecution extends Entity {
|
||||
* org.springframework.batch.container.common.domain.Entity#equals(java.
|
||||
* lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
|
||||
Object jobExecutionId = getJobExecutionId();
|
||||
@@ -495,6 +496,7 @@ public class StepExecution extends Entity {
|
||||
*
|
||||
* @see org.springframework.batch.container.common.domain.Entity#hashCode()
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
Object jobExecutionId = getJobExecutionId();
|
||||
Long id = getId();
|
||||
@@ -502,6 +504,7 @@ public class StepExecution extends Entity {
|
||||
* (jobExecutionId != null ? jobExecutionId.hashCode() : 0) + 59 * (id != null ? id.hashCode() : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return String.format(getSummary() + ", exitDescription=%s", exitStatus.getExitDescription());
|
||||
}
|
||||
|
||||
@@ -47,16 +47,19 @@ public class ModularBatchConfiguration extends AbstractBatchConfiguration {
|
||||
|
||||
private AutomaticJobRegistrar registrar = new AutomaticJobRegistrar();
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
public JobRepository jobRepository() throws Exception {
|
||||
return getConfigurer(configurers).getJobRepository();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
public JobLauncher jobLauncher() throws Exception {
|
||||
return getConfigurer(configurers).getJobLauncher();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
public PlatformTransactionManager transactionManager() throws Exception {
|
||||
return getConfigurer(configurers).getTransactionManager();
|
||||
|
||||
@@ -58,21 +58,25 @@ public class SimpleBatchConfiguration extends AbstractBatchConfiguration {
|
||||
|
||||
private AtomicReference<PlatformTransactionManager> transactionManager = new AtomicReference<PlatformTransactionManager>();
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
public JobRepository jobRepository() throws Exception {
|
||||
return createLazyProxy(jobRepository, JobRepository.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
public JobLauncher jobLauncher() throws Exception {
|
||||
return createLazyProxy(jobLauncher, JobLauncher.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
public JobRegistry jobRegistry() throws Exception {
|
||||
return createLazyProxy(jobRegistry, JobRegistry.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
public PlatformTransactionManager transactionManager() throws Exception {
|
||||
return createLazyProxy(transactionManager, PlatformTransactionManager.class);
|
||||
|
||||
@@ -48,6 +48,7 @@ public class ApplicationContextJobFactory implements JobFactory {
|
||||
*
|
||||
* @see org.springframework.batch.core.configuration.JobFactory#createJob()
|
||||
*/
|
||||
@Override
|
||||
public final Job createJob() {
|
||||
return job;
|
||||
}
|
||||
@@ -57,6 +58,7 @@ public class ApplicationContextJobFactory implements JobFactory {
|
||||
*
|
||||
* @see JobFactory#getJobName()
|
||||
*/
|
||||
@Override
|
||||
public String getJobName() {
|
||||
return job.getName();
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ public class DefaultJobLoader implements JobLoader, InitializingBean {
|
||||
*
|
||||
* @see JobLoader#clear()
|
||||
*/
|
||||
@Override
|
||||
public void clear() {
|
||||
for (ConfigurableApplicationContext context : contexts.values()) {
|
||||
if (context.isActive()) {
|
||||
@@ -119,6 +120,7 @@ public class DefaultJobLoader implements JobLoader, InitializingBean {
|
||||
contexts.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Job> reload(ApplicationContextFactory factory) {
|
||||
|
||||
// If the same factory is loaded twice the context can be closed
|
||||
@@ -140,6 +142,7 @@ public class DefaultJobLoader implements JobLoader, InitializingBean {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Job> load(ApplicationContextFactory factory) throws DuplicateJobException {
|
||||
return doLoad(factory, false);
|
||||
}
|
||||
@@ -268,6 +271,7 @@ public class DefaultJobLoader implements JobLoader, InitializingBean {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
Assert.notNull(jobRegistry, "Job registry could not be null.");
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ public class GroupAwareJob implements Job {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecution execution) {
|
||||
delegate.execute(execution);
|
||||
}
|
||||
@@ -77,18 +78,22 @@ public class GroupAwareJob implements Job {
|
||||
*
|
||||
* @see org.springframework.batch.core.Job#getName()
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return groupName==null ? delegate.getName() : groupName + SEPARATOR + delegate.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRestartable() {
|
||||
return delegate.isRestartable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobParametersIncrementer getJobParametersIncrementer() {
|
||||
return delegate.getJobParametersIncrementer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobParametersValidator getJobParametersValidator() {
|
||||
return delegate.getJobParametersValidator();
|
||||
}
|
||||
@@ -121,4 +126,4 @@ public class GroupAwareJob implements Job {
|
||||
return ClassUtils.getShortName(delegate.getClass()) + ": [name=" + getName() + "]";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,6 +88,7 @@ public class JobRegistryBeanPostProcessor implements BeanPostProcessor, BeanFact
|
||||
* org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org
|
||||
* .springframework.beans.factory.BeanFactory)
|
||||
*/
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
if (beanFactory instanceof DefaultListableBeanFactory) {
|
||||
this.beanFactory = (DefaultListableBeanFactory) beanFactory;
|
||||
@@ -99,6 +100,7 @@ public class JobRegistryBeanPostProcessor implements BeanPostProcessor, BeanFact
|
||||
*
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jobRegistry, "JobRegistry must not be null");
|
||||
}
|
||||
@@ -108,6 +110,7 @@ public class JobRegistryBeanPostProcessor implements BeanPostProcessor, BeanFact
|
||||
* post processor.
|
||||
* @see org.springframework.beans.factory.DisposableBean#destroy()
|
||||
*/
|
||||
@Override
|
||||
public void destroy() throws Exception {
|
||||
for (String name : jobNames) {
|
||||
logger.debug("Unregistering job: " + name);
|
||||
@@ -123,6 +126,7 @@ public class JobRegistryBeanPostProcessor implements BeanPostProcessor, BeanFact
|
||||
* @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
if (bean instanceof Job) {
|
||||
Job job = (Job) bean;
|
||||
@@ -165,6 +169,7 @@ public class JobRegistryBeanPostProcessor implements BeanPostProcessor, BeanFact
|
||||
* @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public class MapJobRegistry implements JobRegistry {
|
||||
// The "final" ensures that it is visible and initialized when the constructor resolves.
|
||||
private final ConcurrentMap<String, JobFactory> map = new ConcurrentHashMap<String, JobFactory>();
|
||||
|
||||
@Override
|
||||
public void register(JobFactory jobFactory) throws DuplicateJobException {
|
||||
Assert.notNull(jobFactory);
|
||||
String name = jobFactory.getJobName();
|
||||
@@ -52,11 +53,13 @@ public class MapJobRegistry implements JobRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregister(String name) {
|
||||
Assert.notNull(name, "Job configuration must have a name.");
|
||||
map.remove(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Job getJob(String name) throws NoSuchJobException {
|
||||
JobFactory factory = map.get(name);
|
||||
if (factory == null) {
|
||||
@@ -69,6 +72,7 @@ public class MapJobRegistry implements JobRegistry {
|
||||
/**
|
||||
* Provides an unmodifiable view of the job names.
|
||||
*/
|
||||
@Override
|
||||
public Set<String> getJobNames() {
|
||||
return Collections.unmodifiableSet(map.keySet());
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ public class MapStepRegistry implements StepRegistry {
|
||||
|
||||
private final ConcurrentMap<String, Map<String, Step>> map = new ConcurrentHashMap<String, Map<String, Step>>();
|
||||
|
||||
@Override
|
||||
public void register(String jobName, Collection<Step> steps) throws DuplicateJobException {
|
||||
Assert.notNull(jobName, "The job name cannot be null.");
|
||||
Assert.notNull(steps, "The job steps cannot be null.");
|
||||
@@ -40,11 +41,13 @@ public class MapStepRegistry implements StepRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterStepsFromJob(String jobName) {
|
||||
Assert.notNull(jobName, "Job configuration must have a name.");
|
||||
map.remove(jobName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Step getStep(String jobName, String stepName) throws NoSuchJobException {
|
||||
Assert.notNull(jobName, "The job name cannot be null.");
|
||||
Assert.notNull(stepName, "The step name cannot be null.");
|
||||
|
||||
@@ -61,6 +61,7 @@ public class OsgiBundleXmlApplicationContextFactory implements BundleContextAwar
|
||||
*
|
||||
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
|
||||
*/
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
parent = applicationContext;
|
||||
}
|
||||
@@ -71,6 +72,7 @@ public class OsgiBundleXmlApplicationContextFactory implements BundleContextAwar
|
||||
*
|
||||
* @see org.springframework.osgi.context.BundleContextAware#setBundleContext(org.osgi.framework.BundleContext)
|
||||
*/
|
||||
@Override
|
||||
public void setBundleContext(BundleContext context) {
|
||||
this.bundleContext = context;
|
||||
}
|
||||
@@ -82,6 +84,7 @@ public class OsgiBundleXmlApplicationContextFactory implements BundleContextAwar
|
||||
*
|
||||
* @see ApplicationContextFactory#createApplicationContext()
|
||||
*/
|
||||
@Override
|
||||
public ConfigurableApplicationContext createApplicationContext() {
|
||||
OsgiBundleXmlApplicationContext context = new OsgiBundleXmlApplicationContext(new String[] { path }, parent);
|
||||
String displayName = bundleContext.getBundle().getSymbolicName() + ":" + this.displayName;
|
||||
|
||||
@@ -41,6 +41,7 @@ public class ReferenceJobFactory implements JobFactory {
|
||||
*
|
||||
* @see JobFactory#createJob()
|
||||
*/
|
||||
@Override
|
||||
public final Job createJob() {
|
||||
return job;
|
||||
}
|
||||
@@ -50,6 +51,7 @@ public class ReferenceJobFactory implements JobFactory {
|
||||
*
|
||||
* @see JobFactory#getJobName()
|
||||
*/
|
||||
@Override
|
||||
public String getJobName() {
|
||||
return job.getName();
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ public class CoreNamespaceHandler extends NamespaceHandlerSupport {
|
||||
/**
|
||||
* @see NamespaceHandler#init()
|
||||
*/
|
||||
@Override
|
||||
public void init() {
|
||||
this.registerBeanDefinitionParser("job", new JobParser());
|
||||
this.registerBeanDefinitionParser("flow", new TopLevelFlowParser());
|
||||
|
||||
@@ -49,6 +49,7 @@ public class CoreNamespacePostProcessor implements BeanPostProcessor, BeanFactor
|
||||
|
||||
private ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
|
||||
for (String beanName : beanFactory.getBeanDefinitionNames()) {
|
||||
injectJobRepositoryIntoSteps(beanName, beanFactory);
|
||||
@@ -101,6 +102,7 @@ public class CoreNamespacePostProcessor implements BeanPostProcessor, BeanFactor
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
return injectDefaults(bean);
|
||||
}
|
||||
@@ -140,10 +142,12 @@ public class CoreNamespacePostProcessor implements BeanPostProcessor, BeanFactor
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) {
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@@ -31,10 +31,12 @@ import org.springframework.batch.core.listener.ListenerMetaData;
|
||||
*/
|
||||
public class JobExecutionListenerParser extends AbstractListenerParser {
|
||||
|
||||
@Override
|
||||
protected Class<? extends AbstractListenerFactoryBean> getBeanClass() {
|
||||
return JobListenerFactoryBean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ListenerMetaData[] getMetaDataValues() {
|
||||
return JobListenerMetaData.values();
|
||||
}
|
||||
|
||||
@@ -55,6 +55,7 @@ class JobParserJobFactoryBean implements SmartFactoryBean {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final Object getObject() throws Exception {
|
||||
Assert.isTrue(StringUtils.hasText(name), "The job must have an id.");
|
||||
FlowJob flowJob = new FlowJob(name);
|
||||
@@ -115,18 +116,22 @@ class JobParserJobFactoryBean implements SmartFactoryBean {
|
||||
this.flow = flow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<FlowJob> getObjectType() {
|
||||
return FlowJob.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEagerInit() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPrototype() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -61,10 +61,12 @@ public class SimpleFlowFactoryBean implements FactoryBean, InitializingBean {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.hasText(name, "The flow must have a name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() throws Exception {
|
||||
|
||||
SimpleFlow flow = new SimpleFlow(name);
|
||||
@@ -109,10 +111,12 @@ public class SimpleFlowFactoryBean implements FactoryBean, InitializingBean {
|
||||
return new DelegateState(stateName, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return SimpleFlow.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
@@ -132,6 +136,7 @@ public class SimpleFlowFactoryBean implements FactoryBean, InitializingBean {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEndState() {
|
||||
return state.isEndState();
|
||||
}
|
||||
@@ -141,6 +146,7 @@ public class SimpleFlowFactoryBean implements FactoryBean, InitializingBean {
|
||||
return state.handle(executor);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<Flow> getFlows() {
|
||||
return (state instanceof FlowHolder) ? ((FlowHolder)state).getFlows() : Collections.<Flow>emptyList();
|
||||
}
|
||||
|
||||
@@ -53,10 +53,12 @@ public class StepListenerParser extends AbstractListenerParser {
|
||||
this.listenerMetaData = listenerMetaData;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<? extends AbstractListenerFactoryBean> getBeanClass() {
|
||||
return StepListenerFactoryBean.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ListenerMetaData[] getMetaDataValues() {
|
||||
return listenerMetaData;
|
||||
}
|
||||
|
||||
@@ -220,6 +220,7 @@ class StepParserStepFactoryBean<I, O> implements FactoryBean, BeanNameAware {
|
||||
*
|
||||
* @see FactoryBean#getObject()
|
||||
*/
|
||||
@Override
|
||||
public final Object getObject() throws Exception {
|
||||
if (hasChunkElement) {
|
||||
Assert.isNull(tasklet, "Step [" + name
|
||||
@@ -525,10 +526,12 @@ class StepParserStepFactoryBean<I, O> implements FactoryBean, BeanNameAware {
|
||||
return n != null && n > 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<TaskletStep> getObjectType() {
|
||||
return TaskletStep.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
@@ -542,6 +545,7 @@ class StepParserStepFactoryBean<I, O> implements FactoryBean, BeanNameAware {
|
||||
*
|
||||
* @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setBeanName(String name) {
|
||||
if (this.name == null) {
|
||||
this.name = name;
|
||||
|
||||
@@ -83,6 +83,7 @@ public class DefaultJobParametersConverter implements JobParametersConverter {
|
||||
*
|
||||
* @see org.springframework.batch.core.converter.JobParametersConverter#getJobParameters(java.util.Properties)
|
||||
*/
|
||||
@Override
|
||||
public JobParameters getJobParameters(Properties props) {
|
||||
|
||||
if (props == null || props.isEmpty()) {
|
||||
@@ -153,6 +154,7 @@ public class DefaultJobParametersConverter implements JobParametersConverter {
|
||||
*
|
||||
* @see org.springframework.batch.core.converter.JobParametersConverter#getProperties(org.springframework.batch.core.JobParameters)
|
||||
*/
|
||||
@Override
|
||||
public Properties getProperties(JobParameters params) {
|
||||
|
||||
if (params == null || params.isEmpty()) {
|
||||
|
||||
@@ -56,10 +56,12 @@ public abstract class AbstractJobExplorerFactoryBean implements FactoryBean {
|
||||
* @return JobExplorer.class
|
||||
* @see org.springframework.beans.factory.FactoryBean#getObjectType()
|
||||
*/
|
||||
@Override
|
||||
public Class<JobExplorer> getObjectType() {
|
||||
return JobExplorer.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ public class JobExplorerFactoryBean extends AbstractJobExplorerFactoryBean
|
||||
this.lobHandler = lobHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
|
||||
Assert.notNull(dataSource, "DataSource must not be null.");
|
||||
@@ -168,6 +169,7 @@ public class JobExplorerFactoryBean extends AbstractJobExplorerFactoryBean
|
||||
return dao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() throws Exception {
|
||||
return getTarget();
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ public class MapJobExplorerFactoryBean extends AbstractJobExplorerFactoryBean im
|
||||
* @throws Exception
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.state(repositoryFactory != null, "A MapJobRepositoryFactoryBean must be provided");
|
||||
repositoryFactory.afterPropertiesSet();
|
||||
@@ -90,6 +91,7 @@ public class MapJobExplorerFactoryBean extends AbstractJobExplorerFactoryBean im
|
||||
return repositoryFactory.getExecutionContextDao();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() throws Exception {
|
||||
return new SimpleJobExplorer(createJobInstanceDao(), createJobExecutionDao(), createStepExecutionDao(),
|
||||
createExecutionContextDao());
|
||||
|
||||
@@ -73,6 +73,7 @@ public class SimpleJobExplorer implements JobExplorer {
|
||||
* org.springframework.batch.core.explore.JobExplorer#findJobExecutions(
|
||||
* org.springframework.batch.core.JobInstance)
|
||||
*/
|
||||
@Override
|
||||
public List<JobExecution> getJobExecutions(JobInstance jobInstance) {
|
||||
List<JobExecution> executions = jobExecutionDao.findJobExecutions(jobInstance);
|
||||
for (JobExecution jobExecution : executions) {
|
||||
@@ -91,6 +92,7 @@ public class SimpleJobExplorer implements JobExplorer {
|
||||
* org.springframework.batch.core.explore.JobExplorer#findRunningJobExecutions
|
||||
* (java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Set<JobExecution> findRunningJobExecutions(String jobName) {
|
||||
Set<JobExecution> executions = jobExecutionDao.findRunningJobExecutions(jobName);
|
||||
for (JobExecution jobExecution : executions) {
|
||||
@@ -109,6 +111,7 @@ public class SimpleJobExplorer implements JobExplorer {
|
||||
* org.springframework.batch.core.explore.JobExplorer#getJobExecution(java
|
||||
* .lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public JobExecution getJobExecution(Long executionId) {
|
||||
if (executionId == null) {
|
||||
return null;
|
||||
@@ -131,6 +134,7 @@ public class SimpleJobExplorer implements JobExplorer {
|
||||
* org.springframework.batch.core.explore.JobExplorer#getStepExecution(java
|
||||
* .lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public StepExecution getStepExecution(Long jobExecutionId, Long executionId) {
|
||||
JobExecution jobExecution = jobExecutionDao.getJobExecution(jobExecutionId);
|
||||
if (jobExecution == null) {
|
||||
@@ -148,6 +152,7 @@ public class SimpleJobExplorer implements JobExplorer {
|
||||
* org.springframework.batch.core.explore.JobExplorer#getJobInstance(java
|
||||
* .lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public JobInstance getJobInstance(Long instanceId) {
|
||||
return jobInstanceDao.getJobInstance(instanceId);
|
||||
}
|
||||
@@ -159,6 +164,7 @@ public class SimpleJobExplorer implements JobExplorer {
|
||||
* org.springframework.batch.core.explore.JobExplorer#getLastJobInstances
|
||||
* (java.lang.String, int)
|
||||
*/
|
||||
@Override
|
||||
public List<JobInstance> getJobInstances(String jobName, int start, int count) {
|
||||
return jobInstanceDao.getJobInstances(jobName, start, count);
|
||||
}
|
||||
@@ -168,6 +174,7 @@ public class SimpleJobExplorer implements JobExplorer {
|
||||
*
|
||||
* @see org.springframework.batch.core.explore.JobExplorer#getJobNames()
|
||||
*/
|
||||
@Override
|
||||
public List<String> getJobNames() {
|
||||
return jobInstanceDao.getJobNames();
|
||||
}
|
||||
|
||||
@@ -108,6 +108,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware,
|
||||
*
|
||||
* @see InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jobRepository, "JobRepository must be set");
|
||||
}
|
||||
@@ -121,6 +122,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware,
|
||||
*
|
||||
* @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public void setBeanName(String name) {
|
||||
if (this.name == null) {
|
||||
this.name = name;
|
||||
@@ -142,6 +144,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware,
|
||||
*
|
||||
* @see org.springframework.batch.core.domain.IJob#getName()
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -153,6 +156,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware,
|
||||
* @param stepName
|
||||
* @return the Step
|
||||
*/
|
||||
@Override
|
||||
public abstract Step getStep(String stepName);
|
||||
|
||||
/**
|
||||
@@ -160,8 +164,10 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware,
|
||||
*
|
||||
* @return the step names
|
||||
*/
|
||||
@Override
|
||||
public abstract Collection<String> getStepNames();
|
||||
|
||||
@Override
|
||||
public JobParametersValidator getJobParametersValidator() {
|
||||
return jobParametersValidator;
|
||||
}
|
||||
@@ -180,6 +186,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware,
|
||||
/**
|
||||
* @see Job#isRestartable()
|
||||
*/
|
||||
@Override
|
||||
public boolean isRestartable() {
|
||||
return restartable;
|
||||
}
|
||||
@@ -200,6 +207,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware,
|
||||
*
|
||||
* @see org.springframework.batch.core.Job#getJobParametersIncrementer()
|
||||
*/
|
||||
@Override
|
||||
public JobParametersIncrementer getJobParametersIncrementer() {
|
||||
return this.jobParametersIncrementer;
|
||||
}
|
||||
@@ -273,6 +281,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware,
|
||||
* @throws StartLimitExceededException
|
||||
* if start limit of one of the steps was exceeded
|
||||
*/
|
||||
@Override
|
||||
public final void execute(JobExecution execution) {
|
||||
|
||||
logger.debug("Job execution starting: " + execution);
|
||||
@@ -402,6 +411,7 @@ public abstract class AbstractJob implements Job, StepLocator, BeanNameAware,
|
||||
jobRepository.update(jobExecution);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return ClassUtils.getShortName(getClass()) + ": [name=" + name + "]";
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ public class CompositeJobParametersValidator implements JobParametersValidator,
|
||||
* @param parameters some {@link JobParameters}
|
||||
* @throws JobParametersInvalidException if the parameters are invalid
|
||||
*/
|
||||
@Override
|
||||
public void validate(JobParameters parameters) throws JobParametersInvalidException {
|
||||
for (JobParametersValidator validator : validators) {
|
||||
validator.validate(parameters);
|
||||
@@ -55,6 +56,7 @@ public class CompositeJobParametersValidator implements JobParametersValidator,
|
||||
this.validators = validators;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(validators, "The 'validators' may not be null");
|
||||
Assert.notEmpty(validators, "The 'validators' may not be empty");
|
||||
|
||||
@@ -50,6 +50,7 @@ public class DefaultJobParametersValidator implements JobParametersValidator, In
|
||||
* Check that there are no overlaps between required and optional keys.
|
||||
* @throws IllegalStateException if there is an overlap
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws IllegalStateException {
|
||||
for (String key : requiredKeys) {
|
||||
Assert.state(!optionalKeys.contains(key), "Optional keys canot be required: " + key);
|
||||
@@ -66,6 +67,7 @@ public class DefaultJobParametersValidator implements JobParametersValidator, In
|
||||
*
|
||||
* @throws JobParametersInvalidException if the parameters are not valid
|
||||
*/
|
||||
@Override
|
||||
public void validate(JobParameters parameters) throws JobParametersInvalidException {
|
||||
|
||||
if (parameters == null) {
|
||||
|
||||
@@ -72,6 +72,7 @@ public class SimpleJob extends AbstractJob {
|
||||
*
|
||||
* @return the step names for this job
|
||||
*/
|
||||
@Override
|
||||
public Collection<String> getStepNames() {
|
||||
List<String> names = new ArrayList<String>();
|
||||
for (Step step : steps) {
|
||||
@@ -95,6 +96,7 @@ public class SimpleJob extends AbstractJob {
|
||||
* @see
|
||||
* org.springframework.batch.core.job.AbstractJob#getStep(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Step getStep(String stepName) {
|
||||
for (Step step : this.steps) {
|
||||
if (step.getName().equals(stepName)) {
|
||||
@@ -113,6 +115,7 @@ public class SimpleJob extends AbstractJob {
|
||||
*
|
||||
* @see AbstractJob#handleStep(Step, JobExecution)
|
||||
*/
|
||||
@Override
|
||||
protected void doExecute(JobExecution execution) throws JobInterruptedException, JobRestartException,
|
||||
StartLimitExceededException {
|
||||
|
||||
|
||||
@@ -74,6 +74,7 @@ public class SimpleStepHandler implements StepHandler, InitializingBean {
|
||||
*
|
||||
* @see InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.state(jobRepository != null, "A JobRepository must be provided");
|
||||
}
|
||||
@@ -95,6 +96,7 @@ public class SimpleStepHandler implements StepHandler, InitializingBean {
|
||||
this.executionContext = executionContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StepExecution handleStep(Step step, JobExecution execution) throws JobInterruptedException,
|
||||
JobRestartException, StartLimitExceededException {
|
||||
if (execution.isStopping()) {
|
||||
|
||||
@@ -56,6 +56,7 @@ public class JobFlowBuilder extends FlowBuilder<FlowJobBuilder> {
|
||||
*
|
||||
* @see org.springframework.batch.core.job.builder.FlowBuilder#build()
|
||||
*/
|
||||
@Override
|
||||
public FlowJobBuilder build() {
|
||||
Flow flow = flow();
|
||||
parent.flow(flow);
|
||||
|
||||
@@ -57,6 +57,7 @@ public class FlowExecution implements Comparable<FlowExecution> {
|
||||
* @param other
|
||||
* @return negative, zero or positive as per the contract
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(FlowExecution other) {
|
||||
return this.status.compareTo(other.getStatus());
|
||||
}
|
||||
|
||||
@@ -107,6 +107,7 @@ public class FlowExecutionStatus implements Comparable<FlowExecutionStatus> {
|
||||
* @param other
|
||||
* @return negative, zero or positive as per the contract
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(FlowExecutionStatus other) {
|
||||
Status one = Status.match(this.name);
|
||||
Status two = Status.match(other.name);
|
||||
|
||||
@@ -56,6 +56,7 @@ public class JobFlowExecutor implements FlowExecutor {
|
||||
stepExecutionHolder.set(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String executeStep(Step step) throws JobInterruptedException, JobRestartException,
|
||||
StartLimitExceededException {
|
||||
StepExecution stepExecution = stepHandler.handleStep(step, execution);
|
||||
@@ -69,6 +70,7 @@ public class JobFlowExecutor implements FlowExecutor {
|
||||
return stepExecution.getExitStatus().getExitCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void abandonStepExecution() {
|
||||
StepExecution lastStepExecution = stepExecutionHolder.get();
|
||||
if (lastStepExecution != null && lastStepExecution.getStatus().isGreaterThan(BatchStatus.STOPPING)) {
|
||||
@@ -77,24 +79,29 @@ public class JobFlowExecutor implements FlowExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateJobExecutionStatus(FlowExecutionStatus status) {
|
||||
execution.setStatus(findBatchStatus(status));
|
||||
exitStatus = exitStatus.and(new ExitStatus(status.getName()));
|
||||
execution.setExitStatus(exitStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobExecution getJobExecution() {
|
||||
return execution;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StepExecution getStepExecution() {
|
||||
return stepExecutionHolder.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close(FlowExecution result) {
|
||||
stepExecutionHolder.set(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRestart() {
|
||||
if (getStepExecution() != null && getStepExecution().getStatus() == BatchStatus.ABANDONED) {
|
||||
/*
|
||||
@@ -107,6 +114,7 @@ public class JobFlowExecutor implements FlowExecutor {
|
||||
return execution.getStepExecutions().isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addExitStatus(String code) {
|
||||
exitStatus = exitStatus.and(new ExitStatus(code));
|
||||
}
|
||||
@@ -124,4 +132,4 @@ public class JobFlowExecutor implements FlowExecutor {
|
||||
return BatchStatus.UNKNOWN;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,6 +75,7 @@ public class SimpleFlow implements Flow, InitializingBean {
|
||||
*
|
||||
* @see Flow#getName()
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -92,6 +93,7 @@ public class SimpleFlow implements Flow, InitializingBean {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public State getState(String stateName) {
|
||||
return stateMap.get(stateName);
|
||||
}
|
||||
@@ -99,6 +101,7 @@ public class SimpleFlow implements Flow, InitializingBean {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public Collection<State> getStates() {
|
||||
return new HashSet<State>(stateMap.values());
|
||||
}
|
||||
@@ -108,6 +111,7 @@ public class SimpleFlow implements Flow, InitializingBean {
|
||||
*
|
||||
* @see InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
initializeTransitions();
|
||||
}
|
||||
@@ -115,6 +119,7 @@ public class SimpleFlow implements Flow, InitializingBean {
|
||||
/**
|
||||
* @see Flow#start(FlowExecutor)
|
||||
*/
|
||||
@Override
|
||||
public FlowExecution start(FlowExecutor executor) throws FlowExecutionException {
|
||||
if (startState == null) {
|
||||
initializeTransitions();
|
||||
@@ -127,6 +132,7 @@ public class SimpleFlow implements Flow, InitializingBean {
|
||||
/**
|
||||
* @see Flow#resume(String, FlowExecutor)
|
||||
*/
|
||||
@Override
|
||||
public FlowExecution resume(String stateName, FlowExecutor executor) throws FlowExecutionException {
|
||||
|
||||
FlowExecutionStatus status = FlowExecutionStatus.UNKNOWN;
|
||||
|
||||
@@ -165,6 +165,7 @@ public final class StateTransition implements Comparable<StateTransition> {
|
||||
* fo? > foo.
|
||||
* @see Comparable#compareTo(Object)
|
||||
*/
|
||||
@Override
|
||||
public int compareTo(StateTransition other) {
|
||||
String value = other.pattern;
|
||||
if (pattern.equals(value)) {
|
||||
|
||||
@@ -35,6 +35,7 @@ public abstract class AbstractState implements State {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
@@ -47,6 +48,7 @@ public abstract class AbstractState implements State {
|
||||
return getClass().getSimpleName()+": name=["+name+"]";
|
||||
}
|
||||
|
||||
@Override
|
||||
public abstract FlowExecutionStatus handle(FlowExecutor executor) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -46,8 +46,9 @@ public class DecisionState extends AbstractState {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.job.flow.State#isEndState()
|
||||
*/
|
||||
@Override
|
||||
public boolean isEndState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +119,7 @@ public class EndState extends AbstractState {
|
||||
*
|
||||
* @see org.springframework.batch.core.job.flow.State#isEndState()
|
||||
*/
|
||||
@Override
|
||||
public boolean isEndState() {
|
||||
return !status.isStop();
|
||||
}
|
||||
@@ -132,4 +133,4 @@ public class EndState extends AbstractState {
|
||||
public String toString() {
|
||||
return super.toString() + " status=[" + status + "]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ public class FlowState extends AbstractState implements FlowHolder {
|
||||
/**
|
||||
* @return the flows
|
||||
*/
|
||||
@Override
|
||||
public Collection<Flow> getFlows() {
|
||||
return Collections.singleton(flow);
|
||||
}
|
||||
@@ -57,8 +58,9 @@ public class FlowState extends AbstractState implements FlowHolder {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.job.flow.State#isEndState()
|
||||
*/
|
||||
@Override
|
||||
public boolean isEndState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public class MaxValueFlowExecutionAggregator implements FlowExecutionAggregator
|
||||
*
|
||||
* @see FlowExecutionAggregator#aggregate(Collection)
|
||||
*/
|
||||
@Override
|
||||
public FlowExecutionStatus aggregate(Collection<FlowExecution> executions) {
|
||||
if (executions == null || executions.size() == 0) {
|
||||
return FlowExecutionStatus.UNKNOWN;
|
||||
|
||||
@@ -67,6 +67,7 @@ public class SplitState extends AbstractState implements FlowHolder {
|
||||
/**
|
||||
* @return the flows
|
||||
*/
|
||||
@Override
|
||||
public Collection<Flow> getFlows() {
|
||||
return flows;
|
||||
}
|
||||
@@ -87,6 +88,7 @@ public class SplitState extends AbstractState implements FlowHolder {
|
||||
for (final Flow flow : flows) {
|
||||
|
||||
final FutureTask<FlowExecution> task = new FutureTask<FlowExecution>(new Callable<FlowExecution>() {
|
||||
@Override
|
||||
public FlowExecution call() throws Exception {
|
||||
return flow.start(executor);
|
||||
}
|
||||
@@ -130,6 +132,7 @@ public class SplitState extends AbstractState implements FlowHolder {
|
||||
*
|
||||
* @see org.springframework.batch.core.job.flow.State#isEndState()
|
||||
*/
|
||||
@Override
|
||||
public boolean isEndState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,7 @@ public class StepState extends AbstractState implements StepHolder {
|
||||
/**
|
||||
* @return the step
|
||||
*/
|
||||
@Override
|
||||
public Step getStep() {
|
||||
return step;
|
||||
}
|
||||
@@ -70,6 +71,7 @@ public class StepState extends AbstractState implements StepHolder {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.job.flow.State#isEndState()
|
||||
*/
|
||||
@Override
|
||||
public boolean isEndState() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -202,6 +202,7 @@ public class JobRegistryBackgroundJobRunner {
|
||||
logger.info("Starting job registry in parent context from XML at: [" + args[0] + "]");
|
||||
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
launcher.run();
|
||||
|
||||
@@ -34,6 +34,7 @@ public class JvmSystemExiter implements SystemExiter {
|
||||
*
|
||||
* @see org.springframework.batch.core.launch.support.SystemExiter#exit(int)
|
||||
*/
|
||||
@Override
|
||||
public void exit(int status) {
|
||||
System.exit(status);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ public class RunIdIncrementer implements JobParametersIncrementer {
|
||||
/**
|
||||
* Increment the run.id parameter (starting with 1).
|
||||
*/
|
||||
@Override
|
||||
public JobParameters getNext(JobParameters parameters) {
|
||||
|
||||
JobParameters params = (parameters == null) ? new JobParameters() : parameters;
|
||||
|
||||
@@ -27,6 +27,7 @@ public class RuntimeExceptionTranslator implements MethodInterceptor {
|
||||
/* (non-Javadoc)
|
||||
* @see org.aopalliance.intercept.MethodInterceptor#invoke(org.aopalliance.intercept.MethodInvocation)
|
||||
*/
|
||||
@Override
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
try {
|
||||
return invocation.proceed();
|
||||
|
||||
@@ -43,6 +43,7 @@ public class ScheduledJobParametersFactory implements JobParametersConverter {
|
||||
*
|
||||
* @see org.springframework.batch.core.runtime.JobParametersFactory#getJobParameters(java.util.Properties)
|
||||
*/
|
||||
@Override
|
||||
public JobParameters getJobParameters(Properties props) {
|
||||
|
||||
if (props == null || props.isEmpty()) {
|
||||
@@ -73,6 +74,7 @@ public class ScheduledJobParametersFactory implements JobParametersConverter {
|
||||
*
|
||||
* @see org.springframework.batch.core.converter.JobParametersConverter#getProperties(org.springframework.batch.core.JobParameters)
|
||||
*/
|
||||
@Override
|
||||
public Properties getProperties(JobParameters params) {
|
||||
|
||||
if (params == null || params.isEmpty()) {
|
||||
|
||||
@@ -83,6 +83,7 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean {
|
||||
* completed successfully
|
||||
* @throws JobParametersInvalidException
|
||||
*/
|
||||
@Override
|
||||
public JobExecution run(final Job job, final JobParameters jobParameters)
|
||||
throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException,
|
||||
JobParametersInvalidException {
|
||||
@@ -113,6 +114,7 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean {
|
||||
try {
|
||||
taskExecutor.execute(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
logger.info("Job: [" + job + "] launched with the following parameters: [" + jobParameters
|
||||
@@ -173,6 +175,7 @@ public class SimpleJobLauncher implements JobLauncher, InitializingBean {
|
||||
* Ensure the required dependencies of a {@link JobRepository} have been
|
||||
* set.
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.state(jobRepository != null, "A JobRepository has not been set.");
|
||||
if (taskExecutor == null) {
|
||||
|
||||
@@ -98,6 +98,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
*
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jobLauncher, "JobLauncher must be provided");
|
||||
Assert.notNull(jobRegistry, "JobLocator must be provided");
|
||||
@@ -146,6 +147,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
*
|
||||
* @see org.springframework.batch.core.launch.JobOperator#getExecutions(java.lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public List<Long> getExecutions(long instanceId) throws NoSuchJobInstanceException {
|
||||
JobInstance jobInstance = jobExplorer.getJobInstance(instanceId);
|
||||
if (jobInstance == null) {
|
||||
@@ -163,6 +165,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
*
|
||||
* @see org.springframework.batch.core.launch.JobOperator#getJobNames()
|
||||
*/
|
||||
@Override
|
||||
public Set<String> getJobNames() {
|
||||
return new TreeSet<String>(jobRegistry.getJobNames());
|
||||
}
|
||||
@@ -172,6 +175,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
*
|
||||
* @see JobOperator#getLastInstances(String, int, int)
|
||||
*/
|
||||
@Override
|
||||
public List<Long> getJobInstances(String jobName, int start, int count) throws NoSuchJobException {
|
||||
List<Long> list = new ArrayList<Long>();
|
||||
for (JobInstance jobInstance : jobExplorer.getJobInstances(jobName, start, count)) {
|
||||
@@ -190,6 +194,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
* org.springframework.batch.core.launch.JobOperator#getParameters(java.
|
||||
* lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public String getParameters(long executionId) throws NoSuchJobExecutionException {
|
||||
JobExecution jobExecution = findExecutionById(executionId);
|
||||
|
||||
@@ -204,6 +209,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
* org.springframework.batch.core.launch.JobOperator#getRunningExecutions
|
||||
* (java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Set<Long> getRunningExecutions(String jobName) throws NoSuchJobException {
|
||||
Set<Long> set = new LinkedHashSet<Long>();
|
||||
for (JobExecution jobExecution : jobExplorer.findRunningJobExecutions(jobName)) {
|
||||
@@ -222,6 +228,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
* org.springframework.batch.core.launch.JobOperator#getStepExecutionSummaries
|
||||
* (java.lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public Map<Long, String> getStepExecutionSummaries(long executionId) throws NoSuchJobExecutionException {
|
||||
JobExecution jobExecution = findExecutionById(executionId);
|
||||
|
||||
@@ -239,6 +246,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
* org.springframework.batch.core.launch.JobOperator#getSummary(java.lang
|
||||
* .Long)
|
||||
*/
|
||||
@Override
|
||||
public String getSummary(long executionId) throws NoSuchJobExecutionException {
|
||||
JobExecution jobExecution = findExecutionById(executionId);
|
||||
return jobExecution.toString();
|
||||
@@ -250,6 +258,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
* @see
|
||||
* org.springframework.batch.core.launch.JobOperator#resume(java.lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public Long restart(long executionId) throws JobInstanceAlreadyCompleteException, NoSuchJobExecutionException, NoSuchJobException, JobRestartException, JobParametersInvalidException {
|
||||
|
||||
logger.info("Checking status of job execution with id=" + executionId);
|
||||
@@ -278,6 +287,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
* org.springframework.batch.core.launch.JobOperator#start(java.lang.String,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Long start(String jobName, String parameters) throws NoSuchJobException, JobInstanceAlreadyExistsException, JobParametersInvalidException {
|
||||
|
||||
logger.info("Checking status of job with name=" + jobName);
|
||||
@@ -317,6 +327,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
*
|
||||
* @see JobOperator#startNextInstance(String )
|
||||
*/
|
||||
@Override
|
||||
public Long startNextInstance(String jobName) throws NoSuchJobException, JobParametersNotFoundException,
|
||||
UnexpectedJobExecutionException, JobParametersInvalidException {
|
||||
|
||||
@@ -366,6 +377,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
* @see
|
||||
* org.springframework.batch.core.launch.JobOperator#stop(java.lang.Long)
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public boolean stop(long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException {
|
||||
|
||||
@@ -383,6 +395,7 @@ public class SimpleJobOperator implements JobOperator, InitializingBean {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobExecution abandon(long jobExecutionId) throws NoSuchJobExecutionException, JobExecutionAlreadyRunningException {
|
||||
JobExecution jobExecution = findExecutionById(jobExecutionId);
|
||||
|
||||
|
||||
@@ -67,6 +67,7 @@ public class SimpleJvmExitCodeMapper implements ExitCodeMapper {
|
||||
* Framework
|
||||
* @return The exitCode of the Batch Job as known by the JVM
|
||||
*/
|
||||
@Override
|
||||
public int intValue(String exitCode) {
|
||||
|
||||
Integer statusCode = null;
|
||||
|
||||
@@ -68,6 +68,7 @@ public abstract class AbstractListenerFactoryBean implements FactoryBean, Initia
|
||||
|
||||
private Map<String, String> metaDataMap;
|
||||
|
||||
@Override
|
||||
public Object getObject() {
|
||||
|
||||
if (metaDataMap == null) {
|
||||
@@ -174,6 +175,7 @@ public abstract class AbstractListenerFactoryBean implements FactoryBean, Initia
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
@@ -186,6 +188,7 @@ public abstract class AbstractListenerFactoryBean implements FactoryBean, Initia
|
||||
this.metaDataMap = metaDataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(delegate, "Delegate must not be null");
|
||||
}
|
||||
|
||||
@@ -28,12 +28,14 @@ public class ChunkListenerSupport implements ChunkListener {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ChunkListener#afterChunk()
|
||||
*/
|
||||
@Override
|
||||
public void afterChunk() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ChunkListener#beforeChunk()
|
||||
*/
|
||||
@Override
|
||||
public void beforeChunk() {
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ public class CompositeChunkListener implements ChunkListener {
|
||||
*
|
||||
* @see org.springframework.batch.core.ChunkListener#afterChunk()
|
||||
*/
|
||||
@Override
|
||||
public void afterChunk() {
|
||||
for (Iterator<ChunkListener> iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ChunkListener listener = iterator.next();
|
||||
@@ -65,6 +66,7 @@ public class CompositeChunkListener implements ChunkListener {
|
||||
*
|
||||
* @see org.springframework.batch.core.ChunkListener#beforeChunk()
|
||||
*/
|
||||
@Override
|
||||
public void beforeChunk() {
|
||||
for (Iterator<ChunkListener> iterator = listeners.reverse(); iterator.hasNext();) {
|
||||
ChunkListener listener = iterator.next();
|
||||
|
||||
@@ -53,6 +53,7 @@ public class CompositeItemProcessListener<T, S> implements ItemProcessListener<T
|
||||
* @see org.springframework.batch.core.ItemProcessListener#afterProcess(java.lang.Object,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterProcess(T item, S result) {
|
||||
for (Iterator<ItemProcessListener<? super T, ? super S>> iterator = listeners.reverse(); iterator.hasNext();) {
|
||||
ItemProcessListener<? super T, ? super S> listener = iterator.next();
|
||||
@@ -65,6 +66,7 @@ public class CompositeItemProcessListener<T, S> implements ItemProcessListener<T
|
||||
* that implement {@link Ordered}.
|
||||
* @see org.springframework.batch.core.ItemProcessListener#beforeProcess(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void beforeProcess(T item) {
|
||||
for (Iterator<ItemProcessListener<? super T, ? super S>> iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ItemProcessListener<? super T, ? super S> listener = iterator.next();
|
||||
@@ -78,6 +80,7 @@ public class CompositeItemProcessListener<T, S> implements ItemProcessListener<T
|
||||
* @see org.springframework.batch.core.ItemProcessListener#onProcessError(java.lang.Object,
|
||||
* java.lang.Exception)
|
||||
*/
|
||||
@Override
|
||||
public void onProcessError(T item, Exception e) {
|
||||
for (Iterator<ItemProcessListener<? super T, ? super S>> iterator = listeners.reverse(); iterator.hasNext();) {
|
||||
ItemProcessListener<? super T, ? super S> listener = iterator.next();
|
||||
|
||||
@@ -53,6 +53,7 @@ public class CompositeItemReadListener<T> implements ItemReadListener<T> {
|
||||
* prioritising those that implement {@link Ordered}.
|
||||
* @see org.springframework.batch.core.ItemReadListener#afterRead(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterRead(T item) {
|
||||
for (Iterator<ItemReadListener<? super T>> iterator = listeners.reverse(); iterator.hasNext();) {
|
||||
ItemReadListener<? super T> listener = iterator.next();
|
||||
@@ -65,6 +66,7 @@ public class CompositeItemReadListener<T> implements ItemReadListener<T> {
|
||||
* that implement {@link Ordered}.
|
||||
* @see org.springframework.batch.core.ItemReadListener#beforeRead()
|
||||
*/
|
||||
@Override
|
||||
public void beforeRead() {
|
||||
for (Iterator<ItemReadListener<? super T>> iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ItemReadListener<? super T> listener = iterator.next();
|
||||
@@ -77,6 +79,7 @@ public class CompositeItemReadListener<T> implements ItemReadListener<T> {
|
||||
* prioritising those that implement {@link Ordered}.
|
||||
* @see org.springframework.batch.core.ItemReadListener#onReadError(java.lang.Exception)
|
||||
*/
|
||||
@Override
|
||||
public void onReadError(Exception ex) {
|
||||
for (Iterator<ItemReadListener<? super T>> iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ItemReadListener<? super T> listener = iterator.next();
|
||||
|
||||
@@ -53,6 +53,7 @@ public class CompositeItemWriteListener<S> implements ItemWriteListener<S> {
|
||||
* prioritising those that implement {@link Ordered}.
|
||||
* @see ItemWriteListener#afterWrite(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public void afterWrite(List<? extends S> items) {
|
||||
for (Iterator<ItemWriteListener<? super S>> iterator = listeners.reverse(); iterator.hasNext();) {
|
||||
ItemWriteListener<? super S> listener = iterator.next();
|
||||
@@ -65,6 +66,7 @@ public class CompositeItemWriteListener<S> implements ItemWriteListener<S> {
|
||||
* that implement {@link Ordered}.
|
||||
* @see ItemWriteListener#beforeWrite(List)
|
||||
*/
|
||||
@Override
|
||||
public void beforeWrite(List<? extends S> items) {
|
||||
for (Iterator<ItemWriteListener<? super S>> iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
ItemWriteListener<? super S> listener = iterator.next();
|
||||
@@ -77,6 +79,7 @@ public class CompositeItemWriteListener<S> implements ItemWriteListener<S> {
|
||||
* prioritising those that implement {@link Ordered}.
|
||||
* @see ItemWriteListener#onWriteError(Exception, List)
|
||||
*/
|
||||
@Override
|
||||
public void onWriteError(Exception ex, List<? extends S> items) {
|
||||
for (Iterator<ItemWriteListener<? super S>> iterator = listeners.reverse(); iterator.hasNext();) {
|
||||
ItemWriteListener<? super S> listener = iterator.next();
|
||||
|
||||
@@ -53,6 +53,7 @@ public class CompositeJobExecutionListener implements JobExecutionListener {
|
||||
* prioritising those that implement {@link Ordered}.
|
||||
* @see org.springframework.batch.core.JobExecutionListener#afterJob(org.springframework.batch.core.JobExecution)
|
||||
*/
|
||||
@Override
|
||||
public void afterJob(JobExecution jobExecution) {
|
||||
for (Iterator<JobExecutionListener> iterator = listeners.reverse(); iterator.hasNext();) {
|
||||
JobExecutionListener listener = iterator.next();
|
||||
@@ -65,6 +66,7 @@ public class CompositeJobExecutionListener implements JobExecutionListener {
|
||||
* that implement {@link Ordered}.
|
||||
* @see org.springframework.batch.core.JobExecutionListener#beforeJob(org.springframework.batch.core.JobExecution)
|
||||
*/
|
||||
@Override
|
||||
public void beforeJob(JobExecution jobExecution) {
|
||||
for (Iterator<JobExecutionListener> iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
JobExecutionListener listener = iterator.next();
|
||||
|
||||
@@ -52,6 +52,7 @@ public class CompositeSkipListener<T,S> implements SkipListener<T,S> {
|
||||
* that implement {@link Ordered}.
|
||||
* @see org.springframework.batch.core.SkipListener#onSkipInRead(java.lang.Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void onSkipInRead(Throwable t) {
|
||||
for (Iterator<SkipListener<? super T,? super S>> iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
SkipListener<? super T,? super S> listener = iterator.next();
|
||||
@@ -65,6 +66,7 @@ public class CompositeSkipListener<T,S> implements SkipListener<T,S> {
|
||||
* @see org.springframework.batch.core.SkipListener#onSkipInWrite(java.lang.Object,
|
||||
* java.lang.Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void onSkipInWrite(S item, Throwable t) {
|
||||
for (Iterator<SkipListener<? super T,? super S>> iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
SkipListener<? super T,? super S> listener = iterator.next();
|
||||
@@ -78,6 +80,7 @@ public class CompositeSkipListener<T,S> implements SkipListener<T,S> {
|
||||
* @see org.springframework.batch.core.SkipListener#onSkipInWrite(java.lang.Object,
|
||||
* java.lang.Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void onSkipInProcess(T item, Throwable t) {
|
||||
for (Iterator<SkipListener<? super T,? super S>> iterator = listeners.iterator(); iterator.hasNext();) {
|
||||
SkipListener<? super T,? super S> listener = iterator.next();
|
||||
|
||||
@@ -55,6 +55,7 @@ public class CompositeStepExecutionListener implements StepExecutionListener {
|
||||
* prioritising those that implement {@link Ordered}.
|
||||
* @see org.springframework.batch.core.StepExecutionListener#afterStep(StepExecution)
|
||||
*/
|
||||
@Override
|
||||
public ExitStatus afterStep(StepExecution stepExecution) {
|
||||
ExitStatus status = null;
|
||||
for (Iterator<StepExecutionListener> iterator = list.reverse(); iterator.hasNext();) {
|
||||
@@ -70,6 +71,7 @@ public class CompositeStepExecutionListener implements StepExecutionListener {
|
||||
* that implement {@link Ordered}.
|
||||
* @see org.springframework.batch.core.StepExecutionListener#beforeStep(StepExecution)
|
||||
*/
|
||||
@Override
|
||||
public void beforeStep(StepExecution stepExecution) {
|
||||
for (Iterator<StepExecutionListener> iterator = list.iterator(); iterator.hasNext();) {
|
||||
StepExecutionListener listener = iterator.next();
|
||||
|
||||
@@ -46,6 +46,7 @@ public class ExecutionContextPromotionListener extends StepExecutionListenerSupp
|
||||
|
||||
private boolean strict = false;
|
||||
|
||||
@Override
|
||||
public ExitStatus afterStep(StepExecution stepExecution) {
|
||||
ExecutionContext stepContext = stepExecution.getExecutionContext();
|
||||
ExecutionContext jobContext = stepExecution.getJobExecution().getExecutionContext();
|
||||
@@ -69,6 +70,7 @@ public class ExecutionContextPromotionListener extends StepExecutionListenerSupp
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(this.keys, "The 'keys' property must be provided");
|
||||
Assert.notEmpty(this.keys, "The 'keys' property must not be empty");
|
||||
|
||||
@@ -37,6 +37,7 @@ public class ItemListenerSupport<I, O> implements ItemReadListener<I>, ItemProce
|
||||
*
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#afterRead(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterRead(I item) {
|
||||
}
|
||||
|
||||
@@ -45,6 +46,7 @@ public class ItemListenerSupport<I, O> implements ItemReadListener<I>, ItemProce
|
||||
*
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#beforeRead()
|
||||
*/
|
||||
@Override
|
||||
public void beforeRead() {
|
||||
}
|
||||
|
||||
@@ -53,6 +55,7 @@ public class ItemListenerSupport<I, O> implements ItemReadListener<I>, ItemProce
|
||||
*
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#onReadError(java.lang.Exception)
|
||||
*/
|
||||
@Override
|
||||
public void onReadError(Exception ex) {
|
||||
}
|
||||
|
||||
@@ -62,6 +65,7 @@ public class ItemListenerSupport<I, O> implements ItemReadListener<I>, ItemProce
|
||||
* @see org.springframework.batch.core.ItemProcessListener#afterProcess(java.lang.Object,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterProcess(I item, O result) {
|
||||
}
|
||||
|
||||
@@ -70,6 +74,7 @@ public class ItemListenerSupport<I, O> implements ItemReadListener<I>, ItemProce
|
||||
*
|
||||
* @see org.springframework.batch.core.ItemProcessListener#beforeProcess(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void beforeProcess(I item) {
|
||||
}
|
||||
|
||||
@@ -79,6 +84,7 @@ public class ItemListenerSupport<I, O> implements ItemReadListener<I>, ItemProce
|
||||
* @see org.springframework.batch.core.ItemProcessListener#onProcessError(java.lang.Object,
|
||||
* java.lang.Exception)
|
||||
*/
|
||||
@Override
|
||||
public void onProcessError(I item, Exception e) {
|
||||
}
|
||||
|
||||
@@ -87,6 +93,7 @@ public class ItemListenerSupport<I, O> implements ItemReadListener<I>, ItemProce
|
||||
*
|
||||
* @see org.springframework.batch.core.domain.ItemWriteListener#afterWrite()
|
||||
*/
|
||||
@Override
|
||||
public void afterWrite(List<? extends O> item) {
|
||||
}
|
||||
|
||||
@@ -95,6 +102,7 @@ public class ItemListenerSupport<I, O> implements ItemReadListener<I>, ItemProce
|
||||
*
|
||||
* @see org.springframework.batch.core.domain.ItemWriteListener#beforeWrite(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void beforeWrite(List<? extends O> item) {
|
||||
}
|
||||
|
||||
@@ -104,6 +112,7 @@ public class ItemListenerSupport<I, O> implements ItemReadListener<I>, ItemProce
|
||||
* @see org.springframework.batch.core.domain.ItemWriteListener#onWriteError(java.lang.Exception,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void onWriteError(Exception ex, List<? extends O> item) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,14 @@ public class JobExecutionListenerSupport implements JobExecutionListener {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.JobListener#afterJob()
|
||||
*/
|
||||
@Override
|
||||
public void afterJob(JobExecution jobExecution) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.JobListener#beforeJob(org.springframework.batch.core.domain.JobExecution)
|
||||
*/
|
||||
@Override
|
||||
public void beforeJob(JobExecution jobExecution) {
|
||||
}
|
||||
|
||||
|
||||
@@ -29,18 +29,22 @@ import org.springframework.batch.core.JobExecutionListener;
|
||||
*/
|
||||
public class JobListenerFactoryBean extends AbstractListenerFactoryBean {
|
||||
|
||||
@Override
|
||||
protected ListenerMetaData getMetaDataFromPropertyName(String propertyName) {
|
||||
return JobListenerMetaData.fromPropertyName(propertyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ListenerMetaData[] getMetaDataValues() {
|
||||
return JobListenerMetaData.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> getDefaultListenerClass() {
|
||||
return JobExecutionListener.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return JobExecutionListener.class;
|
||||
}
|
||||
|
||||
@@ -56,22 +56,27 @@ public enum JobListenerMetaData implements ListenerMetaData {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodName() {
|
||||
return methodName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends Annotation> getAnnotation() {
|
||||
return annotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getListenerInterface() {
|
||||
return JobExecutionListener.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName() {
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getParamTypes() {
|
||||
return new Class<?>[]{ JobExecution.class };
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public class MethodInvokerMethodInterceptor implements MethodInterceptor {
|
||||
this.invokerMap = invokerMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
|
||||
String methodName = invocation.getMethod().getName();
|
||||
|
||||
@@ -106,6 +106,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
* @see org.springframework.batch.core.listener.CompositeItemProcessListener#afterProcess(java.lang.Object,
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterProcess(T item, S result) {
|
||||
try {
|
||||
itemProcessListener.afterProcess(item, result);
|
||||
@@ -119,6 +120,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
* @param item
|
||||
* @see org.springframework.batch.core.listener.CompositeItemProcessListener#beforeProcess(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void beforeProcess(T item) {
|
||||
try {
|
||||
itemProcessListener.beforeProcess(item);
|
||||
@@ -134,6 +136,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
* @see org.springframework.batch.core.listener.CompositeItemProcessListener#onProcessError(java.lang.Object,
|
||||
* java.lang.Exception)
|
||||
*/
|
||||
@Override
|
||||
public void onProcessError(T item, Exception ex) {
|
||||
try {
|
||||
itemProcessListener.onProcessError(item, ex);
|
||||
@@ -146,6 +149,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
/**
|
||||
* @see org.springframework.batch.core.listener.CompositeStepExecutionListener#afterStep(StepExecution)
|
||||
*/
|
||||
@Override
|
||||
public ExitStatus afterStep(StepExecution stepExecution) {
|
||||
try {
|
||||
return stepListener.afterStep(stepExecution);
|
||||
@@ -159,6 +163,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
* @param stepExecution
|
||||
* @see org.springframework.batch.core.listener.CompositeStepExecutionListener#beforeStep(org.springframework.batch.core.StepExecution)
|
||||
*/
|
||||
@Override
|
||||
public void beforeStep(StepExecution stepExecution) {
|
||||
try {
|
||||
stepListener.beforeStep(stepExecution);
|
||||
@@ -172,6 +177,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
*
|
||||
* @see org.springframework.batch.core.listener.CompositeChunkListener#afterChunk()
|
||||
*/
|
||||
@Override
|
||||
public void afterChunk() {
|
||||
try {
|
||||
chunkListener.afterChunk();
|
||||
@@ -185,6 +191,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
*
|
||||
* @see org.springframework.batch.core.listener.CompositeChunkListener#beforeChunk()
|
||||
*/
|
||||
@Override
|
||||
public void beforeChunk() {
|
||||
try {
|
||||
chunkListener.beforeChunk();
|
||||
@@ -198,6 +205,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
* @param item
|
||||
* @see org.springframework.batch.core.listener.CompositeItemReadListener#afterRead(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterRead(T item) {
|
||||
try {
|
||||
itemReadListener.afterRead(item);
|
||||
@@ -211,6 +219,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
*
|
||||
* @see org.springframework.batch.core.listener.CompositeItemReadListener#beforeRead()
|
||||
*/
|
||||
@Override
|
||||
public void beforeRead() {
|
||||
try {
|
||||
itemReadListener.beforeRead();
|
||||
@@ -224,6 +233,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
* @param ex
|
||||
* @see org.springframework.batch.core.listener.CompositeItemReadListener#onReadError(java.lang.Exception)
|
||||
*/
|
||||
@Override
|
||||
public void onReadError(Exception ex) {
|
||||
try {
|
||||
itemReadListener.onReadError(ex);
|
||||
@@ -237,6 +247,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
*
|
||||
* @see ItemWriteListener#afterWrite(List)
|
||||
*/
|
||||
@Override
|
||||
public void afterWrite(List<? extends S> items) {
|
||||
try {
|
||||
itemWriteListener.afterWrite(items);
|
||||
@@ -250,6 +261,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
* @param items
|
||||
* @see ItemWriteListener#beforeWrite(List)
|
||||
*/
|
||||
@Override
|
||||
public void beforeWrite(List<? extends S> items) {
|
||||
try {
|
||||
itemWriteListener.beforeWrite(items);
|
||||
@@ -264,6 +276,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
* @param items
|
||||
* @see ItemWriteListener#onWriteError(Exception, List)
|
||||
*/
|
||||
@Override
|
||||
public void onWriteError(Exception ex, List<? extends S> items) {
|
||||
try {
|
||||
itemWriteListener.onWriteError(ex, items);
|
||||
@@ -277,6 +290,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
* @param t
|
||||
* @see org.springframework.batch.core.listener.CompositeSkipListener#onSkipInRead(java.lang.Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void onSkipInRead(Throwable t) {
|
||||
skipListener.onSkipInRead(t);
|
||||
}
|
||||
@@ -287,6 +301,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
* @see org.springframework.batch.core.listener.CompositeSkipListener#onSkipInWrite(java.lang.Object,
|
||||
* java.lang.Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void onSkipInWrite(S item, Throwable t) {
|
||||
skipListener.onSkipInWrite(item, t);
|
||||
}
|
||||
@@ -297,6 +312,7 @@ public class MulticasterBatchListener<T, S> implements StepExecutionListener, Ch
|
||||
* @see org.springframework.batch.core.listener.CompositeSkipListener#onSkipInProcess(Object,
|
||||
* Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void onSkipInProcess(T item, Throwable t) {
|
||||
skipListener.onSkipInProcess(item, t);
|
||||
}
|
||||
|
||||
@@ -28,19 +28,22 @@ public class SkipListenerSupport<T,S> implements SkipListener<T,S> {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.SkipListener#onSkipInRead(java.lang.Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void onSkipInRead(Throwable t) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.SkipListener#onSkipInWrite(java.lang.Object, java.lang.Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void onSkipInWrite(S item, Throwable t) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.SkipListener#onSkipInProcess(java.lang.Object, java.lang.Throwable)
|
||||
*/
|
||||
public void onSkipInProcess(T item, Throwable t) {
|
||||
@Override
|
||||
public void onSkipInProcess(T item, Throwable t) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public class StepExecutionListenerSupport implements StepExecutionListener {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.StepListener#afterStep(StepExecution stepExecution)
|
||||
*/
|
||||
@Override
|
||||
public ExitStatus afterStep(StepExecution stepExecution) {
|
||||
return null;
|
||||
}
|
||||
@@ -35,6 +36,7 @@ public class StepExecutionListenerSupport implements StepExecutionListener {
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.StepListener#open(org.springframework.batch.item.ExecutionContext)
|
||||
*/
|
||||
@Override
|
||||
public void beforeStep(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
|
||||
@@ -29,18 +29,22 @@ import org.springframework.batch.core.StepListener;
|
||||
*/
|
||||
public class StepListenerFactoryBean extends AbstractListenerFactoryBean {
|
||||
|
||||
@Override
|
||||
protected ListenerMetaData getMetaDataFromPropertyName(String propertyName) {
|
||||
return StepListenerMetaData.fromPropertyName(propertyName);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ListenerMetaData[] getMetaDataValues() {
|
||||
return StepListenerMetaData.values();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> getDefaultListenerClass() {
|
||||
return StepListener.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Class getObjectType() {
|
||||
return StepListener.class;
|
||||
|
||||
@@ -94,22 +94,27 @@ public enum StepListenerMetaData implements ListenerMetaData {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMethodName() {
|
||||
return methodName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends Annotation> getAnnotation() {
|
||||
return annotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getListenerInterface() {
|
||||
return listenerInterface;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?>[] getParamTypes() {
|
||||
return paramTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPropertyName() {
|
||||
return propertyName;
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ public class StepListenerSupport<T,S> implements StepExecutionListener, ChunkLis
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.StepExecutionListener#afterStep(org.springframework.batch.core.StepExecution)
|
||||
*/
|
||||
@Override
|
||||
public ExitStatus afterStep(StepExecution stepExecution) {
|
||||
return null;
|
||||
}
|
||||
@@ -46,90 +47,105 @@ public class StepListenerSupport<T,S> implements StepExecutionListener, ChunkLis
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.StepExecutionListener#beforeStep(org.springframework.batch.core.StepExecution)
|
||||
*/
|
||||
@Override
|
||||
public void beforeStep(StepExecution stepExecution) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ChunkListener#afterChunk()
|
||||
*/
|
||||
@Override
|
||||
public void afterChunk() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ChunkListener#beforeChunk()
|
||||
*/
|
||||
@Override
|
||||
public void beforeChunk() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#afterRead(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterRead(T item) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#beforeRead()
|
||||
*/
|
||||
@Override
|
||||
public void beforeRead() {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#onReadError(java.lang.Exception)
|
||||
*/
|
||||
@Override
|
||||
public void onReadError(Exception ex) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.ItemWriteListener#afterWrite(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public void afterWrite(List<? extends S> items) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.ItemWriteListener#beforeWrite(java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public void beforeWrite(List<? extends S> items) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.ItemWriteListener#onWriteError(java.lang.Exception, java.util.List)
|
||||
*/
|
||||
@Override
|
||||
public void onWriteError(Exception exception, List<? extends S> items) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.ItemProcessListener#afterProcess(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterProcess(T item, S result) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.ItemProcessListener#beforeProcess(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void beforeProcess(T item) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.ItemProcessListener#onProcessError(java.lang.Object, java.lang.Exception)
|
||||
*/
|
||||
@Override
|
||||
public void onProcessError(T item, Exception e) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.SkipListener#onSkipInProcess(java.lang.Object, java.lang.Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void onSkipInProcess(T item, Throwable t) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.SkipListener#onSkipInRead(java.lang.Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void onSkipInRead(Throwable t) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.batch.core.SkipListener#onSkipInWrite(java.lang.Object, java.lang.Throwable)
|
||||
*/
|
||||
@Override
|
||||
public void onSkipInWrite(S item, Throwable t) {
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ public abstract class AbstractPartitionHandler implements PartitionHandler {
|
||||
/**
|
||||
* @see PartitionHandler#handle(StepExecutionSplitter, StepExecution)
|
||||
*/
|
||||
@Override
|
||||
public Collection<StepExecution> handle(final StepExecutionSplitter stepSplitter,
|
||||
final StepExecution masterStepExecution) throws Exception {
|
||||
final Set<StepExecution> stepExecutions = stepSplitter.split(masterStepExecution, gridSize);
|
||||
|
||||
@@ -43,6 +43,7 @@ public class DefaultStepExecutionAggregator implements StepExecutionAggregator {
|
||||
* </ul>
|
||||
* @see StepExecutionAggregator #aggregate(StepExecution, Collection)
|
||||
*/
|
||||
@Override
|
||||
public void aggregate(StepExecution result, Collection<StepExecution> executions) {
|
||||
Assert.notNull(result, "To aggregate into a result it must be non-null.");
|
||||
if (executions == null) {
|
||||
|
||||
@@ -68,6 +68,7 @@ public class MultiResourcePartitioner implements Partitioner {
|
||||
*
|
||||
* @see Partitioner#partition(int)
|
||||
*/
|
||||
@Override
|
||||
public Map<String, ExecutionContext> partition(int gridSize) {
|
||||
Map<String, ExecutionContext> map = new HashMap<String, ExecutionContext>(gridSize);
|
||||
int i = 0;
|
||||
|
||||
@@ -78,6 +78,7 @@ public class PartitionStep extends AbstractStep {
|
||||
*
|
||||
* @see AbstractStep#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(stepExecutionSplitter, "StepExecutionSplitter must be provided");
|
||||
Assert.notNull(partitionHandler, "PartitionHandler must be provided");
|
||||
|
||||
@@ -72,6 +72,7 @@ public class RemoteStepExecutionAggregator implements StepExecutionAggregator, I
|
||||
/**
|
||||
* @throws Exception if the job explorer is not provided
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.state(jobExplorer != null, "A JobExplorer must be provided");
|
||||
}
|
||||
@@ -83,6 +84,7 @@ public class RemoteStepExecutionAggregator implements StepExecutionAggregator, I
|
||||
*
|
||||
* @see StepExecutionAggregator #aggregate(StepExecution, Collection)
|
||||
*/
|
||||
@Override
|
||||
public void aggregate(StepExecution result, Collection<StepExecution> executions) {
|
||||
Assert.notNull(result, "To aggregate into a result it must be non-null.");
|
||||
if (executions == null) {
|
||||
|
||||
@@ -34,6 +34,7 @@ public class SimplePartitioner implements Partitioner {
|
||||
|
||||
private static final String PARTITION_KEY = "partition";
|
||||
|
||||
@Override
|
||||
public Map<String, ExecutionContext> partition(int gridSize) {
|
||||
Map<String, ExecutionContext> map = new HashMap<String, ExecutionContext>(gridSize);
|
||||
for (int i = 0; i < gridSize; i++) {
|
||||
|
||||
@@ -108,6 +108,7 @@ public class SimpleStepExecutionSplitter implements StepExecutionSplitter, Initi
|
||||
*
|
||||
* @see InitializingBean#afterPropertiesSet()
|
||||
*/
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.state(jobRepository != null, "A JobRepository is required");
|
||||
Assert.state(stepName != null, "A step name is required");
|
||||
@@ -160,6 +161,7 @@ public class SimpleStepExecutionSplitter implements StepExecutionSplitter, Initi
|
||||
/**
|
||||
* @see StepExecutionSplitter#getStepName()
|
||||
*/
|
||||
@Override
|
||||
public String getStepName() {
|
||||
return this.stepName;
|
||||
}
|
||||
@@ -167,6 +169,7 @@ public class SimpleStepExecutionSplitter implements StepExecutionSplitter, Initi
|
||||
/**
|
||||
* @see StepExecutionSplitter#split(StepExecution, int)
|
||||
*/
|
||||
@Override
|
||||
public Set<StepExecution> split(StepExecution stepExecution, int gridSize) throws JobExecutionException {
|
||||
|
||||
JobExecution jobExecution = stepExecution.getJobExecution();
|
||||
|
||||
@@ -53,6 +53,7 @@ public class TaskExecutorPartitionHandler extends AbstractPartitionHandler imple
|
||||
|
||||
private Step step;
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
}
|
||||
|
||||
@@ -84,6 +85,7 @@ public class TaskExecutorPartitionHandler extends AbstractPartitionHandler imple
|
||||
* @return the step instance that will be used
|
||||
* @see StepHolder#getStep()
|
||||
*/
|
||||
@Override
|
||||
public Step getStep() {
|
||||
return this.step;
|
||||
}
|
||||
@@ -132,6 +134,7 @@ public class TaskExecutorPartitionHandler extends AbstractPartitionHandler imple
|
||||
protected FutureTask<StepExecution> createTask(final Step step,
|
||||
final StepExecution stepExecution) {
|
||||
return new FutureTask<StepExecution>(new Callable<StepExecution>() {
|
||||
@Override
|
||||
public StepExecution call() throws Exception {
|
||||
step.execute(stepExecution);
|
||||
return stepExecution;
|
||||
|
||||
@@ -79,6 +79,7 @@ public abstract class AbstractJdbcBatchMetadataDao implements InitializingBean {
|
||||
this.clobTypeToUse = clobTypeToUse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(jdbcTemplate);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ public class DefaultExecutionContextSerializer implements ExecutionContextSerial
|
||||
* @param context
|
||||
* @param out
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void serialize(Object context, OutputStream out) throws IOException {
|
||||
Assert.notNull(context);
|
||||
@@ -48,6 +49,7 @@ public class DefaultExecutionContextSerializer implements ExecutionContextSerial
|
||||
* @param inputStream
|
||||
* @return the object serialized in the provided {@link InputStream}
|
||||
*/
|
||||
@Override
|
||||
public Object deserialize(InputStream inputStream) throws IOException {
|
||||
return deserializer.deserialize(inputStream);
|
||||
}
|
||||
|
||||
@@ -100,6 +100,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem
|
||||
this.shortContextLength = shortContextLength;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExecutionContext getExecutionContext(JobExecution jobExecution) {
|
||||
Long executionId = jobExecution.getId();
|
||||
Assert.notNull(executionId, "ExecutionId must not be null.");
|
||||
@@ -114,6 +115,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExecutionContext getExecutionContext(StepExecution stepExecution) {
|
||||
Long executionId = stepExecution.getId();
|
||||
Assert.notNull(executionId, "ExecutionId must not be null.");
|
||||
@@ -128,6 +130,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExecutionContext(final JobExecution jobExecution) {
|
||||
Long executionId = jobExecution.getId();
|
||||
ExecutionContext executionContext = jobExecution.getExecutionContext();
|
||||
@@ -139,6 +142,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem
|
||||
persistSerializedContext(executionId, serializedContext, UPDATE_JOB_EXECUTION_CONTEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExecutionContext(final StepExecution stepExecution) {
|
||||
|
||||
Long executionId = stepExecution.getId();
|
||||
@@ -151,6 +155,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem
|
||||
persistSerializedContext(executionId, serializedContext, UPDATE_STEP_EXECUTION_CONTEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveExecutionContext(JobExecution jobExecution) {
|
||||
|
||||
Long executionId = jobExecution.getId();
|
||||
@@ -163,6 +168,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem
|
||||
persistSerializedContext(executionId, serializedContext, INSERT_JOB_EXECUTION_CONTEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveExecutionContext(StepExecution stepExecution) {
|
||||
Long executionId = stepExecution.getId();
|
||||
ExecutionContext executionContext = stepExecution.getExecutionContext();
|
||||
@@ -204,6 +210,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem
|
||||
}
|
||||
|
||||
getJdbcTemplate().update(getQuery(sql), new PreparedStatementSetter() {
|
||||
@Override
|
||||
public void setValues(PreparedStatement ps) throws SQLException {
|
||||
ps.setString(1, shortContext);
|
||||
if (longContext != null) {
|
||||
@@ -240,6 +247,7 @@ public class JdbcExecutionContextDao extends AbstractJdbcBatchMetadataDao implem
|
||||
@SuppressWarnings("unchecked")
|
||||
private class ExecutionContextRowMapper implements ParameterizedRowMapper<ExecutionContext> {
|
||||
|
||||
@Override
|
||||
public ExecutionContext mapRow(ResultSet rs, int i) throws SQLException {
|
||||
ExecutionContext executionContext = new ExecutionContext();
|
||||
String serializedContext = rs.getString("SERIALIZED_CONTEXT");
|
||||
|
||||
@@ -102,11 +102,13 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
this.jobExecutionIncrementer = jobExecutionIncrementer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(jobExecutionIncrementer, "The jobExecutionIncrementer must not be null.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JobExecution> findJobExecutions(final JobInstance job) {
|
||||
|
||||
Assert.notNull(job, "Job cannot be null.");
|
||||
@@ -125,6 +127,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
* @throws IllegalArgumentException if jobExecution is null, as well as any
|
||||
* of it's fields to be persisted.
|
||||
*/
|
||||
@Override
|
||||
public void saveJobExecution(JobExecution jobExecution) {
|
||||
|
||||
validateJobExecution(jobExecution);
|
||||
@@ -166,6 +169,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
*
|
||||
* @see JobExecutionDao#updateJobExecution(JobExecution)
|
||||
*/
|
||||
@Override
|
||||
public void updateJobExecution(JobExecution jobExecution) {
|
||||
|
||||
validateJobExecution(jobExecution);
|
||||
@@ -217,6 +221,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobExecution getLastJobExecution(JobInstance jobInstance) {
|
||||
|
||||
Long id = jobInstance.getId();
|
||||
@@ -240,6 +245,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
* @seeorg.springframework.batch.core.repository.dao.JobExecutionDao#
|
||||
* getLastJobExecution(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public JobExecution getJobExecution(Long executionId) {
|
||||
try {
|
||||
JobExecution jobExecution = getJdbcTemplate().queryForObject(getQuery(GET_EXECUTION_BY_ID),
|
||||
@@ -257,10 +263,12 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
* @seeorg.springframework.batch.core.repository.dao.JobExecutionDao#
|
||||
* findRunningJobExecutions(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Set<JobExecution> findRunningJobExecutions(String jobName) {
|
||||
|
||||
final Set<JobExecution> result = new HashSet<JobExecution>();
|
||||
RowCallbackHandler handler = new RowCallbackHandler() {
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
JobExecutionRowMapper mapper = new JobExecutionRowMapper();
|
||||
result.add(mapper.mapRow(rs, 0));
|
||||
@@ -271,6 +279,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeStatus(JobExecution jobExecution) {
|
||||
int currentVersion = getJdbcTemplate().queryForInt(getQuery(CURRENT_VERSION_JOB_EXECUTION),
|
||||
jobExecution.getId());
|
||||
@@ -299,6 +308,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
this.jobInstance = jobInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobExecution mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
Long id = rs.getLong(1);
|
||||
JobExecution jobExecution;
|
||||
|
||||
@@ -98,6 +98,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
* @throws IllegalArgumentException
|
||||
* if any {@link JobParameters} fields are null.
|
||||
*/
|
||||
@Override
|
||||
public JobInstance createJobInstance(String jobName,
|
||||
JobParameters jobParameters) {
|
||||
|
||||
@@ -206,6 +207,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
* @throws IllegalArgumentException
|
||||
* if any {@link JobParameters} fields are null.
|
||||
*/
|
||||
@Override
|
||||
public JobInstance getJobInstance(final String jobName,
|
||||
final JobParameters jobParameters) {
|
||||
|
||||
@@ -242,6 +244,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
* org.springframework.batch.core.repository.dao.JobInstanceDao#getJobInstance
|
||||
* (java.lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public JobInstance getJobInstance(Long instanceId) {
|
||||
|
||||
try {
|
||||
@@ -260,6 +263,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
private JobParameters getJobParameters(Long instanceId) {
|
||||
final Map<String, JobParameter> map = new HashMap<String, JobParameter>();
|
||||
RowCallbackHandler handler = new RowCallbackHandler() {
|
||||
@Override
|
||||
public void processRow(ResultSet rs) throws SQLException {
|
||||
ParameterType type = ParameterType.valueOf(rs.getString(3));
|
||||
JobParameter value = null;
|
||||
@@ -287,9 +291,11 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
* org.springframework.batch.core.repository.dao.JobInstanceDao#getJobNames
|
||||
* ()
|
||||
*/
|
||||
@Override
|
||||
public List<String> getJobNames() {
|
||||
return getJdbcTemplate().query(getQuery(FIND_JOB_NAMES),
|
||||
new ParameterizedRowMapper<String>() {
|
||||
@Override
|
||||
public String mapRow(ResultSet rs, int rowNum)
|
||||
throws SQLException {
|
||||
return rs.getString(1);
|
||||
@@ -303,6 +309,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
* @seeorg.springframework.batch.core.repository.dao.JobInstanceDao#
|
||||
* getLastJobInstances(java.lang.String, int)
|
||||
*/
|
||||
@Override
|
||||
public List<JobInstance> getJobInstances(String jobName, final int start,
|
||||
final int count) {
|
||||
|
||||
@@ -310,6 +317,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
|
||||
private List<JobInstance> list = new ArrayList<JobInstance>();
|
||||
|
||||
@Override
|
||||
public Object extractData(ResultSet rs) throws SQLException,
|
||||
DataAccessException {
|
||||
int rowNum = 0;
|
||||
@@ -340,6 +348,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
* org.springframework.batch.core.repository.dao.JobInstanceDao#getJobInstance
|
||||
* (org.springframework.batch.core.JobExecution)
|
||||
*/
|
||||
@Override
|
||||
public JobInstance getJobInstance(JobExecution jobExecution) {
|
||||
|
||||
try {
|
||||
@@ -362,6 +371,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
this.jobIncrementer = jobIncrementer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(jobIncrementer);
|
||||
@@ -383,6 +393,7 @@ public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
this.jobParameters = jobParameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobInstance mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
Long id = rs.getLong(1);
|
||||
if (jobParameters == null) {
|
||||
|
||||
@@ -91,6 +91,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
this.stepExecutionIncrementer = stepExecutionIncrementer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
Assert.notNull(stepExecutionIncrementer, "StepExecutionIncrementer cannot be null.");
|
||||
@@ -103,6 +104,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
*
|
||||
* @see StepExecutionDao#saveStepExecution(StepExecution)
|
||||
*/
|
||||
@Override
|
||||
public void saveStepExecution(StepExecution stepExecution) {
|
||||
|
||||
Assert.isNull(stepExecution.getId(),
|
||||
@@ -145,6 +147,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
Assert.notNull(stepExecution.getStatus(), "StepExecution status cannot be null.");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStepExecution(StepExecution stepExecution) {
|
||||
|
||||
validateStepExecution(stepExecution);
|
||||
@@ -206,6 +209,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StepExecution getStepExecution(JobExecution jobExecution, Long stepExecutionId) {
|
||||
List<StepExecution> executions = getJdbcTemplate().query(getQuery(GET_STEP_EXECUTION),
|
||||
new StepExecutionRowMapper(jobExecution), jobExecution.getId(), stepExecutionId);
|
||||
@@ -220,6 +224,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStepExecutions(JobExecution jobExecution) {
|
||||
getJdbcTemplate().query(getQuery(GET_STEP_EXECUTIONS), new StepExecutionRowMapper(jobExecution),
|
||||
jobExecution.getId());
|
||||
@@ -233,6 +238,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
this.jobExecution = jobExecution;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StepExecution mapRow(ResultSet rs, int rowNum) throws SQLException {
|
||||
StepExecution stepExecution = new StepExecution(rs.getString(2), jobExecution, rs.getLong(1));
|
||||
stepExecution.setStartTime(rs.getTimestamp(3));
|
||||
|
||||
@@ -49,6 +49,7 @@ public class MapExecutionContextDao implements ExecutionContextDao {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(ContextKey them) {
|
||||
if(them == null) return 1;
|
||||
final int idCompare = new Long(this.id).compareTo(new Long(them.id)); // JDK6 Make this Long.compare(x,y)
|
||||
@@ -93,10 +94,12 @@ public class MapExecutionContextDao implements ExecutionContextDao {
|
||||
return (ExecutionContext) SerializationUtils.deserialize(SerializationUtils.serialize(original));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExecutionContext getExecutionContext(StepExecution stepExecution) {
|
||||
return copy(contexts.get(ContextKey.step(stepExecution.getId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExecutionContext(StepExecution stepExecution) {
|
||||
ExecutionContext executionContext = stepExecution.getExecutionContext();
|
||||
if (executionContext != null) {
|
||||
@@ -104,10 +107,12 @@ public class MapExecutionContextDao implements ExecutionContextDao {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExecutionContext getExecutionContext(JobExecution jobExecution) {
|
||||
return copy(contexts.get(ContextKey.job(jobExecution.getId())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExecutionContext(JobExecution jobExecution) {
|
||||
ExecutionContext executionContext = jobExecution.getExecutionContext();
|
||||
if (executionContext != null) {
|
||||
@@ -115,10 +120,12 @@ public class MapExecutionContextDao implements ExecutionContextDao {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveExecutionContext(JobExecution jobExecution) {
|
||||
updateExecutionContext(jobExecution);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveExecutionContext(StepExecution stepExecution) {
|
||||
updateExecutionContext(stepExecution);
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public class MapJobExecutionDao implements JobExecutionDao {
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveJobExecution(JobExecution jobExecution) {
|
||||
Assert.isTrue(jobExecution.getId() == null);
|
||||
Long newId = currentId.getAndIncrement();
|
||||
@@ -61,6 +62,7 @@ public class MapJobExecutionDao implements JobExecutionDao {
|
||||
executionsById.put(newId, copy(jobExecution));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JobExecution> findJobExecutions(JobInstance jobInstance) {
|
||||
List<JobExecution> executions = new ArrayList<JobExecution>();
|
||||
for (JobExecution exec : executionsById.values()) {
|
||||
@@ -70,6 +72,7 @@ public class MapJobExecutionDao implements JobExecutionDao {
|
||||
}
|
||||
Collections.sort(executions, new Comparator<JobExecution>() {
|
||||
|
||||
@Override
|
||||
public int compare(JobExecution e1, JobExecution e2) {
|
||||
long result = (e1.getId() - e2.getId());
|
||||
if (result > 0) {
|
||||
@@ -86,6 +89,7 @@ public class MapJobExecutionDao implements JobExecutionDao {
|
||||
return executions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateJobExecution(JobExecution jobExecution) {
|
||||
Long id = jobExecution.getId();
|
||||
Assert.notNull(id, "JobExecution is expected to have an id (should be saved already)");
|
||||
@@ -103,6 +107,7 @@ public class MapJobExecutionDao implements JobExecutionDao {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobExecution getLastJobExecution(JobInstance jobInstance) {
|
||||
JobExecution lastExec = null;
|
||||
for (JobExecution exec : executionsById.values()) {
|
||||
@@ -125,6 +130,7 @@ public class MapJobExecutionDao implements JobExecutionDao {
|
||||
* @seeorg.springframework.batch.core.repository.dao.JobExecutionDao#
|
||||
* findRunningJobExecutions(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Set<JobExecution> findRunningJobExecutions(String jobName) {
|
||||
Set<JobExecution> result = new HashSet<JobExecution>();
|
||||
for (JobExecution exec : executionsById.values()) {
|
||||
@@ -143,10 +149,12 @@ public class MapJobExecutionDao implements JobExecutionDao {
|
||||
* org.springframework.batch.core.repository.dao.JobExecutionDao#getJobExecution
|
||||
* (java.lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public JobExecution getJobExecution(Long executionId) {
|
||||
return copy(executionsById.get(executionId));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void synchronizeStatus(JobExecution jobExecution) {
|
||||
JobExecution saved = getJobExecution(jobExecution.getId());
|
||||
if (saved.getVersion().intValue() != jobExecution.getVersion().intValue()) {
|
||||
|
||||
@@ -45,6 +45,7 @@ public class MapJobInstanceDao implements JobInstanceDao {
|
||||
jobInstances.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobInstance createJobInstance(String jobName, JobParameters jobParameters) {
|
||||
|
||||
Assert.state(getJobInstance(jobName, jobParameters) == null, "JobInstance must not already exist");
|
||||
@@ -56,6 +57,7 @@ public class MapJobInstanceDao implements JobInstanceDao {
|
||||
return jobInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobInstance getJobInstance(String jobName, JobParameters jobParameters) {
|
||||
|
||||
for (JobInstance instance : jobInstances) {
|
||||
@@ -67,6 +69,7 @@ public class MapJobInstanceDao implements JobInstanceDao {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobInstance getJobInstance(Long instanceId) {
|
||||
for (JobInstance instance : jobInstances) {
|
||||
if (instance.getId().equals(instanceId)) {
|
||||
@@ -76,6 +79,7 @@ public class MapJobInstanceDao implements JobInstanceDao {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getJobNames() {
|
||||
List<String> result = new ArrayList<String>();
|
||||
for (JobInstance instance : jobInstances) {
|
||||
@@ -85,6 +89,7 @@ public class MapJobInstanceDao implements JobInstanceDao {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<JobInstance> getJobInstances(String jobName, int start, int count) {
|
||||
List<JobInstance> result = new ArrayList<JobInstance>();
|
||||
for (JobInstance instance : jobInstances) {
|
||||
@@ -94,6 +99,7 @@ public class MapJobInstanceDao implements JobInstanceDao {
|
||||
}
|
||||
Collections.sort(result, new Comparator<JobInstance>() {
|
||||
// sort by ID descending
|
||||
@Override
|
||||
public int compare(JobInstance o1, JobInstance o2) {
|
||||
return Long.signum(o2.getId() - o1.getId());
|
||||
}
|
||||
@@ -104,6 +110,7 @@ public class MapJobInstanceDao implements JobInstanceDao {
|
||||
return result.subList(startIndex, endIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobInstance getJobInstance(JobExecution jobExecution) {
|
||||
return jobExecution.getJobInstance();
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ public class MapStepExecutionDao implements StepExecutionDao {
|
||||
// Cheaper than full serialization is a reflective field copy, which is
|
||||
// fine for volatile storage
|
||||
ReflectionUtils.doWithFields(StepExecution.class, new ReflectionUtils.FieldCallback() {
|
||||
@Override
|
||||
public void doWith(Field field) throws IllegalArgumentException, IllegalAccessException {
|
||||
field.setAccessible(true);
|
||||
field.set(targetExecution, field.get(sourceExecution));
|
||||
@@ -63,6 +64,7 @@ public class MapStepExecutionDao implements StepExecutionDao {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveStepExecution(StepExecution stepExecution) {
|
||||
|
||||
Assert.isTrue(stepExecution.getId() == null);
|
||||
@@ -83,6 +85,7 @@ public class MapStepExecutionDao implements StepExecutionDao {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStepExecution(StepExecution stepExecution) {
|
||||
|
||||
Assert.notNull(stepExecution.getJobExecutionId());
|
||||
@@ -108,10 +111,12 @@ public class MapStepExecutionDao implements StepExecutionDao {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StepExecution getStepExecution(JobExecution jobExecution, Long stepExecutionId) {
|
||||
return executionsByStepExecutionId.get(stepExecutionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStepExecutions(JobExecution jobExecution) {
|
||||
Map<Long, StepExecution> executions = executionsByJobExecutionId.get(jobExecution.getId());
|
||||
if (executions == null || executions.isEmpty()) {
|
||||
@@ -120,6 +125,7 @@ public class MapStepExecutionDao implements StepExecutionDao {
|
||||
List<StepExecution> result = new ArrayList<StepExecution>(executions.values());
|
||||
Collections.sort(result, new Comparator<Entity>() {
|
||||
|
||||
@Override
|
||||
public int compare(Entity o1, Entity o2) {
|
||||
return Long.signum(o2.getId() - o1.getId());
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ public class XStreamExecutionContextStringSerializer implements ExecutionContext
|
||||
this.hierarchicalStreamDriver = hierarchicalStreamDriver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
init();
|
||||
}
|
||||
@@ -80,6 +81,7 @@ public class XStreamExecutionContextStringSerializer implements ExecutionContext
|
||||
* @param out
|
||||
* @see Serializer#serialize(Object, OutputStream)
|
||||
*/
|
||||
@Override
|
||||
public void serialize(Object context, OutputStream out) throws IOException {
|
||||
Assert.notNull(context);
|
||||
Assert.notNull(out);
|
||||
@@ -94,6 +96,7 @@ public class XStreamExecutionContextStringSerializer implements ExecutionContext
|
||||
* @return a reconstructed execution context
|
||||
* @see Deserializer#deserialize(InputStream)
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Object deserialize(InputStream in) throws IOException {
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||
|
||||
@@ -87,10 +87,12 @@ public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean, I
|
||||
* @return JobRepository.class
|
||||
* @see org.springframework.beans.factory.FactoryBean#getObjectType()
|
||||
*/
|
||||
@Override
|
||||
public Class<JobRepository> getObjectType() {
|
||||
return JobRepository.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
@@ -159,6 +161,7 @@ public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean, I
|
||||
+ isolationLevelForCreate + "\n*=PROPAGATION_REQUIRED"));
|
||||
if (validateTransactionState) {
|
||||
DefaultPointcutAdvisor advisor = new DefaultPointcutAdvisor(new MethodInterceptor() {
|
||||
@Override
|
||||
public Object invoke(MethodInvocation invocation) throws Throwable {
|
||||
if (TransactionSynchronizationManager.isActualTransactionActive()) {
|
||||
throw new IllegalStateException(
|
||||
@@ -180,6 +183,7 @@ public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean, I
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(transactionManager, "TransactionManager must not be null.");
|
||||
|
||||
@@ -191,6 +195,7 @@ public abstract class AbstractJobRepositoryFactoryBean implements FactoryBean, I
|
||||
createExecutionContextDao());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getObject() throws Exception {
|
||||
if (proxyFactory == null) {
|
||||
afterPropertiesSet();
|
||||
|
||||
@@ -83,10 +83,12 @@ public class SimpleJobRepository implements JobRepository {
|
||||
this.ecDao = ecDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJobInstanceExists(String jobName, JobParameters jobParameters) {
|
||||
return jobInstanceDao.getJobInstance(jobName, jobParameters) != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobExecution createJobExecution(String jobName, JobParameters jobParameters)
|
||||
throws JobExecutionAlreadyRunningException, JobRestartException, JobInstanceAlreadyCompleteException {
|
||||
|
||||
@@ -145,6 +147,7 @@ public class SimpleJobRepository implements JobRepository {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(JobExecution jobExecution) {
|
||||
|
||||
Assert.notNull(jobExecution, "JobExecution cannot be null.");
|
||||
@@ -155,6 +158,7 @@ public class SimpleJobRepository implements JobRepository {
|
||||
jobExecutionDao.updateJobExecution(jobExecution);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(StepExecution stepExecution) {
|
||||
validateStepExecution(stepExecution);
|
||||
|
||||
@@ -163,6 +167,7 @@ public class SimpleJobRepository implements JobRepository {
|
||||
ecDao.saveExecutionContext(stepExecution);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(StepExecution stepExecution) {
|
||||
validateStepExecution(stepExecution);
|
||||
Assert.notNull(stepExecution.getId(), "StepExecution must already be saved (have an id assigned)");
|
||||
@@ -178,16 +183,19 @@ public class SimpleJobRepository implements JobRepository {
|
||||
Assert.notNull(stepExecution.getJobExecutionId(), "StepExecution must belong to persisted JobExecution");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExecutionContext(StepExecution stepExecution) {
|
||||
validateStepExecution(stepExecution);
|
||||
Assert.notNull(stepExecution.getId(), "StepExecution must already be saved (have an id assigned)");
|
||||
ecDao.updateExecutionContext(stepExecution);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateExecutionContext(JobExecution jobExecution) {
|
||||
ecDao.updateExecutionContext(jobExecution);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StepExecution getLastStepExecution(JobInstance jobInstance, String stepName) {
|
||||
List<JobExecution> jobExecutions = jobExecutionDao.findJobExecutions(jobInstance);
|
||||
List<StepExecution> stepExecutions = new ArrayList<StepExecution>(jobExecutions.size());
|
||||
@@ -218,6 +226,7 @@ public class SimpleJobRepository implements JobRepository {
|
||||
/**
|
||||
* @return number of executions of the step within given job instance
|
||||
*/
|
||||
@Override
|
||||
public int getStepExecutionCount(JobInstance jobInstance, String stepName) {
|
||||
int count = 0;
|
||||
List<JobExecution> jobExecutions = jobExecutionDao.findJobExecutions(jobInstance);
|
||||
@@ -249,6 +258,7 @@ public class SimpleJobRepository implements JobRepository {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobExecution getLastJobExecution(String jobName, JobParameters jobParameters) {
|
||||
JobInstance jobInstance = jobInstanceDao.getJobInstance(jobName, jobParameters);
|
||||
if (jobInstance == null) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user