Add JSR-305 annotations to public APIs
(Partially) Resolves BATCH-2688
This commit is contained in:
committed by
Michael Minella
parent
89a3b0453a
commit
24b8d72a7a
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,7 @@
|
||||
package org.springframework.batch.core;
|
||||
|
||||
import org.springframework.batch.item.ItemProcessor;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Listener interface for the processing of an item. Implementations
|
||||
@@ -24,6 +25,7 @@ import org.springframework.batch.item.ItemProcessor;
|
||||
* exceptions thrown by the processor.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public interface ItemProcessListener<T, S> extends StepListener {
|
||||
@@ -37,13 +39,13 @@ public interface ItemProcessListener<T, S> extends StepListener {
|
||||
|
||||
/**
|
||||
* Called after {@link ItemProcessor#process(Object)} returns. If the
|
||||
* processor returns null, this method will still be called, with
|
||||
* a null result, allowing for notification of 'filtered' items.
|
||||
* processor returns {@code null}, this method will still be called, with
|
||||
* a {code null} result, allowing for notification of 'filtered' items.
|
||||
*
|
||||
* @param item to be processed
|
||||
* @param result of processing
|
||||
*/
|
||||
void afterProcess(T item, S result);
|
||||
void afterProcess(T item, @Nullable S result);
|
||||
|
||||
/**
|
||||
* Called if an exception was thrown from {@link ItemProcessor#process(Object)}.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2008 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,11 +17,13 @@ package org.springframework.batch.core;
|
||||
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.batch.item.ItemWriter;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Listener interface around the reading of an item.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public interface ItemReadListener<T> extends StepListener {
|
||||
@@ -36,7 +38,7 @@ public interface ItemReadListener<T> extends StepListener {
|
||||
*
|
||||
* @param item returned from read()
|
||||
*/
|
||||
void afterRead(T item);
|
||||
void afterRead(@Nullable T item);
|
||||
|
||||
/**
|
||||
* Called if an error occurs while trying to read.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.batch.core;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Batch domain object representing a job. Job is an explicit abstraction
|
||||
* representing the configuration of a job specified by a developer. It should
|
||||
@@ -22,7 +24,7 @@ package org.springframework.batch.core;
|
||||
* step.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public interface Job {
|
||||
|
||||
@@ -47,11 +49,12 @@ public interface Job {
|
||||
|
||||
/**
|
||||
* If clients need to generate new parameters for the next execution in a
|
||||
* sequence they can use this incrementer. The return value may be null, in
|
||||
* the case that this job does not have a natural sequence.
|
||||
* sequence they can use this incrementer. The return value may be {@code null},
|
||||
* in the case that this job does not have a natural sequence.
|
||||
*
|
||||
* @return in incrementer to be used for creating new parameters
|
||||
*/
|
||||
@Nullable
|
||||
JobParametersIncrementer getJobParametersIncrementer();
|
||||
|
||||
/**
|
||||
@@ -60,8 +63,8 @@ public interface Job {
|
||||
* the execution.
|
||||
*
|
||||
* @return a validator that can be used to check parameter values (never
|
||||
* null)
|
||||
* {@code null})
|
||||
*/
|
||||
JobParametersValidator getJobParametersValidator();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2017 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,12 +29,14 @@ import java.util.Set;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Batch domain object representing the execution of a job.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
@@ -91,7 +93,7 @@ public class JobExecution extends Entity {
|
||||
* @param jobConfigurationName {@link String} instance that represents the
|
||||
* job configuration name (used with JSR-352).
|
||||
*/
|
||||
public JobExecution(JobInstance job, Long id, JobParameters jobParameters, String jobConfigurationName) {
|
||||
public JobExecution(JobInstance job, Long id, @Nullable JobParameters jobParameters, String jobConfigurationName) {
|
||||
super(id);
|
||||
this.jobInstance = job;
|
||||
this.jobParameters = jobParameters == null ? new JobParameters() : jobParameters;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2013 the original author or authors.
|
||||
* Copyright 2013-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,11 +15,14 @@
|
||||
*/
|
||||
package org.springframework.batch.core;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Strategy interface for the generation of the key used in identifying
|
||||
* unique {@link JobInstance}.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
* @param <T> The type of the source data used to calculate the key.
|
||||
* @since 2.2
|
||||
@@ -29,10 +32,10 @@ public interface JobKeyGenerator<T> {
|
||||
/**
|
||||
* Method to generate the unique key used to identify a job instance.
|
||||
*
|
||||
* @param source Source information used to generate the key
|
||||
* @param source Source information used to generate the key (can be {@code null})
|
||||
*
|
||||
* @return a unique string identifying the job based on the information
|
||||
* supplied
|
||||
*/
|
||||
String generateKey(T source);
|
||||
String generateKey(@Nullable T source);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,11 +15,14 @@
|
||||
*/
|
||||
package org.springframework.batch.core;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Interface for obtaining the next {@link JobParameters} in a sequence.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Lucas Ward
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface JobParametersIncrementer {
|
||||
@@ -30,8 +33,8 @@ public interface JobParametersIncrementer {
|
||||
* instance of a job.
|
||||
*
|
||||
* @param parameters the last value used
|
||||
* @return the next value to use
|
||||
* @return the next value to use (never {@code null})
|
||||
*/
|
||||
JobParameters getNext(JobParameters parameters);
|
||||
JobParameters getNext(@Nullable JobParameters parameters);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010 the original author or authors.
|
||||
* Copyright 2010-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,13 +15,15 @@
|
||||
*/
|
||||
package org.springframework.batch.core;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Strategy interface for a {@link Job} to use in validating its parameters for
|
||||
* an execution.
|
||||
*
|
||||
* @author Dave Syer
|
||||
*
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public interface JobParametersValidator {
|
||||
|
||||
@@ -29,9 +31,9 @@ public interface JobParametersValidator {
|
||||
* Check the parameters meet whatever requirements are appropriate, and
|
||||
* throw an exception if not.
|
||||
*
|
||||
* @param parameters some {@link JobParameters}
|
||||
* @param parameters some {@link JobParameters} (can be {@code null})
|
||||
* @throws JobParametersInvalidException if the parameters are invalid
|
||||
*/
|
||||
void validate(JobParameters parameters) throws JobParametersInvalidException;
|
||||
void validate(@Nullable JobParameters parameters) throws JobParametersInvalidException;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,12 +15,14 @@
|
||||
*/
|
||||
package org.springframework.batch.core;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Listener interface for the lifecycle of a {@link Step}.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public interface StepExecutionListener extends StepListener {
|
||||
@@ -44,7 +46,8 @@ public interface StepExecutionListener extends StepListener {
|
||||
*
|
||||
* @param stepExecution {@link StepExecution} instance.
|
||||
* @return an {@link ExitStatus} to combine with the normal value. Return
|
||||
* null to leave the old value unchanged.
|
||||
* {@code null} to leave the old value unchanged.
|
||||
*/
|
||||
@Nullable
|
||||
ExitStatus afterStep(StepExecution stepExecution);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,12 +17,14 @@ package org.springframework.batch.core.configuration;
|
||||
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.launch.NoSuchJobException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A runtime service locator interface for retrieving job configurations by
|
||||
* <code>name</code>.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public interface JobLocator {
|
||||
@@ -37,5 +39,5 @@ public interface JobLocator {
|
||||
* @throws NoSuchJobException if the required configuration can
|
||||
* not be found.
|
||||
*/
|
||||
Job getJob(String name) throws NoSuchJobException;
|
||||
Job getJob(@Nullable String name) throws NoSuchJobException;
|
||||
}
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Annotations and builder factories for java based configuration
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.configuration.annotation;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.configuration.annotation;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Interfaces for registration and location of job configurations.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.configuration;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.configuration;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -35,6 +35,7 @@ import org.springframework.batch.core.step.StepLocator;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -45,6 +46,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Stephane Nicoll
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class DefaultJobLoader implements JobLoader, InitializingBean {
|
||||
|
||||
@@ -77,9 +79,9 @@ public class DefaultJobLoader implements JobLoader, InitializingBean {
|
||||
* Creates a job loader with the job and step registries provided.
|
||||
*
|
||||
* @param jobRegistry a {@link JobRegistry}
|
||||
* @param stepRegistry a {@link StepRegistry}
|
||||
* @param stepRegistry a {@link StepRegistry} (can be {@code null})
|
||||
*/
|
||||
public DefaultJobLoader(JobRegistry jobRegistry, StepRegistry stepRegistry) {
|
||||
public DefaultJobLoader(JobRegistry jobRegistry, @Nullable StepRegistry stepRegistry) {
|
||||
this.jobRegistry = jobRegistry;
|
||||
this.stepRegistry = stepRegistry;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobParametersIncrementer;
|
||||
import org.springframework.batch.core.JobParametersValidator;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
/**
|
||||
@@ -32,6 +33,7 @@ import org.springframework.util.ClassUtils;
|
||||
*
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class GroupAwareJob implements Job {
|
||||
@@ -58,10 +60,10 @@ public class GroupAwareJob implements Job {
|
||||
/**
|
||||
* Create a new {@link Job} with the given group name and delegate.
|
||||
*
|
||||
* @param groupName the group name to prepend
|
||||
* @param groupName the group name to prepend (can be {@code null})
|
||||
* @param delegate a delegate for the features of a regular Job
|
||||
*/
|
||||
public GroupAwareJob(String groupName, Job delegate) {
|
||||
public GroupAwareJob(@Nullable String groupName, Job delegate) {
|
||||
super();
|
||||
this.groupName = groupName;
|
||||
this.delegate = delegate;
|
||||
@@ -89,6 +91,7 @@ public class GroupAwareJob implements Job {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JobParametersIncrementer getJobParametersIncrementer() {
|
||||
return delegate.getJobParametersIncrementer();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,7 @@ import org.springframework.batch.core.configuration.DuplicateJobException;
|
||||
import org.springframework.batch.core.configuration.JobFactory;
|
||||
import org.springframework.batch.core.configuration.JobRegistry;
|
||||
import org.springframework.batch.core.launch.NoSuchJobException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -32,6 +33,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Robert Fischer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class MapJobRegistry implements JobRegistry {
|
||||
|
||||
@@ -60,7 +62,7 @@ public class MapJobRegistry implements JobRegistry {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Job getJob(String name) throws NoSuchJobException {
|
||||
public Job getJob(@Nullable String name) throws NoSuchJobException {
|
||||
JobFactory factory = map.get(name);
|
||||
if (factory == null) {
|
||||
throw new NoSuchJobException("No job configuration with the name [" + name + "] was registered");
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Specific implementations of configuration concerns.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.configuration.support;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.configuration.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Parsers for XML based configuration
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.configuration.xml;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.configuration.xml;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2014 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import org.springframework.batch.core.JobParameter;
|
||||
import org.springframework.batch.core.JobParameter.ParameterType;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.text.DateFormat;
|
||||
@@ -58,6 +59,7 @@ import java.util.Properties;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class DefaultJobParametersConverter implements JobParametersConverter {
|
||||
@@ -92,7 +94,7 @@ public class DefaultJobParametersConverter implements JobParametersConverter {
|
||||
* @see org.springframework.batch.core.converter.JobParametersConverter#getJobParameters(java.util.Properties)
|
||||
*/
|
||||
@Override
|
||||
public JobParameters getJobParameters(Properties props) {
|
||||
public JobParameters getJobParameters(@Nullable Properties props) {
|
||||
|
||||
if (props == null || props.isEmpty()) {
|
||||
return new JobParameters();
|
||||
@@ -188,7 +190,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) {
|
||||
public Properties getProperties(@Nullable JobParameters params) {
|
||||
|
||||
if (params == null || params.isEmpty()) {
|
||||
return new Properties();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import java.util.Properties;
|
||||
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* A factory for {@link JobParameters} instances. A job can be executed with
|
||||
@@ -27,6 +28,7 @@ import org.springframework.batch.core.JobParametersBuilder;
|
||||
* This converter allows job parameters to be converted to and from Properties.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
* @see JobParametersBuilder
|
||||
*
|
||||
@@ -41,7 +43,7 @@ public interface JobParametersConverter {
|
||||
* @return a {@link JobParameters} properties converted to the correct
|
||||
* types.
|
||||
*/
|
||||
public JobParameters getJobParameters(Properties properties);
|
||||
JobParameters getJobParameters(@Nullable Properties properties);
|
||||
|
||||
/**
|
||||
* The inverse operation: get a {@link Properties} instance. If given null
|
||||
@@ -50,5 +52,5 @@ public interface JobParametersConverter {
|
||||
* @param params the {@link JobParameters} instance to be converted.
|
||||
* @return a representation of the parameters as properties
|
||||
*/
|
||||
public Properties getProperties(JobParameters params);
|
||||
Properties getProperties(@Nullable JobParameters params);
|
||||
}
|
||||
|
||||
@@ -3,5 +3,9 @@
|
||||
* concerns.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.converter;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.converter;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,6 +23,7 @@ import org.springframework.batch.core.JobInstance;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.launch.NoSuchJobException;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Entry point for browsing executions of running or historical jobs and steps.
|
||||
@@ -32,6 +33,7 @@ import org.springframework.batch.item.ExecutionContext;
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
* @author Will Schipp
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface JobExplorer {
|
||||
@@ -57,7 +59,8 @@ public interface JobExplorer {
|
||||
* @param executionId the job execution id
|
||||
* @return the {@link JobExecution} with this id, or null if not found
|
||||
*/
|
||||
JobExecution getJobExecution(Long executionId);
|
||||
@Nullable
|
||||
JobExecution getJobExecution(@Nullable Long executionId);
|
||||
|
||||
/**
|
||||
* Retrieve a {@link StepExecution} by its id and parent
|
||||
@@ -71,13 +74,15 @@ public interface JobExplorer {
|
||||
*
|
||||
* @see #getJobExecution(Long)
|
||||
*/
|
||||
StepExecution getStepExecution(Long jobExecutionId, Long stepExecutionId);
|
||||
@Nullable
|
||||
StepExecution getStepExecution(@Nullable Long jobExecutionId, @Nullable Long stepExecutionId);
|
||||
|
||||
/**
|
||||
* @param instanceId {@link Long} id for the jobInstance to obtain.
|
||||
* @return the {@link JobInstance} with this id, or null
|
||||
*/
|
||||
JobInstance getJobInstance(Long instanceId);
|
||||
@Nullable
|
||||
JobInstance getJobInstance(@Nullable Long instanceId);
|
||||
|
||||
/**
|
||||
* Retrieve job executions by their job instance. The corresponding step
|
||||
@@ -99,7 +104,7 @@ public interface JobExplorer {
|
||||
* @param jobName the name of the job
|
||||
* @return the set of running executions for jobs with the specified name
|
||||
*/
|
||||
Set<JobExecution> findRunningJobExecutions(String jobName);
|
||||
Set<JobExecution> findRunningJobExecutions(@Nullable String jobName);
|
||||
|
||||
/**
|
||||
* Query the repository for all unique {@link JobInstance} names (sorted
|
||||
@@ -131,6 +136,6 @@ public interface JobExplorer {
|
||||
* @throws NoSuchJobException thrown when there is no {@link JobInstance}
|
||||
* for the jobName specified.
|
||||
*/
|
||||
int getJobInstanceCount(String jobName) throws NoSuchJobException;
|
||||
int getJobInstanceCount(@Nullable String jobName) throws NoSuchJobException;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Interfaces and related classes to support meta data browsing.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.explore;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.explore;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,7 @@ import org.springframework.batch.core.repository.dao.ExecutionContextDao;
|
||||
import org.springframework.batch.core.repository.dao.JobExecutionDao;
|
||||
import org.springframework.batch.core.repository.dao.JobInstanceDao;
|
||||
import org.springframework.batch.core.repository.dao.StepExecutionDao;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@@ -36,6 +37,7 @@ import java.util.Set;
|
||||
* @author Lucas Ward
|
||||
* @author Michael Minella
|
||||
* @author Will Schipp
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
* @see JobExplorer
|
||||
* @see JobInstanceDao
|
||||
@@ -157,7 +159,7 @@ public class SimpleJobExplorer implements JobExplorer {
|
||||
* .lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public JobInstance getJobInstance(Long instanceId) {
|
||||
public JobInstance getJobInstance(@Nullable Long instanceId) {
|
||||
return jobInstanceDao.getJobInstance(instanceId);
|
||||
}
|
||||
|
||||
@@ -187,7 +189,7 @@ public class SimpleJobExplorer implements JobExplorer {
|
||||
* @see org.springframework.batch.core.explore.JobExplorer#getJobInstanceCount(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public int getJobInstanceCount(String jobName) throws NoSuchJobException {
|
||||
public int getJobInstanceCount(@Nullable String jobName) throws NoSuchJobException {
|
||||
return jobInstanceDao.getJobInstanceCount(jobName);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Specific implementations of explorer concerns.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.explore.support;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.explore.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2014 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,6 +43,7 @@ import org.springframework.batch.core.step.StepLocator;
|
||||
import org.springframework.batch.repeat.RepeatException;
|
||||
import org.springframework.beans.factory.BeanNameAware;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
@@ -54,6 +55,7 @@ import org.springframework.util.ClassUtils;
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public abstract class AbstractJob implements Job, StepLocator, BeanNameAware,
|
||||
InitializingBean {
|
||||
@@ -211,6 +213,7 @@ InitializingBean {
|
||||
* @see org.springframework.batch.core.Job#getJobParametersIncrementer()
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public JobParametersIncrementer getJobParametersIncrementer() {
|
||||
return this.jobParametersIncrementer;
|
||||
}
|
||||
@@ -287,6 +290,8 @@ InitializingBean {
|
||||
@Override
|
||||
public final void execute(JobExecution execution) {
|
||||
|
||||
Assert.notNull(execution, "jobExecution must not be null");
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Job execution starting: " + execution);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2011-2013 the original author or authors.
|
||||
* Copyright 2011-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersInvalidException;
|
||||
import org.springframework.batch.core.JobParametersValidator;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -28,6 +29,7 @@ import org.springframework.util.Assert;
|
||||
* injected <code>JobParametersValidator</code>s
|
||||
*
|
||||
* @author Morten Andersen-Gott
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class CompositeJobParametersValidator implements JobParametersValidator, InitializingBean {
|
||||
@@ -42,7 +44,7 @@ public class CompositeJobParametersValidator implements JobParametersValidator,
|
||||
* @throws JobParametersInvalidException if the parameters are invalid
|
||||
*/
|
||||
@Override
|
||||
public void validate(JobParameters parameters) throws JobParametersInvalidException {
|
||||
public void validate(@Nullable JobParameters parameters) throws JobParametersInvalidException {
|
||||
for (JobParametersValidator validator : validators) {
|
||||
validator.validate(parameters);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,12 +24,14 @@ import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersInvalidException;
|
||||
import org.springframework.batch.core.JobParametersValidator;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Default implementation of {@link JobParametersValidator}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class DefaultJobParametersValidator implements JobParametersValidator, InitializingBean {
|
||||
@@ -83,7 +85,7 @@ public class DefaultJobParametersValidator implements JobParametersValidator, In
|
||||
* @throws JobParametersInvalidException if the parameters are not valid
|
||||
*/
|
||||
@Override
|
||||
public void validate(JobParameters parameters) throws JobParametersInvalidException {
|
||||
public void validate(@Nullable JobParameters parameters) throws JobParametersInvalidException {
|
||||
|
||||
if (parameters == null) {
|
||||
throw new JobParametersInvalidException("The JobParameters can not be null");
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Job and flow level builders for java based configuration of batch jobs
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.job.builder;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.job.builder;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,12 +21,14 @@ import org.springframework.batch.core.StartLimitExceededException;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.repository.JobRestartException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Context and execution strategy for {@link FlowJob} to allow it to delegate
|
||||
* its execution step by step.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface FlowExecutor {
|
||||
@@ -48,6 +50,7 @@ public interface FlowExecutor {
|
||||
/**
|
||||
* @return the latest {@link StepExecution} or null if there is none
|
||||
*/
|
||||
@Nullable
|
||||
StepExecution getStepExecution();
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,6 +17,7 @@ package org.springframework.batch.core.job.flow;
|
||||
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Interface allowing for programmatic access to the decision on what the status
|
||||
@@ -25,6 +26,7 @@ import org.springframework.batch.core.StepExecution;
|
||||
* implementation could check that value to determine the status of the flow.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
*/
|
||||
public interface JobExecutionDecider {
|
||||
@@ -35,9 +37,9 @@ public interface JobExecutionDecider {
|
||||
* determine the next step in the job.
|
||||
*
|
||||
* @param jobExecution a job execution
|
||||
* @param stepExecution the latest step execution (may be null)
|
||||
* @param stepExecution the latest step execution (may be {@code null})
|
||||
* @return the exit status code
|
||||
*/
|
||||
FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution);
|
||||
FlowExecutionStatus decide(JobExecution jobExecution, @Nullable StepExecution stepExecution);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,6 +26,7 @@ import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.job.StepHandler;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.batch.core.repository.JobRestartException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Implementation of {@link FlowExecutor} for use in components that need to
|
||||
@@ -33,6 +34,7 @@ import org.springframework.batch.core.repository.JobRestartException;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class JobFlowExecutor implements FlowExecutor {
|
||||
@@ -108,6 +110,7 @@ public class JobFlowExecutor implements FlowExecutor {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public StepExecution getStepExecution() {
|
||||
return stepExecutionHolder.get();
|
||||
}
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Flow related constructs including Flow interface, executors, and related exceptions
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.job.flow;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.job.flow;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.batch.core.job.flow.support;
|
||||
import org.springframework.batch.core.ExitStatus;
|
||||
import org.springframework.batch.core.job.flow.State;
|
||||
import org.springframework.batch.support.PatternMatcher;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -29,6 +30,7 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
*/
|
||||
public final class StateTransition {
|
||||
@@ -108,15 +110,15 @@ public final class StateTransition {
|
||||
* @param state the {@link State} used to generate the outcome for this
|
||||
* transition
|
||||
* @param pattern the pattern to match in the exit status of the
|
||||
* {@link State}
|
||||
* @param next the name of the next {@link State} to execute
|
||||
* {@link State} (can be {@code null})
|
||||
* @param next the name of the next {@link State} to execute (can be {@code null})
|
||||
* @return {@link StateTransition} that was created.
|
||||
*/
|
||||
public static StateTransition createStateTransition(State state, String pattern, String next) {
|
||||
public static StateTransition createStateTransition(State state, @Nullable String pattern, @Nullable String next) {
|
||||
return new StateTransition(state, pattern, next);
|
||||
}
|
||||
|
||||
private StateTransition(State state, String pattern, String next) {
|
||||
private StateTransition(State state, @Nullable String pattern, @Nullable String next) {
|
||||
super();
|
||||
if (!StringUtils.hasText(pattern)) {
|
||||
this.pattern = "*";
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Basic implementations of flow constructs
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.job.flow.support;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.job.flow.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* States used in defining the underlying Spring Batch state machine
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.job.flow.support.state;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.job.flow.support.state;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Specific implementations of job concerns.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.job;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.job;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
* Copyright 2013-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,12 +18,14 @@ package org.springframework.batch.core.jsr;
|
||||
import javax.batch.operations.BatchRuntimeException;
|
||||
|
||||
import org.springframework.batch.core.ItemProcessListener;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Wrapper class for {@link javax.batch.api.chunk.listener.ItemProcessListener}
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
* @param <T> input type
|
||||
* @param <S> output type
|
||||
@@ -51,7 +53,7 @@ public class ItemProcessListenerAdapter<T,S> implements ItemProcessListener<T, S
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterProcess(T item, S result) {
|
||||
public void afterProcess(T item, @Nullable S result) {
|
||||
try {
|
||||
delegate.afterProcess(item, result);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
* Copyright 2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,6 +19,7 @@ import javax.batch.operations.BatchRuntimeException;
|
||||
|
||||
import org.springframework.batch.core.ItemReadListener;
|
||||
import org.springframework.batch.item.ItemReader;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -26,6 +27,7 @@ import org.springframework.util.Assert;
|
||||
* a {@link ItemReadListener}.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
* @param <T> type to be returned via a read on the associated {@link ItemReader}
|
||||
* @since 3.0
|
||||
@@ -49,7 +51,7 @@ public class ItemReadListenerAdapter<T> implements ItemReadListener<T> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterRead(T item) {
|
||||
public void afterRead(@Nullable T item) {
|
||||
try {
|
||||
delegate.afterRead(item);
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
* Copyright 2013-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,7 @@ import javax.batch.runtime.BatchStatus;
|
||||
|
||||
import org.springframework.batch.core.ExitStatus;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -31,6 +32,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Chris Schaefer
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 3.0
|
||||
*/
|
||||
public class JsrJobContext implements javax.batch.runtime.context.JobContext {
|
||||
@@ -44,7 +46,7 @@ public class JsrJobContext implements javax.batch.runtime.context.JobContext {
|
||||
this.jobExecution = jobExecution;
|
||||
}
|
||||
|
||||
public void setProperties(Properties properties) {
|
||||
public void setProperties(@Nullable Properties properties) {
|
||||
this.properties = properties != null ? properties : new Properties();
|
||||
}
|
||||
|
||||
@@ -108,6 +110,7 @@ public class JsrJobContext implements javax.batch.runtime.context.JobContext {
|
||||
* @see javax.batch.runtime.context.JobContext#getExitStatus()
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public String getExitStatus() {
|
||||
return exitStatusSet.get() ? jobExecution.getExitStatus().getExitCode() : null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
* Copyright 2013-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -31,6 +31,7 @@ import org.springframework.batch.item.database.support.DefaultDataFieldMaxValueI
|
||||
import org.springframework.batch.support.DatabaseType;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -43,6 +44,7 @@ import org.springframework.util.Assert;
|
||||
* for BATCH_JOB_INSTANCE records.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 3.0
|
||||
*/
|
||||
public class JsrJobParametersConverter implements JobParametersConverter, InitializingBean {
|
||||
@@ -82,7 +84,7 @@ public class JsrJobParametersConverter implements JobParametersConverter, Initia
|
||||
* @see org.springframework.batch.core.converter.JobParametersConverter#getJobParameters(java.util.Properties)
|
||||
*/
|
||||
@Override
|
||||
public JobParameters getJobParameters(Properties properties) {
|
||||
public JobParameters getJobParameters(@Nullable Properties properties) {
|
||||
JobParametersBuilder builder = new JobParametersBuilder();
|
||||
boolean runIdFound = false;
|
||||
|
||||
@@ -110,7 +112,7 @@ public class JsrJobParametersConverter implements JobParametersConverter, Initia
|
||||
* @see org.springframework.batch.core.converter.JobParametersConverter#getProperties(org.springframework.batch.core.JobParameters)
|
||||
*/
|
||||
@Override
|
||||
public Properties getProperties(JobParameters params) {
|
||||
public Properties getProperties(@Nullable JobParameters params) {
|
||||
Properties properties = new Properties();
|
||||
boolean runIdFound = false;
|
||||
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Extensions of Spring components to support JSR-352 functionality.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.configuration.support;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.configuration.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* XML parsers for JSR-352 based Job Specification Language (JSL).
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.configuration.xml;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.configuration.xml;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* JSR-352 specific extensions of Flow constructs (executor and job).
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.job.flow;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.job.flow;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,6 +28,7 @@ import org.springframework.batch.core.job.flow.support.SimpleFlow;
|
||||
import org.springframework.batch.core.job.flow.support.StateTransition;
|
||||
import org.springframework.batch.core.jsr.job.flow.support.state.JsrStepState;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
@@ -38,6 +39,7 @@ import org.springframework.util.StringUtils;
|
||||
* attempts fail, the flow will fail due to the inability to find the next state.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 3.0
|
||||
*/
|
||||
public class JsrFlow extends SimpleFlow {
|
||||
@@ -51,6 +53,7 @@ public class JsrFlow extends SimpleFlow {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String getMostRecentStepName() {
|
||||
if(currentStep != null) {
|
||||
return currentStep.getStep().getName();
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* JSR-352 specific flow extensions.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.job.flow.support;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.job.flow.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* JSR-352 specific states used in flow execution.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.job.flow.support.state;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.job.flow.support.state;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* JSR-352 specific handler implementations.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.job;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.job;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Implementation of the JSR-352 specific job launching facilities.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.launch;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.launch;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Extensions of core batch components to apply JSR-352 specific logic.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Implementation of JSR-352 specific partitioning extensions.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.partition;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.partition;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Support classes for JSR-352 partitioning configuration.
|
||||
*
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.partition.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
@@ -2,5 +2,9 @@
|
||||
* Classes for supporting JSR-352's {@link javax.batch.api.Batchlet}.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.step.batchlet;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.step.batchlet;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Extensions to step related builders to implement JSR-352 specific functionality
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.step.builder;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.step.builder;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* JSR-352 specific components for implementing item based processing including fault tolerance.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.step.item;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.step.item;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* JSR-352 extensions of existing batch {@link org.springframework.batch.core.Step} types.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.jsr.step;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.jsr.step;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Interfaces and simple implementations of launch concerns.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.launch;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.launch;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,9 +18,11 @@ package org.springframework.batch.core.launch.support;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.batch.core.JobParametersIncrementer;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class RunIdIncrementer implements JobParametersIncrementer {
|
||||
|
||||
@@ -41,7 +43,7 @@ public class RunIdIncrementer implements JobParametersIncrementer {
|
||||
* Increment the run.id parameter (starting with 1).
|
||||
*/
|
||||
@Override
|
||||
public JobParameters getNext(JobParameters parameters) {
|
||||
public JobParameters getNext(@Nullable JobParameters parameters) {
|
||||
|
||||
JobParameters params = (parameters == null) ? new JobParameters() : parameters;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,9 +27,11 @@ import org.springframework.batch.core.JobParameter;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.JobParametersBuilder;
|
||||
import org.springframework.batch.core.converter.JobParametersConverter;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* @author Lucas Ward
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class ScheduledJobParametersFactory implements JobParametersConverter {
|
||||
@@ -44,7 +46,7 @@ public class ScheduledJobParametersFactory implements JobParametersConverter {
|
||||
* @see org.springframework.batch.core.runtime.JobParametersFactory#getJobParameters(java.util.Properties)
|
||||
*/
|
||||
@Override
|
||||
public JobParameters getJobParameters(Properties props) {
|
||||
public JobParameters getJobParameters(@Nullable Properties props) {
|
||||
|
||||
if (props == null || props.isEmpty()) {
|
||||
return new JobParameters();
|
||||
@@ -75,7 +77,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) {
|
||||
public Properties getProperties(@Nullable JobParameters params) {
|
||||
|
||||
if (params == null || params.isEmpty()) {
|
||||
return new Properties();
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Support classes for use in bootstrap and launch implementations or configurations.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.launch.support;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.launch.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,9 +20,11 @@ import java.util.List;
|
||||
|
||||
import org.springframework.batch.core.ItemProcessListener;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class CompositeItemProcessListener<T, S> implements ItemProcessListener<T, S> {
|
||||
@@ -54,7 +56,7 @@ public class CompositeItemProcessListener<T, S> implements ItemProcessListener<T
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterProcess(T item, S result) {
|
||||
public void afterProcess(T item, @Nullable S result) {
|
||||
for (Iterator<ItemProcessListener<? super T, ? super S>> iterator = listeners.reverse(); iterator.hasNext();) {
|
||||
ItemProcessListener<? super T, ? super S> listener = iterator.next();
|
||||
listener.afterProcess(item, result);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import java.util.List;
|
||||
import org.springframework.batch.core.ItemProcessListener;
|
||||
import org.springframework.batch.core.ItemReadListener;
|
||||
import org.springframework.batch.core.ItemWriteListener;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Basic no-op implementation of the {@link ItemReadListener},
|
||||
@@ -28,6 +29,7 @@ import org.springframework.batch.core.ItemWriteListener;
|
||||
* at once.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class ItemListenerSupport<I, O> implements ItemReadListener<I>, ItemProcessListener<I, O>, ItemWriteListener<O> {
|
||||
@@ -66,7 +68,7 @@ public class ItemListenerSupport<I, O> implements ItemReadListener<I>, ItemProce
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterProcess(I item, O result) {
|
||||
public void afterProcess(I item, @Nullable O result) {
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -23,12 +23,14 @@ import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobExecutionListener;
|
||||
import org.springframework.batch.core.annotation.AfterJob;
|
||||
import org.springframework.batch.core.annotation.BeforeJob;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Enumeration for {@link JobExecutionListener} meta data, which ties together the names
|
||||
* of methods, their interfaces, annotation, and expected arguments.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 2.0
|
||||
* @see JobListenerFactoryBean
|
||||
*/
|
||||
@@ -85,8 +87,9 @@ public enum JobListenerMetaData implements ListenerMetaData {
|
||||
* Return the relevant meta data for the provided property name.
|
||||
*
|
||||
* @param propertyName name of the property to retrieve.
|
||||
* @return meta data with supplied property name, null if none exists.
|
||||
* @return meta data with supplied property name, {@code null} if none exists.
|
||||
*/
|
||||
@Nullable
|
||||
public static JobListenerMetaData fromPropertyName(String propertyName){
|
||||
return propertyMap.get(propertyName);
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@ import org.springframework.batch.core.StepExecutionListener;
|
||||
import org.springframework.batch.core.StepListener;
|
||||
import org.springframework.batch.core.scope.context.ChunkContext;
|
||||
import org.springframework.batch.item.ItemStream;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* @author Dave Syer
|
||||
@@ -130,7 +131,7 @@ ItemProcessListener<T, S>, ItemWriteListener<S>, SkipListener<T, S>, RetryReadLi
|
||||
* java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterProcess(T item, S result) {
|
||||
public void afterProcess(T item, @Nullable S result) {
|
||||
try {
|
||||
itemProcessListener.afterProcess(item, result);
|
||||
}
|
||||
@@ -222,7 +223,7 @@ ItemProcessListener<T, S>, ItemWriteListener<S>, SkipListener<T, S>, RetryReadLi
|
||||
* @see org.springframework.batch.core.listener.CompositeItemReadListener#afterRead(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterRead(T item) {
|
||||
public void afterRead(@Nullable T item) {
|
||||
try {
|
||||
itemReadListener.afterRead(item);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -27,12 +27,14 @@ import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.StepExecutionListener;
|
||||
import org.springframework.batch.core.StepListener;
|
||||
import org.springframework.batch.core.scope.context.ChunkContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Basic no-op implementations of all {@link StepListener} interfaces.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Robert Kasanicky
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class StepListenerSupport<T,S> implements StepExecutionListener, ChunkListener,
|
||||
ItemReadListener<T>, ItemProcessListener<T,S>, ItemWriteListener<S>, SkipListener<T, S> {
|
||||
@@ -70,7 +72,7 @@ ItemReadListener<T>, ItemProcessListener<T,S>, ItemWriteListener<S>, SkipListene
|
||||
* @see org.springframework.batch.core.domain.ItemReadListener#afterRead(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterRead(T item) {
|
||||
public void afterRead(@Nullable T item) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -112,7 +114,7 @@ ItemReadListener<T>, ItemProcessListener<T,S>, ItemWriteListener<S>, SkipListene
|
||||
* @see org.springframework.batch.core.ItemProcessListener#afterProcess(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void afterProcess(T item, S result) {
|
||||
public void afterProcess(T item, @Nullable S result) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Generic implementations of core batch listener interfaces.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.listener;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.listener;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -4,5 +4,9 @@
|
||||
* There is a reference implementation of the core interfaces in the execution module.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Interfaces for partitioning components.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.partition;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.partition;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Implementation of common partition components.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.partition.support;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.partition.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,7 @@ import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.repository.dao.JobExecutionDao;
|
||||
import org.springframework.batch.core.repository.dao.JobInstanceDao;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.transaction.annotation.Isolation;
|
||||
|
||||
import java.util.Collection;
|
||||
@@ -43,6 +44,7 @@ import java.util.Collection;
|
||||
* @author Robert Kasanicky
|
||||
* @author David Turanski
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public interface JobRepository {
|
||||
|
||||
@@ -181,6 +183,7 @@ public interface JobRepository {
|
||||
* @param stepName the name of the step execution that might have run.
|
||||
* @return the last execution of step for the given job instance.
|
||||
*/
|
||||
@Nullable
|
||||
StepExecution getLastStepExecution(JobInstance jobInstance, String stepName);
|
||||
|
||||
/**
|
||||
@@ -195,6 +198,7 @@ public interface JobRepository {
|
||||
* @param jobParameters parameters identifying the {@link JobInstance}
|
||||
* @return the last execution of job if exists, null otherwise
|
||||
*/
|
||||
@Nullable
|
||||
JobExecution getLastJobExecution(String jobName, JobParameters jobParameters);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -43,6 +43,7 @@ import org.springframework.dao.OptimisticLockingFailureException;
|
||||
import org.springframework.jdbc.core.RowCallbackHandler;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -58,6 +59,7 @@ import org.springframework.util.Assert;
|
||||
* @author Dave Syer
|
||||
* @author Robert Kasanicky
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements JobExecutionDao, InitializingBean {
|
||||
|
||||
@@ -241,7 +243,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobExecution getLastJobExecution(JobInstance jobInstance) {
|
||||
public JobExecution getLastJobExecution(@Nullable JobInstance jobInstance) {
|
||||
|
||||
Long id = jobInstance.getId();
|
||||
|
||||
@@ -265,6 +267,7 @@ public class JdbcJobExecutionDao extends AbstractJdbcBatchMetadataDao implements
|
||||
* getLastJobExecution(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public JobExecution getJobExecution(Long executionId) {
|
||||
try {
|
||||
JobExecution jobExecution = getJdbcTemplate().queryForObject(getQuery(GET_EXECUTION_BY_ID),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2014 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,6 +34,7 @@ import org.springframework.dao.EmptyResultDataAccessException;
|
||||
import org.springframework.jdbc.core.ResultSetExtractor;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
@@ -51,6 +52,7 @@ import org.springframework.util.StringUtils;
|
||||
* @author Robert Kasanicky
|
||||
* @author Michael Minella
|
||||
* @author Will Schipp
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public class JdbcJobInstanceDao extends AbstractJdbcBatchMetadataDao implements
|
||||
JobInstanceDao, InitializingBean {
|
||||
@@ -130,6 +132,7 @@ JobInstanceDao, InitializingBean {
|
||||
* if any {@link JobParameters} fields are null.
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public JobInstance getJobInstance(final String jobName,
|
||||
final JobParameters jobParameters) {
|
||||
|
||||
@@ -166,7 +169,8 @@ JobInstanceDao, InitializingBean {
|
||||
* (java.lang.Long)
|
||||
*/
|
||||
@Override
|
||||
public JobInstance getJobInstance(Long instanceId) {
|
||||
@Nullable
|
||||
public JobInstance getJobInstance(@Nullable Long instanceId) {
|
||||
|
||||
try {
|
||||
return getJdbcTemplate().queryForObject(getQuery(GET_JOB_FROM_ID),
|
||||
@@ -241,6 +245,7 @@ JobInstanceDao, InitializingBean {
|
||||
* (org.springframework.batch.core.JobExecution)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public JobInstance getJobInstance(JobExecution jobExecution) {
|
||||
|
||||
try {
|
||||
@@ -256,7 +261,7 @@ JobInstanceDao, InitializingBean {
|
||||
* @see org.springframework.batch.core.repository.dao.JobInstanceDao#getJobInstanceCount(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public int getJobInstanceCount(String jobName) throws NoSuchJobException {
|
||||
public int getJobInstanceCount(@Nullable String jobName) throws NoSuchJobException {
|
||||
|
||||
try {
|
||||
return getJdbcTemplate().queryForObject(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,6 +39,7 @@ import org.springframework.dao.OptimisticLockingFailureException;
|
||||
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
|
||||
import org.springframework.jdbc.core.RowMapper;
|
||||
import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -58,6 +59,7 @@ import org.springframework.util.Assert;
|
||||
* @author Dave Syer
|
||||
* @author Robert Kasanicky
|
||||
* @author David Turanski
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
* @see StepExecutionDao
|
||||
*/
|
||||
@@ -281,6 +283,7 @@ public class JdbcStepExecutionDao extends AbstractJdbcBatchMetadataDao implement
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public StepExecution getStepExecution(JobExecution jobExecution, Long stepExecutionId) {
|
||||
List<StepExecution> executions = getJdbcTemplate().query(getQuery(GET_STEP_EXECUTION),
|
||||
new StepExecutionRowMapper(jobExecution), jobExecution.getId(), stepExecutionId);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,12 +21,14 @@ import java.util.Set;
|
||||
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobInstance;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Data Access Object for job executions.
|
||||
*
|
||||
* @author Lucas Ward
|
||||
* @author Robert Kasanicky
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public interface JobExecutionDao {
|
||||
|
||||
@@ -63,8 +65,10 @@ public interface JobExecutionDao {
|
||||
* Find the last {@link JobExecution} to have been created for a given
|
||||
* {@link JobInstance}.
|
||||
* @param jobInstance the {@link JobInstance}
|
||||
* @return the last {@link JobExecution} to execute for this instance
|
||||
* @return the last {@link JobExecution} to execute for this instance or
|
||||
* {@code null} if no job execution is found for the given job instance.
|
||||
*/
|
||||
@Nullable
|
||||
JobExecution getLastJobExecution(JobInstance jobInstance);
|
||||
|
||||
/**
|
||||
@@ -78,6 +82,7 @@ public interface JobExecutionDao {
|
||||
* @param executionId {@link Long} containing the id of the execution.
|
||||
* @return the {@link JobExecution} for given identifier.
|
||||
*/
|
||||
@Nullable
|
||||
JobExecution getJobExecution(Long executionId);
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,7 @@ import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobInstance;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.launch.NoSuchJobException;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Data Access Object for job instances.
|
||||
@@ -29,6 +30,7 @@ import org.springframework.batch.core.launch.NoSuchJobException;
|
||||
* @author Lucas Ward
|
||||
* @author Robert Kasanicky
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public interface JobInstanceDao {
|
||||
@@ -56,24 +58,27 @@ public interface JobInstanceDao {
|
||||
* @param jobName the name of the job
|
||||
* @param jobParameters the parameters with which the job was executed
|
||||
* @return {@link JobInstance} object matching the job name and
|
||||
* {@link JobParameters} or null
|
||||
* {@link JobParameters} or {@code null}
|
||||
*/
|
||||
@Nullable
|
||||
JobInstance getJobInstance(String jobName, JobParameters jobParameters);
|
||||
|
||||
/**
|
||||
* Fetch the job instance with the provided identifier.
|
||||
*
|
||||
* @param instanceId the job identifier
|
||||
* @return the job instance with this identifier or null if it doesn't exist
|
||||
* @return the job instance with this identifier or {@code null} if it doesn't exist
|
||||
*/
|
||||
JobInstance getJobInstance(Long instanceId);
|
||||
@Nullable
|
||||
JobInstance getJobInstance(@Nullable Long instanceId);
|
||||
|
||||
/**
|
||||
* Fetch the JobInstance for the provided JobExecution.
|
||||
*
|
||||
* @param jobExecution the JobExecution
|
||||
* @return the JobInstance for the provided execution or null if it doesn't exist.
|
||||
* @return the JobInstance for the provided execution or {@code null} if it doesn't exist.
|
||||
*/
|
||||
@Nullable
|
||||
JobInstance getJobInstance(JobExecution jobExecution);
|
||||
|
||||
/**
|
||||
@@ -122,6 +127,6 @@ public interface JobInstanceDao {
|
||||
*
|
||||
* @throws NoSuchJobException thrown if no Job has the jobName specified.
|
||||
*/
|
||||
int getJobInstanceCount(String jobName) throws NoSuchJobException;
|
||||
int getJobInstanceCount(@Nullable String jobName) throws NoSuchJobException;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2014 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.JobInstance;
|
||||
import org.springframework.dao.OptimisticLockingFailureException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.SerializationUtils;
|
||||
|
||||
@@ -106,7 +107,7 @@ public class MapJobExecutionDao implements JobExecutionDao {
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobExecution getLastJobExecution(JobInstance jobInstance) {
|
||||
public JobExecution getLastJobExecution(@Nullable JobInstance jobInstance) {
|
||||
JobExecution lastExec = null;
|
||||
for (JobExecution exec : executionsById.values()) {
|
||||
if (!exec.getJobInstance().equals(jobInstance)) {
|
||||
@@ -148,6 +149,7 @@ public class MapJobExecutionDao implements JobExecutionDao {
|
||||
* (java.lang.Long)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public JobExecution getJobExecution(Long executionId) {
|
||||
return copy(executionsById.get(executionId));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2014 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -30,6 +30,7 @@ import org.springframework.batch.core.JobInstance;
|
||||
import org.springframework.batch.core.JobKeyGenerator;
|
||||
import org.springframework.batch.core.JobParameters;
|
||||
import org.springframework.batch.core.launch.NoSuchJobException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -63,12 +64,14 @@ public class MapJobInstanceDao implements JobInstanceDao {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JobInstance getJobInstance(String jobName, JobParameters jobParameters) {
|
||||
return jobInstances.get(jobName + "|" + jobKeyGenerator.generateKey(jobParameters));
|
||||
}
|
||||
|
||||
@Override
|
||||
public JobInstance getJobInstance(Long instanceId) {
|
||||
@Nullable
|
||||
public JobInstance getJobInstance(@Nullable Long instanceId) {
|
||||
for (Map.Entry<String, JobInstance> instanceEntry : jobInstances.entrySet()) {
|
||||
JobInstance instance = instanceEntry.getValue();
|
||||
if (instance.getId().equals(instanceId)) {
|
||||
@@ -104,12 +107,13 @@ public class MapJobInstanceDao implements JobInstanceDao {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JobInstance getJobInstance(JobExecution jobExecution) {
|
||||
return jobExecution.getJobInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getJobInstanceCount(String jobName) throws NoSuchJobException {
|
||||
public int getJobInstanceCount(@Nullable String jobName) throws NoSuchJobException {
|
||||
int count = 0;
|
||||
|
||||
for (Map.Entry<String, JobInstance> instanceEntry : jobInstances.entrySet()) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2014 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +29,7 @@ import org.springframework.batch.core.Entity;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.dao.OptimisticLockingFailureException;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.SerializationUtils;
|
||||
@@ -113,6 +114,7 @@ public class MapStepExecutionDao implements StepExecutionDao {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public StepExecution getStepExecution(JobExecution jobExecution, Long stepExecutionId) {
|
||||
return executionsByStepExecutionId.get(stepExecutionId);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import java.util.Collection;
|
||||
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
public interface StepExecutionDao {
|
||||
|
||||
@@ -61,6 +62,7 @@ public interface StepExecutionDao {
|
||||
* @param stepExecutionId the step execution id
|
||||
* @return a {@link StepExecution}
|
||||
*/
|
||||
@Nullable
|
||||
StepExecution getStepExecution(JobExecution jobExecution, Long stepExecutionId);
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Specific implementations of dao concerns.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.repository.dao;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.repository.dao;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Interfaces and generic implementations of repository concerns.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.repository;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.repository;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2014 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,6 +32,7 @@ import org.springframework.batch.core.repository.dao.JobExecutionDao;
|
||||
import org.springframework.batch.core.repository.dao.JobInstanceDao;
|
||||
import org.springframework.batch.core.repository.dao.StepExecutionDao;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -50,6 +51,7 @@ import java.util.List;
|
||||
* @author Dave Syer
|
||||
* @author Robert Kasanicky
|
||||
* @author David Turanski
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
* @see JobRepository
|
||||
* @see JobInstanceDao
|
||||
@@ -215,6 +217,7 @@ public class SimpleJobRepository implements JobRepository {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public StepExecution getLastStepExecution(JobInstance jobInstance, String stepName) {
|
||||
List<JobExecution> jobExecutions = jobExecutionDao.findJobExecutions(jobInstance);
|
||||
List<StepExecution> stepExecutions = new ArrayList<StepExecution>(jobExecutions.size());
|
||||
@@ -289,6 +292,7 @@ public class SimpleJobRepository implements JobRepository {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public JobExecution getLastJobExecution(String jobName, JobParameters jobParameters) {
|
||||
JobInstance jobInstance = jobInstanceDao.getJobInstance(jobName, jobParameters);
|
||||
if (jobInstance == null) {
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Specific implementations of repository concerns.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.repository.support;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.repository.support;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,6 +33,7 @@ import org.springframework.batch.core.UnexpectedJobExecutionException;
|
||||
import org.springframework.batch.core.scope.StepScope;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.repeat.context.SynchronizedAttributeAccessor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -44,6 +45,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Jimmy Praet (create JobContext based on {@link StepContext})
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 3.0
|
||||
*/
|
||||
public class JobContext extends SynchronizedAttributeAccessor {
|
||||
@@ -134,6 +136,7 @@ public class JobContext extends SynchronizedAttributeAccessor {
|
||||
* @see SynchronizedAttributeAccessor#removeAttribute(String)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object removeAttribute(String name) {
|
||||
unregisterDestructionCallbacks(name);
|
||||
return super.removeAttribute(name);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
* Copyright 2013-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.batch.core.scope.context;
|
||||
import org.springframework.batch.core.Job;
|
||||
import org.springframework.batch.core.JobExecution;
|
||||
import org.springframework.batch.core.jsr.configuration.support.BatchPropertyContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Central convenience class for framework use in managing the job scope
|
||||
@@ -28,6 +29,7 @@ import org.springframework.batch.core.jsr.configuration.support.BatchPropertyCon
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Jimmy Praet
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 3.0
|
||||
*/
|
||||
public class JobSynchronizationManager {
|
||||
@@ -46,11 +48,12 @@ public class JobSynchronizationManager {
|
||||
};
|
||||
|
||||
/**
|
||||
* Getter for the current context if there is one, otherwise returns null.
|
||||
* Getter for the current context if there is one, otherwise returns {@code null}.
|
||||
*
|
||||
* @return the current {@link JobContext} or null if there is none (if one
|
||||
* @return the current {@link JobContext} or {@code null} if there is none (if one
|
||||
* has not been registered for this thread).
|
||||
*/
|
||||
@Nullable
|
||||
public static JobContext getContext() {
|
||||
return manager.getContext();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,6 +34,7 @@ import org.springframework.batch.core.jsr.configuration.support.BatchPropertyCon
|
||||
import org.springframework.batch.core.scope.StepScope;
|
||||
import org.springframework.batch.item.ExecutionContext;
|
||||
import org.springframework.batch.repeat.context.SynchronizedAttributeAccessor;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
@@ -46,6 +47,7 @@ import org.springframework.util.Assert;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class StepContext extends SynchronizedAttributeAccessor {
|
||||
@@ -184,6 +186,7 @@ public class StepContext extends SynchronizedAttributeAccessor {
|
||||
* @see SynchronizedAttributeAccessor#removeAttribute(String)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public Object removeAttribute(String name) {
|
||||
unregisterDestructionCallbacks(name);
|
||||
return super.removeAttribute(name);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,6 +25,7 @@ import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.repeat.RepeatCallback;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
|
||||
/**
|
||||
@@ -32,6 +33,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* callback inside a {@link Step}.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public abstract class StepContextRepeatCallback implements RepeatCallback {
|
||||
@@ -60,6 +62,7 @@ public abstract class StepContextRepeatCallback implements RepeatCallback {
|
||||
* @see RepeatCallback#doInIteration(RepeatContext)
|
||||
*/
|
||||
@Override
|
||||
@Nullable
|
||||
public RepeatStatus doInIteration(RepeatContext context) throws Exception {
|
||||
|
||||
// The StepContext has to be the same for all chunks,
|
||||
@@ -106,6 +109,7 @@ public abstract class StepContextRepeatCallback implements RepeatCallback {
|
||||
* @throws Exception implementations can throw an exception if anything goes
|
||||
* wrong
|
||||
*/
|
||||
@Nullable
|
||||
public abstract RepeatStatus doInChunkContext(RepeatContext context, ChunkContext chunkContext) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@ package org.springframework.batch.core.scope.context;
|
||||
import org.springframework.batch.core.Step;
|
||||
import org.springframework.batch.core.StepExecution;
|
||||
import org.springframework.batch.core.jsr.configuration.support.BatchPropertyContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Central convenience class for framework use in managing the step scope
|
||||
@@ -28,6 +29,7 @@ import org.springframework.batch.core.jsr.configuration.support.BatchPropertyCon
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class StepSynchronizationManager {
|
||||
@@ -55,11 +57,12 @@ public class StepSynchronizationManager {
|
||||
};
|
||||
|
||||
/**
|
||||
* Getter for the current context if there is one, otherwise returns null.
|
||||
* Getter for the current context if there is one, otherwise returns {@code null}.
|
||||
*
|
||||
* @return the current {@link StepContext} or null if there is none (if one
|
||||
* @return the current {@link StepContext} or {@code null} if there is none (if one
|
||||
* has not been registered for this thread).
|
||||
*/
|
||||
@Nullable
|
||||
public static StepContext getContext() {
|
||||
return manager.getContext();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013 the original author or authors.
|
||||
* Copyright 2013-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,6 +21,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.springframework.batch.core.jsr.configuration.support.BatchPropertyContext;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
|
||||
/**
|
||||
@@ -29,6 +30,7 @@ import org.springframework.batch.core.jsr.configuration.support.BatchPropertyCon
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Jimmy Praet
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @since 3.0
|
||||
*/
|
||||
public abstract class SynchronizationManagerSupport<E, C> {
|
||||
@@ -61,11 +63,12 @@ public abstract class SynchronizationManagerSupport<E, C> {
|
||||
private final Map<E, C> contexts = new ConcurrentHashMap<E, C>();
|
||||
|
||||
/**
|
||||
* Getter for the current context if there is one, otherwise returns null.
|
||||
* Getter for the current context if there is one, otherwise returns {@code null}.
|
||||
*
|
||||
* @return the current context or null if there is none (if one
|
||||
* @return the current context or {@code null} if there is none (if one
|
||||
* has not been registered for this thread).
|
||||
*/
|
||||
@Nullable
|
||||
public C getContext() {
|
||||
if (getCurrent().isEmpty()) {
|
||||
return null;
|
||||
@@ -84,7 +87,8 @@ public abstract class SynchronizationManagerSupport<E, C> {
|
||||
* @return a new context or the current one if it has the same
|
||||
* execution
|
||||
*/
|
||||
public C register(E execution) {
|
||||
@Nullable
|
||||
public C register(@Nullable E execution) {
|
||||
if (execution == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -111,7 +115,8 @@ public abstract class SynchronizationManagerSupport<E, C> {
|
||||
* @return a new context or the current one if it has the same
|
||||
* execution
|
||||
*/
|
||||
public C register(E execution, BatchPropertyContext propertyContext) {
|
||||
@Nullable
|
||||
public C register(@Nullable E execution, @Nullable BatchPropertyContext propertyContext) {
|
||||
if (execution == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -197,6 +202,6 @@ public abstract class SynchronizationManagerSupport<E, C> {
|
||||
|
||||
protected abstract void close(C context);
|
||||
|
||||
protected abstract C createNewContext(E execution, BatchPropertyContext propertyContext);
|
||||
protected abstract C createNewContext(E execution, @Nullable BatchPropertyContext propertyContext);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Implementation of the contexts for each of the custom bean scopes in Spring Batch (Job and Step).
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.scope.context;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.scope.context;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Implementation of Spring Batch specific bean scopes (Job and Step).
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.scope;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.scope;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,6 +48,7 @@ import org.springframework.util.ClassUtils;
|
||||
* @author Robert Kasanicky
|
||||
* @author Michael Minella
|
||||
* @author Chris Schaefer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
public abstract class AbstractStep implements Step, InitializingBean, BeanNameAware {
|
||||
|
||||
@@ -180,6 +181,8 @@ public abstract class AbstractStep implements Step, InitializingBean, BeanNameAw
|
||||
public final void execute(StepExecution stepExecution) throws JobInterruptedException,
|
||||
UnexpectedJobExecutionException {
|
||||
|
||||
Assert.notNull(stepExecution, "stepExecution must not be null");
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("Executing: id=" + stepExecution.getId());
|
||||
}
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Step level builders for java based job configuration.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.step.builder;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.step.builder;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Factories for step level components.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.step.factory;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.step.factory;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2013 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,6 +28,7 @@ import org.springframework.batch.repeat.RepeatCallback;
|
||||
import org.springframework.batch.repeat.RepeatContext;
|
||||
import org.springframework.batch.repeat.RepeatOperations;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Simple implementation of the ChunkProvider interface that does basic chunk
|
||||
@@ -35,6 +36,7 @@ import org.springframework.batch.repeat.RepeatStatus;
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
* @see ChunkOrientedTasklet
|
||||
*/
|
||||
public class SimpleChunkProvider<I> implements ChunkProvider<I> {
|
||||
@@ -82,9 +84,10 @@ public class SimpleChunkProvider<I> implements ChunkProvider<I> {
|
||||
|
||||
/**
|
||||
* Surrounds the read call with listener callbacks.
|
||||
* @return item
|
||||
* @return the item or {@code null} if the data source is exhausted
|
||||
* @throws Exception is thrown if error occurs during read.
|
||||
*/
|
||||
@Nullable
|
||||
protected final I doRead() throws Exception {
|
||||
try {
|
||||
listener.beforeRead();
|
||||
@@ -146,13 +149,14 @@ public class SimpleChunkProvider<I> implements ChunkProvider<I> {
|
||||
*
|
||||
* @param contribution the current step execution contribution
|
||||
* @param chunk the current chunk
|
||||
* @return a new item for processing
|
||||
* @return a new item for processing or {@code null} if the data source is exhausted
|
||||
*
|
||||
* @throws SkipOverflowException if specifically the chunk is accumulating
|
||||
* too much data (e.g. skips) and it wants to force a commit.
|
||||
*
|
||||
* @throws Exception if there is a generic issue
|
||||
*/
|
||||
@Nullable
|
||||
protected I read(StepContribution contribution, Chunk<I> chunk) throws SkipOverflowException, Exception {
|
||||
return doRead();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,10 +16,13 @@
|
||||
|
||||
package org.springframework.batch.core.step.item;
|
||||
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Wrapper for an item and its exception if it failed processing.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public class SkipWrapper<T> {
|
||||
@@ -43,7 +46,7 @@ public class SkipWrapper<T> {
|
||||
}
|
||||
|
||||
|
||||
public SkipWrapper(T item, Throwable e) {
|
||||
public SkipWrapper(T item, @Nullable Throwable e) {
|
||||
this.item = item;
|
||||
this.exception = e;
|
||||
}
|
||||
@@ -52,6 +55,7 @@ public class SkipWrapper<T> {
|
||||
* Public getter for the exception.
|
||||
* @return the exception
|
||||
*/
|
||||
@Nullable
|
||||
public Throwable getException() {
|
||||
return exception;
|
||||
}
|
||||
@@ -69,4 +73,4 @@ public class SkipWrapper<T> {
|
||||
return String.format("[exception=%s, item=%s]", exception, item);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Specific implementations of step concerns for item-oriented approach.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.step.item;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.step.item;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* {@link org.springframework.batch.core.step.job.JobStep} and related components.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.step.job;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.step.job;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Specific implementations of step concerns.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.step;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.step;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Specific implementations of skip concerns for items in a step.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.step.skip;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.step.skip;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006-2007 the original author or authors.
|
||||
* Copyright 2006-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,11 +18,13 @@ package org.springframework.batch.core.step.tasklet;
|
||||
import org.springframework.batch.core.StepContribution;
|
||||
import org.springframework.batch.core.scope.context.ChunkContext;
|
||||
import org.springframework.batch.repeat.RepeatStatus;
|
||||
import org.springframework.lang.Nullable;
|
||||
|
||||
/**
|
||||
* Strategy for processing in a step.
|
||||
*
|
||||
* @author Dave Syer
|
||||
* @author Mahmoud Ben Hassine
|
||||
*
|
||||
*/
|
||||
public interface Tasklet {
|
||||
@@ -38,10 +40,11 @@ public interface Tasklet {
|
||||
* @param chunkContext attributes shared between invocations but not between
|
||||
* restarts
|
||||
* @return an {@link RepeatStatus} indicating whether processing is
|
||||
* continuable.
|
||||
* continuable. Returning {@code null} is interpreted as {@link RepeatStatus#FINISHED}
|
||||
*
|
||||
* @throws Exception thrown if error occurs during execution.
|
||||
*/
|
||||
@Nullable
|
||||
RepeatStatus execute(StepContribution contribution, ChunkContext chunkContext) throws Exception;
|
||||
|
||||
}
|
||||
|
||||
@@ -2,5 +2,9 @@
|
||||
* Interfaces and generic implementations of tasklet concerns.
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Mahmoud Ben Hassine
|
||||
*/
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
@NonNullApi
|
||||
package org.springframework.batch.core.step.tasklet;
|
||||
|
||||
import org.springframework.lang.NonNullApi;
|
||||
|
||||
Reference in New Issue
Block a user