diff --git a/spring-batch-core/.springBeans b/spring-batch-core/.springBeans index 2ec86ee18..7ef294ee0 100644 --- a/spring-batch-core/.springBeans +++ b/spring-batch-core/.springBeans @@ -1,30 +1,35 @@ - - xml - + 1 + + + + + + src/test/resources/org/springframework/batch/core/configuration/support/test-context.xml + src/test/resources/org/springframework/batch/core/launch/support/job.xml + src/test/resources/org/springframework/batch/core/launch/support/test-environment.xml + src/test/resources/org/springframework/batch/core/repository/support/dao/data-source-context.xml + src/test/resources/org/springframework/batch/core/repository/support/dao/sql-dao-test.xml - - - true - false - - - - - - true - false - - - true false + src/test/resources/org/springframework/batch/core/launch/support/job.xml + src/test/resources/org/springframework/batch/core/launch/support/test-environment.xml + + + + + true + false + + src/test/resources/org/springframework/batch/core/repository/support/dao/data-source-context.xml + src/test/resources/org/springframework/batch/core/repository/support/dao/sql-dao-test.xml diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessor.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessor.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessor.java index 2fae13d60..3f01ffd4d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessor.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessor.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.configuration; +package org.springframework.batch.core.configuration.support; import java.util.Collection; import java.util.HashSet; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/configuration/MapJobRegistry.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/MapJobRegistry.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/configuration/MapJobRegistry.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/MapJobRegistry.java index e5c054754..d5cc6f5ab 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/configuration/MapJobRegistry.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/MapJobRegistry.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.configuration; +package org.springframework.batch.core.configuration.support; import java.util.Collection; import java.util.Collections; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/configuration/ReferenceJobFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ReferenceJobFactory.java similarity index 96% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/configuration/ReferenceJobFactory.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ReferenceJobFactory.java index 84c21508f..07fedf384 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/configuration/ReferenceJobFactory.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/ReferenceJobFactory.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.configuration; +package org.springframework.batch.core.configuration.support; import org.springframework.batch.core.Job; import org.springframework.batch.core.configuration.JobFactory; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/configuration/package.html b/spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/package.html similarity index 100% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/configuration/package.html rename to spring-batch-core/src/main/java/org/springframework/batch/core/configuration/support/package.html diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/job/AbstractJob.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/AbstractJob.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/job/AbstractJob.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/AbstractJob.java index 64984bde2..3c10fe462 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/job/AbstractJob.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/AbstractJob.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.job; +package org.springframework.batch.core.job; import java.util.ArrayList; import java.util.List; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/job/SimpleJob.java b/spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleJob.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/job/SimpleJob.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleJob.java index da22406f8..aea6bea4c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/job/SimpleJob.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/job/SimpleJob.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.job; +package org.springframework.batch.core.job; import java.util.Date; import java.util.Iterator; @@ -29,8 +29,8 @@ import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.JobListener; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; +import org.springframework.batch.core.listener.CompositeJobListener; import org.springframework.batch.core.repository.JobRepository; -import org.springframework.batch.execution.listener.CompositeJobListener; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.repeat.ExitStatus; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/job/package.html b/spring-batch-core/src/main/java/org/springframework/batch/core/job/package.html similarity index 100% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/job/package.html rename to spring-batch-core/src/main/java/org/springframework/batch/core/job/package.html diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/JobLauncher.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobLauncher.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/JobLauncher.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobLauncher.java index 14d8d835d..eb333dc1b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/JobLauncher.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/JobLauncher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.launch; +package org.springframework.batch.core.launch; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/SimpleJobLauncher.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/SimpleJobLauncher.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/SimpleJobLauncher.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/SimpleJobLauncher.java index 6a848fb83..38b550a7c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/SimpleJobLauncher.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/SimpleJobLauncher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.launch; +package org.springframework.batch.core.launch; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/package.html b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/package.html similarity index 100% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/package.html rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/package.html diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/CommandLineJobRunner.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/CommandLineJobRunner.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java index 82e57b3c6..25d057533 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/CommandLineJobRunner.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/CommandLineJobRunner.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; import java.util.Properties; @@ -23,10 +23,10 @@ import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.configuration.JobLocator; +import org.springframework.batch.core.launch.JobLauncher; import org.springframework.batch.core.runtime.ExitStatusExceptionClassifier; import org.springframework.batch.core.runtime.JobParametersFactory; -import org.springframework.batch.execution.launch.JobLauncher; -import org.springframework.batch.execution.step.support.SimpleExitStatusExceptionClassifier; +import org.springframework.batch.core.step.support.SimpleExitStatusExceptionClassifier; import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.config.AutowireCapableBeanFactory; import org.springframework.context.ApplicationContext; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/DefaultJobParametersFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/DefaultJobParametersFactory.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/DefaultJobParametersFactory.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/DefaultJobParametersFactory.java index fe90e7771..d01a53b36 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/DefaultJobParametersFactory.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/DefaultJobParametersFactory.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; import java.text.DateFormat; import java.text.DecimalFormat; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/ExitCodeMapper.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ExitCodeMapper.java similarity index 93% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/ExitCodeMapper.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ExitCodeMapper.java index 772028bf2..6eb9e6c4b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/ExitCodeMapper.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ExitCodeMapper.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/ExportedJobLauncher.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ExportedJobLauncher.java similarity index 94% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/ExportedJobLauncher.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ExportedJobLauncher.java index c745309a2..998771f46 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/ExportedJobLauncher.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ExportedJobLauncher.java @@ -14,12 +14,12 @@ * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; import java.util.Properties; import org.springframework.batch.core.JobExecution; -import org.springframework.batch.execution.launch.JobLauncher; +import org.springframework.batch.core.launch.JobLauncher; /** * Interface to expose for remote management of jobs. Similar to diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/JvmSystemExiter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JvmSystemExiter.java similarity index 89% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/JvmSystemExiter.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JvmSystemExiter.java index bbd1b9278..c9eee42a2 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/JvmSystemExiter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/JvmSystemExiter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; /** * Implementation of the {@link SystemExiter} interface that calls the standards @@ -31,7 +31,7 @@ public class JvmSystemExiter implements SystemExiter { * Delegate call to System.exit() with the argument provided. Do not use * this at home children! * - * @see org.springframework.batch.execution.launch.support.SystemExiter#exit(int) + * @see org.springframework.batch.core.launch.support.SystemExiter#exit(int) */ public void exit(int status) { System.exit(status); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/ScheduledJobParametersFactory.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ScheduledJobParametersFactory.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/ScheduledJobParametersFactory.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ScheduledJobParametersFactory.java index 84e983c12..2768c0abd 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/ScheduledJobParametersFactory.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/ScheduledJobParametersFactory.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; import java.text.DateFormat; import java.text.ParseException; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/SimpleExportedJobLauncher.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleExportedJobLauncher.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/SimpleExportedJobLauncher.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleExportedJobLauncher.java index 8e2e89837..2195c2be9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/SimpleExportedJobLauncher.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleExportedJobLauncher.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; import java.util.HashMap; import java.util.Iterator; @@ -25,11 +25,11 @@ import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.configuration.JobLocator; +import org.springframework.batch.core.launch.JobLauncher; import org.springframework.batch.core.repository.JobRestartException; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.repository.NoSuchJobException; import org.springframework.batch.core.runtime.JobParametersFactory; -import org.springframework.batch.execution.launch.JobLauncher; import org.springframework.batch.support.PropertiesConverter; import org.springframework.beans.factory.InitializingBean; import org.springframework.util.Assert; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/SimpleJvmExitCodeMapper.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/SimpleJvmExitCodeMapper.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java index 65b5f8a30..679f3bcbe 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/SimpleJvmExitCodeMapper.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapper.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; import java.util.HashMap; import java.util.Map; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/SystemExiter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SystemExiter.java similarity index 95% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/SystemExiter.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SystemExiter.java index 34e97382f..71e10e0b8 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/SystemExiter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/SystemExiter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; /** * Interface for exiting the JVM. This abstraction is only diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/package.html b/spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/package.html similarity index 100% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/launch/support/package.html rename to spring-batch-core/src/main/java/org/springframework/batch/core/launch/support/package.html diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeChunkListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeChunkListener.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeChunkListener.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeChunkListener.java index e55c59185..aa4fd80d1 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeChunkListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeChunkListener.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.listener; +package org.springframework.batch.core.listener; import java.util.ArrayList; import java.util.Arrays; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeItemReadListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemReadListener.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeItemReadListener.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemReadListener.java index ce1555862..3d680d640 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeItemReadListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemReadListener.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.listener; +package org.springframework.batch.core.listener; import java.util.ArrayList; import java.util.Arrays; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeItemWriteListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemWriteListener.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeItemWriteListener.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemWriteListener.java index 496e2f636..83a23823a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeItemWriteListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeItemWriteListener.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.listener; +package org.springframework.batch.core.listener; import java.util.ArrayList; import java.util.Arrays; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeJobListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeJobListener.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeJobListener.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeJobListener.java index 7290ace15..b7737f640 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeJobListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeJobListener.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.listener; +package org.springframework.batch.core.listener; import java.util.ArrayList; import java.util.Arrays; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeStepListener.java b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeStepListener.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeStepListener.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeStepListener.java index 9550fce2c..f697bf976 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/listener/CompositeStepListener.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/listener/CompositeStepListener.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.listener; +package org.springframework.batch.core.listener; import java.util.ArrayList; import java.util.Arrays; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/JobRepositoryFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBean.java similarity index 87% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/JobRepositoryFactoryBean.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBean.java index 0284af5e2..c51d0ac25 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/JobRepositoryFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBean.java @@ -14,16 +14,16 @@ * limitations under the License. */ -package org.springframework.batch.execution.repository; +package org.springframework.batch.core.repository.support; import javax.sql.DataSource; -import org.springframework.batch.execution.repository.dao.JdbcJobExecutionDao; -import org.springframework.batch.execution.repository.dao.JdbcJobInstanceDao; -import org.springframework.batch.execution.repository.dao.JdbcStepExecutionDao; -import org.springframework.batch.execution.repository.dao.JobExecutionDao; -import org.springframework.batch.execution.repository.dao.JobInstanceDao; -import org.springframework.batch.execution.repository.dao.StepExecutionDao; +import org.springframework.batch.core.repository.support.dao.JdbcJobExecutionDao; +import org.springframework.batch.core.repository.support.dao.JdbcJobInstanceDao; +import org.springframework.batch.core.repository.support.dao.JdbcStepExecutionDao; +import org.springframework.batch.core.repository.support.dao.JobExecutionDao; +import org.springframework.batch.core.repository.support.dao.JobInstanceDao; +import org.springframework.batch.core.repository.support.dao.StepExecutionDao; import org.springframework.batch.item.database.support.DataFieldMaxValueIncrementerFactory; import org.springframework.batch.item.database.support.DefaultDataFieldMaxValueIncrementerFactory; import org.springframework.beans.factory.FactoryBean; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java index 5210a3c5d..a0853eb8c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/SimpleJobRepository.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/SimpleJobRepository.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.repository; +package org.springframework.batch.core.repository.support; import java.util.ArrayList; import java.util.Iterator; @@ -29,9 +29,9 @@ import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.repository.JobRestartException; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.repository.JobRepository; -import org.springframework.batch.execution.repository.dao.JobExecutionDao; -import org.springframework.batch.execution.repository.dao.JobInstanceDao; -import org.springframework.batch.execution.repository.dao.StepExecutionDao; +import org.springframework.batch.core.repository.support.dao.JobExecutionDao; +import org.springframework.batch.core.repository.support.dao.JobInstanceDao; +import org.springframework.batch.core.repository.support.dao.StepExecutionDao; import org.springframework.transaction.annotation.Isolation; import org.springframework.util.Assert; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/AbstractJdbcBatchMetadataDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/AbstractJdbcBatchMetadataDao.java similarity index 95% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/AbstractJdbcBatchMetadataDao.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/AbstractJdbcBatchMetadataDao.java index ab5239cc6..f4247ba2d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/AbstractJdbcBatchMetadataDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/AbstractJdbcBatchMetadataDao.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import org.springframework.beans.factory.InitializingBean; import org.springframework.jdbc.core.JdbcOperations; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcJobExecutionDao.java similarity index 99% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobExecutionDao.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcJobExecutionDao.java index 9725148f8..29c3c31c1 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcJobExecutionDao.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobInstanceDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcJobInstanceDao.java similarity index 99% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobInstanceDao.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcJobInstanceDao.java index a3f4b21a8..0c8f6b4bc 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JdbcJobInstanceDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcJobInstanceDao.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcStepExecutionDao.java similarity index 99% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcStepExecutionDao.java index 72462fb5f..b1e7725a9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JdbcStepExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JdbcStepExecutionDao.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.io.Serializable; import java.sql.PreparedStatement; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JobExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JobExecutionDao.java similarity index 95% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JobExecutionDao.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JobExecutionDao.java index f1bdee39f..31cc3de95 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JobExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JobExecutionDao.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.util.List; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JobInstanceDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JobInstanceDao.java similarity index 94% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JobInstanceDao.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JobInstanceDao.java index c26d20ff8..8ae323b6d 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/JobInstanceDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/JobInstanceDao.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobInstance; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/MapJobExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/MapJobExecutionDao.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/MapJobExecutionDao.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/MapJobExecutionDao.java index 0d68d22d2..9599262aa 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/MapJobExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/MapJobExecutionDao.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.util.ArrayList; import java.util.Iterator; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/MapJobInstanceDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/MapJobInstanceDao.java similarity index 95% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/MapJobInstanceDao.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/MapJobInstanceDao.java index 20b120a2f..dd0aab3ea 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/MapJobInstanceDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/MapJobInstanceDao.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.util.Collection; import java.util.Iterator; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/MapStepExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/MapStepExecutionDao.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/MapStepExecutionDao.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/MapStepExecutionDao.java index e480c45da..c6e93617b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/MapStepExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/MapStepExecutionDao.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.util.Map; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/NoSuchObjectException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/NoSuchObjectException.java similarity index 94% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/NoSuchObjectException.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/NoSuchObjectException.java index ccbdf1635..d1ae2985a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/NoSuchObjectException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/NoSuchObjectException.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; /** * This exception identifies that a batch domain object is invalid, which diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/StepExecutionDao.java b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/StepExecutionDao.java similarity index 95% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/StepExecutionDao.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/StepExecutionDao.java index 8d5d384c5..7fc916966 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/StepExecutionDao.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/StepExecutionDao.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.Step; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/package.html b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/package.html similarity index 100% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/dao/package.html rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/dao/package.html diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/repository/package.html b/spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/package.html similarity index 100% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/repository/package.html rename to spring-batch-core/src/main/java/org/springframework/batch/core/repository/support/package.html diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/resource/StepExecutionProxyResource.java b/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionProxyResource.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/resource/StepExecutionProxyResource.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionProxyResource.java index df3dabf28..b932095bc 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/resource/StepExecutionProxyResource.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/resource/StepExecutionProxyResource.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.resource; +package org.springframework.batch.core.resource; import java.io.File; import java.io.IOException; @@ -28,9 +28,9 @@ import java.util.Map.Entry; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.StepListener; +import org.springframework.batch.core.launch.support.DefaultJobParametersFactory; import org.springframework.batch.core.listener.StepListenerSupport; import org.springframework.batch.core.runtime.JobParametersFactory; -import org.springframework.batch.execution.launch.support.DefaultJobParametersFactory; import org.springframework.context.ResourceLoaderAware; import org.springframework.core.io.FileSystemResourceLoader; import org.springframework.core.io.Resource; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/AbstractStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/AbstractStep.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java index 2b612237f..66af15187 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/AbstractStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStep.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step; +package org.springframework.batch.core.step; import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.JobInterruptedException; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/AbstractStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStepFactoryBean.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/AbstractStepFactoryBean.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStepFactoryBean.java index ea216ce45..07e2ac0d7 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/AbstractStepFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/AbstractStepFactoryBean.java @@ -13,11 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step; import org.springframework.batch.core.Step; import org.springframework.batch.core.repository.JobRepository; -import org.springframework.batch.execution.step.ItemOrientedStep; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemWriter; import org.springframework.beans.factory.BeanNameAware; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/BatchListenerFactoryHelper.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/BatchListenerFactoryHelper.java similarity index 94% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/BatchListenerFactoryHelper.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/BatchListenerFactoryHelper.java index 24ce7f9be..a7c182054 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/BatchListenerFactoryHelper.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/BatchListenerFactoryHelper.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step; import java.util.ArrayList; import java.util.List; @@ -23,9 +23,9 @@ import org.springframework.batch.core.ChunkListener; import org.springframework.batch.core.ItemReadListener; import org.springframework.batch.core.ItemWriteListener; import org.springframework.batch.core.StepListener; -import org.springframework.batch.execution.listener.CompositeChunkListener; -import org.springframework.batch.execution.listener.CompositeItemReadListener; -import org.springframework.batch.execution.listener.CompositeItemWriteListener; +import org.springframework.batch.core.listener.CompositeChunkListener; +import org.springframework.batch.core.listener.CompositeItemReadListener; +import org.springframework.batch.core.listener.CompositeItemWriteListener; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemWriter; import org.springframework.batch.item.reader.DelegatingItemReader; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/DefaultStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/DefaultStepFactoryBean.java new file mode 100644 index 000000000..7ad022f4a --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/DefaultStepFactoryBean.java @@ -0,0 +1,246 @@ +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.core.step; + +import org.springframework.batch.core.BatchListener; +import org.springframework.batch.core.Step; +import org.springframework.batch.core.StepListener; +import org.springframework.batch.core.step.support.LimitCheckingItemSkipPolicy; +import org.springframework.batch.core.step.support.ListenerMulticaster; +import org.springframework.batch.core.step.support.NeverSkipItemSkipPolicy; +import org.springframework.batch.item.ItemReader; +import org.springframework.batch.item.ItemStream; +import org.springframework.batch.item.ItemWriter; +import org.springframework.batch.repeat.exception.ExceptionHandler; +import org.springframework.batch.repeat.exception.SimpleLimitExceptionHandler; +import org.springframework.batch.repeat.policy.SimpleCompletionPolicy; +import org.springframework.batch.repeat.support.RepeatTemplate; +import org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate; +import org.springframework.core.task.TaskExecutor; + +/** + * Most common configuration options for simple steps should be found here. Use + * this factory bean instead of creating a {@link Step} implementation manually. + * + * @author Dave Syer + * + */ +public class DefaultStepFactoryBean extends AbstractStepFactoryBean { + + private int skipLimit = 0; + + private int commitInterval = 0; + + private ItemStream[] streams = new ItemStream[0]; + + private BatchListener[] listeners = new BatchListener[0]; + + private ListenerMulticaster listener = new ListenerMulticaster(); + + private TaskExecutor taskExecutor; + + private ItemHandler itemHandler; + + private RepeatTemplate stepOperations; + + private SimpleLimitExceptionHandler exceptionHandler; + + /** + * Set the commit interval. + * + * @param commitInterval + */ + public void setCommitInterval(int commitInterval) { + this.commitInterval = commitInterval; + } + + /** + * The streams to inject into the {@link Step}. Any instance of + * {@link ItemStream} can be used, and will then receive callbacks at the + * appropriate stage in the step. + * + * @param streams an array of listeners + */ + public void setStreams(ItemStream[] streams) { + this.streams = streams; + } + + /** + * Public setter for a limit that determines skip policy. If this value is + * positive then an exception in chunk processing will cause the item to be + * skipped and no exception propagated until the limit is reached. If it is + * zero then all exceptions will be propagated from the chunk and cause the + * step to abort. + * + * @param skipLimit the value to set. Default is 0 (never skip). + */ + public void setSkipLimit(int skipLimit) { + this.skipLimit = skipLimit; + } + + /** + * The listeners to inject into the {@link Step}. Any instance of + * {@link BatchListener} can be used, and will then receive callbacks at the + * appropriate stage in the step. + * + * @param listeners an array of listeners + */ + public void setListeners(BatchListener[] listeners) { + this.listeners = listeners; + } + + /** + * Protected getter for the step operations to make them available in + * subclasses. + * @return the step operations + */ + protected RepeatTemplate getStepOperations() { + return stepOperations; + } + + /** + * Public setter for the SimpleLimitExceptionHandler. + * @param exceptionHandler the exceptionHandler to set + */ + public void setExceptionHandler(SimpleLimitExceptionHandler exceptionHandler) { + this.exceptionHandler = exceptionHandler; + } + + /** + * Protected getter for the {@link ExceptionHandler}. + * @return the {@link ExceptionHandler} + */ + protected ExceptionHandler getExceptionHandler() { + return exceptionHandler; + } + + /** + * Public setter for the {@link TaskExecutor}. If this is set, then it will + * be used to execute the chunk processing inside the {@link Step}. + * + * @param taskExecutor the taskExecutor to set + */ + public void setTaskExecutor(TaskExecutor taskExecutor) { + this.taskExecutor = taskExecutor; + } + + /** + * Public getter for the ItemProcessor. + * @return the itemProcessor + */ + protected ItemHandler getItemHandler() { + return itemHandler; + } + + /** + * Public setter for the ItemProcessor. + * @param itemHandler the itemProcessor to set + */ + protected void setItemHandler(ItemHandler itemHandler) { + this.itemHandler = itemHandler; + } + + /** + * @param step + * + */ + protected void applyConfiguration(ItemOrientedStep step) { + + super.applyConfiguration(step); + + step.setStreams(streams); + + for (int i = 0; i < listeners.length; i++) { + BatchListener listener = listeners[i]; + if (listener instanceof StepListener) { + step.registerStepListener((StepListener) listener); + } + else { + this.listener.register(listener); + } + } + + ItemReader itemReader = getItemReader(); + ItemWriter itemWriter = getItemWriter(); + + // Since we are going to wrap these things with listener callbacks we + // need to register them here because the step will not know we did + // that. + if (itemReader instanceof ItemStream) { + step.registerStream((ItemStream) itemReader); + } + if (itemReader instanceof StepListener) { + step.registerStepListener((StepListener) itemReader); + } + if (itemWriter instanceof ItemStream) { + step.registerStream((ItemStream) itemWriter); + } + if (itemWriter instanceof StepListener) { + step.registerStepListener((StepListener) itemWriter); + } + + BatchListenerFactoryHelper helper = new BatchListenerFactoryHelper(); + + if (commitInterval > 0) { + RepeatTemplate chunkOperations = new RepeatTemplate(); + chunkOperations.setCompletionPolicy(new SimpleCompletionPolicy(commitInterval)); + helper.addChunkListeners(chunkOperations, listeners); + step.setChunkOperations(chunkOperations); + } + + StepListener[] stepListeners = helper.getStepListeners(listeners); + itemReader = helper.getItemReader(itemReader, listeners); + itemWriter = helper.getItemWriter(itemWriter, listeners); + stepOperations = new RepeatTemplate(); + + // In case they are used by subclasses: + setItemReader(itemReader); + setItemWriter(itemWriter); + + step.setStepListeners(stepListeners); + + if (taskExecutor != null) { + TaskExecutorRepeatTemplate repeatTemplate = new TaskExecutorRepeatTemplate(); + repeatTemplate.setTaskExecutor(taskExecutor); + stepOperations = repeatTemplate; + } + + step.setStepOperations(stepOperations); + + ItemSkipPolicyItemHandler itemProcessor = new ItemSkipPolicyItemHandler(itemReader, itemWriter); + + if (skipLimit > 0) { + /* + * If there is a skip limit (not the default) then we are prepared + * to absorb exceptions at the step level because the failed items + * will never re-appear after a rollback. + */ + itemProcessor.setItemSkipPolicy(new LimitCheckingItemSkipPolicy(skipLimit)); + setExceptionHandler(new SimpleLimitExceptionHandler(skipLimit)); + stepOperations.setExceptionHandler(getExceptionHandler()); + step.setStepOperations(stepOperations); + } + else { + // This is the default in ItemOrientedStep anyway... + itemProcessor.setItemSkipPolicy(new NeverSkipItemSkipPolicy()); + } + + setItemHandler(itemProcessor); + step.setItemHandler(itemProcessor); + + } + +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/ItemHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemHandler.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/ItemHandler.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemHandler.java index 1b2ef3a0c..7c7e6be5f 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/ItemHandler.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemHandler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step; +package org.springframework.batch.core.step; import org.springframework.batch.core.StepContribution; import org.springframework.batch.item.ClearFailedException; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemOrientedStep.java similarity index 96% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemOrientedStep.java index b68a06813..eaca4e22c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/ItemOrientedStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemOrientedStep.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step; +package org.springframework.batch.core.step; import java.util.Date; @@ -25,15 +25,15 @@ import org.springframework.batch.core.StepContribution; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.StepListener; import org.springframework.batch.core.UnexpectedJobExecutionException; +import org.springframework.batch.core.listener.CompositeStepListener; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.runtime.ExitStatusExceptionClassifier; +import org.springframework.batch.core.step.support.DefaultStepExecutionSynchronizer; +import org.springframework.batch.core.step.support.SimpleExitStatusExceptionClassifier; +import org.springframework.batch.core.step.support.StepExecutionSynchronizer; +import org.springframework.batch.core.step.support.StepInterruptionPolicy; +import org.springframework.batch.core.step.support.ThreadStepInterruptionPolicy; import org.springframework.batch.core.tasklet.Tasklet; -import org.springframework.batch.execution.listener.CompositeStepListener; -import org.springframework.batch.execution.step.support.DefaultStepExecutionSynchronizer; -import org.springframework.batch.execution.step.support.SimpleExitStatusExceptionClassifier; -import org.springframework.batch.execution.step.support.StepExecutionSynchronizer; -import org.springframework.batch.execution.step.support.StepInterruptionPolicy; -import org.springframework.batch.execution.step.support.ThreadStepInterruptionPolicy; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ItemWriter; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemSkipPolicyItemHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemSkipPolicyItemHandler.java new file mode 100644 index 000000000..2a58ae03a --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/ItemSkipPolicyItemHandler.java @@ -0,0 +1,103 @@ +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.core.step; + +import org.springframework.batch.core.ItemSkipPolicy; +import org.springframework.batch.core.StepContribution; +import org.springframework.batch.core.step.support.NeverSkipItemSkipPolicy; +import org.springframework.batch.item.ItemReader; +import org.springframework.batch.item.ItemWriter; +import org.springframework.batch.item.Skippable; +import org.springframework.batch.repeat.ExitStatus; + +/** + * @author Dave Syer + * + */ +public class ItemSkipPolicyItemHandler extends SimpleItemHandler { + + private ItemSkipPolicy itemSkipPolicy = new NeverSkipItemSkipPolicy(); + + /** + * @param itemReader + * @param itemWriter + */ + public ItemSkipPolicyItemHandler(ItemReader itemReader, ItemWriter itemWriter) { + super(itemReader, itemWriter); + } + + /** + * @param itemSkipPolicy + */ + public void setItemSkipPolicy(ItemSkipPolicy itemSkipPolicy) { + this.itemSkipPolicy = itemSkipPolicy; + } + + /** + * Execute the business logic, delegating to the reader and writer. + * Subclasses could extend the behaviour as long as they always return the + * value of this method call in their superclass.
+ * + * Read from the {@link ItemReader} and process (if not null) with the + * {@link ItemWriter}.
+ * + * If there is an exception and the reader or writer implements + * {@link Skippable} then the skip method is called. + * + * @param contribution the current step + * @return {@link ExitStatus#CONTINUABLE} if there is more processing to do + * @throws Exception if there is an error + */ + public ExitStatus handle(StepContribution contribution) throws Exception { + ExitStatus exitStatus = ExitStatus.CONTINUABLE; + + try { + + exitStatus = super.handle(contribution); + + } + catch (Exception e) { + + if (itemSkipPolicy.shouldSkip(e, contribution.getSkipCount())) { + contribution.incrementSkipCount(); + skip(); + } + else { + // Rethrow so that outer transaction is rolled back properly + throw e; + } + + } + + return exitStatus; + } + + /** + * Mark the current item as skipped if possible. If the reader and / or + * writer are {@link Skippable} then delegate to them in that order. + * + * @see org.springframework.batch.item.Skippable#skip() + */ + private void skip() { + if (getItemReader() instanceof Skippable) { + ((Skippable) getItemReader()).skip(); + } + if (getItemWriter() instanceof Skippable) { + ((Skippable) getItemWriter()).skip(); + } + } + +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/RepeatOperationsStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/RepeatOperationsStepFactoryBean.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/RepeatOperationsStepFactoryBean.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/RepeatOperationsStepFactoryBean.java index 7a21980c4..a70d69b55 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/RepeatOperationsStepFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/RepeatOperationsStepFactoryBean.java @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step; import org.springframework.batch.core.BatchListener; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepListener; -import org.springframework.batch.execution.step.ItemOrientedStep; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ItemWriter; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/SimpleItemHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/SimpleItemHandler.java similarity index 92% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/SimpleItemHandler.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/SimpleItemHandler.java index 8066048ef..0a1797c48 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/SimpleItemHandler.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/SimpleItemHandler.java @@ -13,10 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step; import org.springframework.batch.core.StepContribution; -import org.springframework.batch.execution.step.ItemHandler; import org.springframework.batch.item.ClearFailedException; import org.springframework.batch.item.FlushFailedException; import org.springframework.batch.item.ItemReader; @@ -69,7 +68,7 @@ public class SimpleItemHandler implements ItemHandler { * Read from the {@link ItemReader} and process (if not null) with the * {@link ItemWriter}. * - * @see org.springframework.batch.execution.step.ItemHandler#handle(org.springframework.batch.core.StepContribution) + * @see org.springframework.batch.core.step.ItemHandler#handle(org.springframework.batch.core.StepContribution) */ public ExitStatus handle(StepContribution contribution) throws Exception { Object item = itemReader.read(); diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/StatefulRetryStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StatefulRetryStepFactoryBean.java new file mode 100644 index 000000000..b615bbc20 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/StatefulRetryStepFactoryBean.java @@ -0,0 +1,211 @@ +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.core.step; + +import org.springframework.batch.core.Step; +import org.springframework.batch.core.StepContribution; +import org.springframework.batch.core.step.support.SimpleRetryExceptionHandler; +import org.springframework.batch.item.ItemKeyGenerator; +import org.springframework.batch.item.ItemReader; +import org.springframework.batch.item.ItemRecoverer; +import org.springframework.batch.item.ItemWriter; +import org.springframework.batch.repeat.ExitStatus; +import org.springframework.batch.retry.RetryListener; +import org.springframework.batch.retry.RetryOperations; +import org.springframework.batch.retry.RetryPolicy; +import org.springframework.batch.retry.backoff.BackOffPolicy; +import org.springframework.batch.retry.callback.ItemReaderRetryCallback; +import org.springframework.batch.retry.policy.ItemReaderRetryPolicy; +import org.springframework.batch.retry.policy.SimpleRetryPolicy; +import org.springframework.batch.retry.support.RetryTemplate; + +/** + * Factory bean for step that executes its item processing with a stateful + * retry. Failed items are never skipped, but always cause a rollback. Before a + * rollback, the {@link Step} makes a record of the failed item, caching it + * under a key given by the {@link ItemKeyGenerator}. Then when it is + * re-presented by the {@link ItemReader} it is recognised and retried up to a + * limit given by the {@link RetryPolicy}. When the retry is exhausted instead + * of the item being skipped it is handled by an {@link ItemRecoverer}.
+ * + * The skipLimit property is still used to control the overall exception + * handling policy. Only exhausted retries count against the exception handler, + * instead of counting all exceptions. + * + * @author Dave Syer + * + */ +public class StatefulRetryStepFactoryBean extends DefaultStepFactoryBean { + + private ItemKeyGenerator itemKeyGenerator; + + private ItemRecoverer itemRecoverer; + + private int retryLimit; + + private Class[] retryableExceptionClasses; + + private BackOffPolicy backOffPolicy; + + private RetryListener[] retryListeners; + + /** + * Public setter for the retry limit. Each item can be retried up to this + * limit. + * @param retryLimit the retry limit to set + */ + public void setRetryLimit(int retryLimit) { + this.retryLimit = retryLimit; + } + + /** + * Public setter for the Class[]. + * @param retryableExceptionClasses the retryableExceptionClasses to set + */ + public void setRetryableExceptionClasses(Class[] retryableExceptionClasses) { + this.retryableExceptionClasses = retryableExceptionClasses; + } + + /** + * Public setter for the {@link BackOffPolicy}. + * @param backOffPolicy the {@link BackOffPolicy} to set + */ + public void setBackOffPolicy(BackOffPolicy backOffPolicy) { + this.backOffPolicy = backOffPolicy; + } + + /** + * Public setter for the {@link RetryListener}s. + * @param retryListeners the {@link RetryListener}s to set + */ + public void setRetryListeners(RetryListener[] retryListeners) { + this.retryListeners = retryListeners; + } + + /** + * Public setter for the {@link ItemKeyGenerator} which will be used to + * cache failed items between transactions. If it is not injected but the + * reader or writer implement {@link ItemKeyGenerator}, one of those will + * be used instead (preferring the reader to the writer if both would be + * appropriate). If neither can be used, then the default will be to just + * use the item itself as a cache key. + * + * @param itemKeyGenerator the {@link ItemKeyGenerator} to set + */ + public void setItemKeyGenerator(ItemKeyGenerator itemKeyGenerator) { + this.itemKeyGenerator = itemKeyGenerator; + } + + /** + * Public setter for the {@link ItemRecoverer}. If this is set the + * {@link ItemRecoverer#recover(Object, Throwable)} will be called when + * retry is exhausted, and within the business transaction (which will not + * roll back because of any other item-related errors). + * + * @param itemRecoverer the {@link ItemRecoverer} to set + */ + public void setItemRecoverer(ItemRecoverer itemRecoverer) { + this.itemRecoverer = itemRecoverer; + } + + /** + * @param step + * + */ + protected void applyConfiguration(ItemOrientedStep step) { + + super.applyConfiguration(step); + + if (retryLimit > 0) { + + SimpleRetryPolicy retryPolicy = new SimpleRetryPolicy(retryLimit); + if (retryableExceptionClasses != null) { + retryPolicy.setRetryableExceptionClasses(retryableExceptionClasses); + } + + // Co-ordinate the retry policy with the exception handler: + getStepOperations() + .setExceptionHandler(new SimpleRetryExceptionHandler(retryPolicy, getExceptionHandler())); + + ItemReaderRetryCallback retryCallback = new ItemReaderRetryCallback(getItemReader(), itemKeyGenerator, + getItemWriter()); + retryCallback.setRecoverer(itemRecoverer); + ItemReaderRetryPolicy itemProviderRetryPolicy = new ItemReaderRetryPolicy(retryPolicy); + + RetryTemplate retryTemplate = new RetryTemplate(); + if (retryListeners!=null) { + retryTemplate.setListeners(retryListeners); + } + retryTemplate.setRetryPolicy(itemProviderRetryPolicy); + if (backOffPolicy != null) { + retryTemplate.setBackOffPolicy(backOffPolicy); + } + + StatefulRetryItemHandler itemProcessor = new StatefulRetryItemHandler(getItemReader(), getItemWriter(), + retryTemplate, retryCallback); + + step.setItemHandler(itemProcessor); + + } + + } + + private static class StatefulRetryItemHandler extends SimpleItemHandler { + + final private RetryOperations retryOperations; + + final private ItemReaderRetryCallback retryCallback; + + /** + * @param itemReader + * @param itemWriter + * @param retryCallback + * @param retryTemplate + */ + public StatefulRetryItemHandler(ItemReader itemReader, ItemWriter itemWriter, RetryOperations retryTemplate, + ItemReaderRetryCallback retryCallback) { + super(itemReader, itemWriter); + this.retryOperations = retryTemplate; + this.retryCallback = retryCallback; + } + + /** + * Execute the business logic, delegating to the reader and writer. + * Subclasses could extend the behaviour as long as they always return + * the value of this method call in their superclass.
+ * + * Read from the {@link ItemReader} and process (if not null) with the + * {@link ItemWriter}. The call to {@link ItemWriter} is wrapped in a + * stateful retry. In that case the {@link ItemRecoverer} is used (if + * provided) in the case of an exception to apply alternate processing + * to the item. If the stateful retry is in place then the recovery will + * happen in the next transaction automatically, otherwise it might be + * necessary for clients to make the recover method transactional with + * appropriate propagation behaviour (probably REQUIRES_NEW because the + * call will happen in the context of a transaction that is about to + * rollback).
+ * + * @param contribution the current step + * @return {@link ExitStatus#CONTINUABLE} if there is more processing to + * do + * @throws Exception if there is an error + */ + public ExitStatus handle(StepContribution contribution) throws Exception { + return new ExitStatus(retryOperations.execute(retryCallback) != null); + } + + } +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/TaskletStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/TaskletStep.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/TaskletStep.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/TaskletStep.java index ccd8ed7e1..1341296a6 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/TaskletStep.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/TaskletStep.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step; +package org.springframework.batch.core.step; import java.util.Date; @@ -25,9 +25,9 @@ import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.StepListener; +import org.springframework.batch.core.listener.CompositeStepListener; import org.springframework.batch.core.repository.JobRepository; import org.springframework.batch.core.tasklet.Tasklet; -import org.springframework.batch.execution.listener.CompositeStepListener; import org.springframework.batch.repeat.ExitStatus; import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.InitializingBean; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/package.html b/spring-batch-core/src/main/java/org/springframework/batch/core/step/package.html similarity index 100% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/package.html rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/package.html diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/AbstractStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/AbstractStepFactoryBean.java new file mode 100644 index 000000000..274dd9c8b --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/AbstractStepFactoryBean.java @@ -0,0 +1,198 @@ +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.core.step.support; + +import org.springframework.batch.core.Step; +import org.springframework.batch.core.repository.JobRepository; +import org.springframework.batch.core.step.ItemOrientedStep; +import org.springframework.batch.item.ItemReader; +import org.springframework.batch.item.ItemWriter; +import org.springframework.beans.factory.BeanNameAware; +import org.springframework.beans.factory.FactoryBean; +import org.springframework.transaction.PlatformTransactionManager; +import org.springframework.util.Assert; + +/** + * Base class for factory beans for {@link ItemOrientedStep}. Ensures that all + * the mandatory properties are set, and provides basic support for the + * {@link Step} interface responsibilities like start limit. + * + * @author Dave Syer + * + */ +public abstract class AbstractStepFactoryBean implements FactoryBean, BeanNameAware { + + private String name; + + private int startLimit = Integer.MAX_VALUE; + + private boolean allowStartIfComplete; + + private ItemReader itemReader; + + private ItemWriter itemWriter; + + private PlatformTransactionManager transactionManager; + + private JobRepository jobRepository; + + private boolean singleton = true; + + /** + * + */ + public AbstractStepFactoryBean() { + super(); + } + + /** + * Set the bean name property, which will become the name of the + * {@link Step} when it is created. + * + * @see org.springframework.beans.factory.BeanNameAware#setBeanName(java.lang.String) + */ + public void setBeanName(String name) { + this.name = name; + } + + /** + * Public getter for the String. + * @return the name + */ + public String getName() { + return name; + } + + /** + * Public setter for the startLimit. + * + * @param startLimit the startLimit to set + */ + public void setStartLimit(int startLimit) { + this.startLimit = startLimit; + } + + /** + * Public setter for the shouldAllowStartIfComplete. + * + * @param allowStartIfComplete the shouldAllowStartIfComplete to set + */ + public void setAllowStartIfComplete(boolean allowStartIfComplete) { + this.allowStartIfComplete = allowStartIfComplete; + } + + /** + * @param itemReader the itemReader to set + */ + public void setItemReader(ItemReader itemReader) { + this.itemReader = itemReader; + } + + /** + * @param itemWriter the itemWriter to set + */ + public void setItemWriter(ItemWriter itemWriter) { + this.itemWriter = itemWriter; + } + + /** + * Protected getter for the {@link ItemReader} for subclasses to use. + * @return the itemReader + */ + protected ItemReader getItemReader() { + return itemReader; + } + + /** + * Protected getter for the {@link ItemWriter} for subclasses to use + * @return the itemWriter + */ + protected ItemWriter getItemWriter() { + return itemWriter; + } + + /** + * Public setter for {@link JobRepository}. + * + * @param jobRepository is a mandatory dependence (no default). + */ + public void setJobRepository(JobRepository jobRepository) { + this.jobRepository = jobRepository; + } + + /** + * Public setter for the {@link PlatformTransactionManager}. + * + * @param transactionManager the transaction manager to set + */ + public void setTransactionManager(PlatformTransactionManager transactionManager) { + this.transactionManager = transactionManager; + } + + /** + * Create a {@link Step} from the configuration provided. + * + * @see org.springframework.beans.factory.FactoryBean#getObject() + */ + public final Object getObject() throws Exception { + ItemOrientedStep step = new ItemOrientedStep(getName()); + applyConfiguration(step); + return step; + } + + /** + * @param step + * + */ + protected void applyConfiguration(ItemOrientedStep step) { + + Assert.notNull(getItemReader(), "ItemReader must be provided"); + Assert.notNull(getItemWriter(), "ItemWriter must be provided"); + Assert.notNull(jobRepository, "JobRepository must be provided"); + Assert.notNull(transactionManager, "TransactionManager must be provided"); + + step.setItemHandler(new SimpleItemHandler(itemReader, itemWriter)); + step.setTransactionManager(transactionManager); + step.setJobRepository(jobRepository); + step.setStartLimit(startLimit); + step.setAllowStartIfComplete(allowStartIfComplete); + + } + + public Class getObjectType() { + return Step.class; + } + + /** + * Returns true by default, but in most cases a {@link Step} should not be + * treated as thread safe. Clients are recommended to create a new step for + * each job execution. + * + * @see org.springframework.beans.factory.FactoryBean#isSingleton() + */ + public boolean isSingleton() { + return this.singleton; + } + + /** + * Public setter for the singleton flag. + * @param singleton the value to set. Defaults to true. + */ + public void setSingleton(boolean singleton) { + this.singleton = singleton; + } + +} \ No newline at end of file diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/AlwaysSkipItemSkipPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/AlwaysSkipItemSkipPolicy.java similarity index 94% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/AlwaysSkipItemSkipPolicy.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/AlwaysSkipItemSkipPolicy.java index 98b7f6f83..89ad0eb0c 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/AlwaysSkipItemSkipPolicy.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/AlwaysSkipItemSkipPolicy.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.core.ItemSkipPolicy; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/BatchListenerFactoryHelper.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/BatchListenerFactoryHelper.java new file mode 100644 index 000000000..a0bc12e00 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/BatchListenerFactoryHelper.java @@ -0,0 +1,173 @@ +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.core.step.support; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.batch.core.BatchListener; +import org.springframework.batch.core.ChunkListener; +import org.springframework.batch.core.ItemReadListener; +import org.springframework.batch.core.ItemWriteListener; +import org.springframework.batch.core.StepListener; +import org.springframework.batch.core.listener.CompositeChunkListener; +import org.springframework.batch.core.listener.CompositeItemReadListener; +import org.springframework.batch.core.listener.CompositeItemWriteListener; +import org.springframework.batch.item.ItemReader; +import org.springframework.batch.item.ItemWriter; +import org.springframework.batch.item.reader.DelegatingItemReader; +import org.springframework.batch.item.writer.DelegatingItemWriter; +import org.springframework.batch.repeat.ExitStatus; +import org.springframework.batch.repeat.RepeatContext; +import org.springframework.batch.repeat.RepeatOperations; +import org.springframework.batch.repeat.listener.RepeatListenerSupport; +import org.springframework.batch.repeat.support.RepeatTemplate; +import org.springframework.util.Assert; + +/** + * Package private helper for step factory beans. + * + * @author Dave Syer + * + */ +class BatchListenerFactoryHelper { + + /** + * @param itemReader2 + * @param listeners + * @return + */ + public ItemReader getItemReader(ItemReader itemReader, BatchListener[] listeners) { + + final CompositeItemReadListener multicaster = new CompositeItemReadListener(); + + for (int i = 0; i < listeners.length; i++) { + BatchListener listener = listeners[i]; + if (listener instanceof ItemReadListener) { + multicaster.register((ItemReadListener) listener); + } + } + + itemReader = new DelegatingItemReader(itemReader) { + public Object read() throws Exception { + try { + multicaster.beforeRead(); + Object item = super.read(); + multicaster.afterRead(item); + return item; + } + catch (Exception e) { + multicaster.onReadError(e); + throw e; + } + } + }; + + return itemReader; + } + + /** + * @param itemWriter2 + * @param listeners + * @return + */ + public ItemWriter getItemWriter(ItemWriter itemWriter, BatchListener[] listeners) { + final CompositeItemWriteListener multicaster = new CompositeItemWriteListener(); + + for (int i = 0; i < listeners.length; i++) { + BatchListener listener = listeners[i]; + if (listener instanceof ItemWriteListener) { + multicaster.register((ItemWriteListener) listener); + } + } + + itemWriter = new DelegatingItemWriter(itemWriter) { + public void write(Object item) throws Exception { + try { + multicaster.beforeWrite(item); + super.write(item); + multicaster.afterWrite(); + } + catch (Exception e) { + multicaster.onWriteError(e, item); + throw e; + } + } + }; + + return itemWriter; + + } + + /** + * @param stepOperations + * @param listeners + * @return + */ + public RepeatOperations addChunkListeners(RepeatOperations stepOperations, BatchListener[] listeners) { + + final CompositeChunkListener multicaster = new CompositeChunkListener(); + + boolean hasChunkListener = false; + + for (int i = 0; i < listeners.length; i++) { + BatchListener listener = listeners[i]; + if (listener instanceof ChunkListener) { + hasChunkListener = true; + } + if (listener instanceof ChunkListener) { + multicaster.register((ChunkListener) listener); + } + } + + if (hasChunkListener) { + + Assert.state(stepOperations instanceof RepeatTemplate, + "Step operations is injected but not a RepeatTemplate, so chunk listeners cannot also be registered. " + + "Either inject a RepeatTemplate, or remove the ChunkListener."); + + RepeatTemplate stepTemplate = (RepeatTemplate) stepOperations; + stepTemplate.registerListener(new RepeatListenerSupport() { + public void before(RepeatContext context) { + multicaster.beforeChunk(); + } + public void after(RepeatContext context, ExitStatus result) { + multicaster.afterChunk(); + } + }); + + } + + return stepOperations; + + } + + /** + * @param listeners + * @return + */ + public StepListener[] getStepListeners(BatchListener[] listeners) { + List list = new ArrayList(); + for (int i = 0; i < listeners.length; i++) { + BatchListener listener = listeners[i]; + if (listener instanceof StepListener) { + list.add(listener); + } + } + return (StepListener[]) list.toArray(new StepListener[list.size()]); + } + +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/DefaultItemFailureHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/DefaultItemFailureHandler.java similarity index 96% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/DefaultItemFailureHandler.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/DefaultItemFailureHandler.java index 61f095748..f3d8efe6e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/DefaultItemFailureHandler.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/DefaultItemFailureHandler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/DefaultStepExecutionSynchronizer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/DefaultStepExecutionSynchronizer.java similarity index 96% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/DefaultStepExecutionSynchronizer.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/DefaultStepExecutionSynchronizer.java index 26209c1df..6c08d842e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/DefaultStepExecutionSynchronizer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/DefaultStepExecutionSynchronizer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.core.StepExecution; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/DefaultStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/DefaultStepFactoryBean.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/DefaultStepFactoryBean.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/DefaultStepFactoryBean.java index 867a17862..45adc3824 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/DefaultStepFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/DefaultStepFactoryBean.java @@ -13,13 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.core.BatchListener; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepListener; -import org.springframework.batch.execution.step.ItemHandler; -import org.springframework.batch.execution.step.ItemOrientedStep; +import org.springframework.batch.core.step.ItemHandler; +import org.springframework.batch.core.step.ItemOrientedStep; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemStream; import org.springframework.batch.item.ItemWriter; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/ItemSkipPolicyItemHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/ItemSkipPolicyItemHandler.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/ItemSkipPolicyItemHandler.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/ItemSkipPolicyItemHandler.java index f0a82c050..f7441a616 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/ItemSkipPolicyItemHandler.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/ItemSkipPolicyItemHandler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.core.ItemSkipPolicy; import org.springframework.batch.core.StepContribution; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/LimitCheckingItemSkipPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/LimitCheckingItemSkipPolicy.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/LimitCheckingItemSkipPolicy.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/LimitCheckingItemSkipPolicy.java index db04b9fc4..8f9e8ab56 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/LimitCheckingItemSkipPolicy.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/LimitCheckingItemSkipPolicy.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import java.io.FileNotFoundException; import java.util.ArrayList; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/ListenerMulticaster.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/ListenerMulticaster.java similarity index 72% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/ListenerMulticaster.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/ListenerMulticaster.java index 788ad9bcd..7f0545a3b 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/ListenerMulticaster.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/ListenerMulticaster.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.core.BatchListener; import org.springframework.batch.core.ChunkListener; @@ -21,10 +21,10 @@ import org.springframework.batch.core.ItemReadListener; import org.springframework.batch.core.ItemWriteListener; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.StepListener; -import org.springframework.batch.execution.listener.CompositeChunkListener; -import org.springframework.batch.execution.listener.CompositeItemReadListener; -import org.springframework.batch.execution.listener.CompositeItemWriteListener; -import org.springframework.batch.execution.listener.CompositeStepListener; +import org.springframework.batch.core.listener.CompositeChunkListener; +import org.springframework.batch.core.listener.CompositeItemReadListener; +import org.springframework.batch.core.listener.CompositeItemWriteListener; +import org.springframework.batch.core.listener.CompositeStepListener; import org.springframework.batch.item.ItemStream; import org.springframework.batch.repeat.ExitStatus; @@ -85,7 +85,7 @@ public class ListenerMulticaster implements StepListener, ChunkListener, ItemRea /** * @return - * @see org.springframework.batch.execution.listener.CompositeStepListener#afterStep() + * @see org.springframework.batch.core.listener.CompositeStepListener#afterStep() */ public ExitStatus afterStep(StepExecution stepExecution) { return stepListener.afterStep(stepExecution); @@ -93,7 +93,7 @@ public class ListenerMulticaster implements StepListener, ChunkListener, ItemRea /** * @param stepExecution - * @see org.springframework.batch.execution.listener.CompositeStepListener#beforeStep(org.springframework.batch.core.StepExecution) + * @see org.springframework.batch.core.listener.CompositeStepListener#beforeStep(org.springframework.batch.core.StepExecution) */ public void beforeStep(StepExecution stepExecution) { stepListener.beforeStep(stepExecution); @@ -102,7 +102,7 @@ public class ListenerMulticaster implements StepListener, ChunkListener, ItemRea /** * @param e * @return - * @see org.springframework.batch.execution.listener.CompositeStepListener#onErrorInStep(java.lang.Throwable) + * @see org.springframework.batch.core.listener.CompositeStepListener#onErrorInStep(java.lang.Throwable) */ public ExitStatus onErrorInStep(StepExecution stepExecution, Throwable e) { return stepListener.onErrorInStep(stepExecution, e); @@ -110,7 +110,7 @@ public class ListenerMulticaster implements StepListener, ChunkListener, ItemRea /** * - * @see org.springframework.batch.execution.listener.CompositeChunkListener#afterChunk() + * @see org.springframework.batch.core.listener.CompositeChunkListener#afterChunk() */ public void afterChunk() { chunkListener.afterChunk(); @@ -118,7 +118,7 @@ public class ListenerMulticaster implements StepListener, ChunkListener, ItemRea /** * - * @see org.springframework.batch.execution.listener.CompositeChunkListener#beforeChunk() + * @see org.springframework.batch.core.listener.CompositeChunkListener#beforeChunk() */ public void beforeChunk() { chunkListener.beforeChunk(); @@ -126,7 +126,7 @@ public class ListenerMulticaster implements StepListener, ChunkListener, ItemRea /** * @param item - * @see org.springframework.batch.execution.listener.CompositeItemReadListener#afterRead(java.lang.Object) + * @see org.springframework.batch.core.listener.CompositeItemReadListener#afterRead(java.lang.Object) */ public void afterRead(Object item) { itemReadListener.afterRead(item); @@ -134,7 +134,7 @@ public class ListenerMulticaster implements StepListener, ChunkListener, ItemRea /** * - * @see org.springframework.batch.execution.listener.CompositeItemReadListener#beforeRead() + * @see org.springframework.batch.core.listener.CompositeItemReadListener#beforeRead() */ public void beforeRead() { itemReadListener.beforeRead(); @@ -142,7 +142,7 @@ public class ListenerMulticaster implements StepListener, ChunkListener, ItemRea /** * @param ex - * @see org.springframework.batch.execution.listener.CompositeItemReadListener#onReadError(java.lang.Exception) + * @see org.springframework.batch.core.listener.CompositeItemReadListener#onReadError(java.lang.Exception) */ public void onReadError(Exception ex) { itemReadListener.onReadError(ex); @@ -150,7 +150,7 @@ public class ListenerMulticaster implements StepListener, ChunkListener, ItemRea /** * - * @see org.springframework.batch.execution.listener.CompositeItemWriteListener#afterWrite() + * @see org.springframework.batch.core.listener.CompositeItemWriteListener#afterWrite() */ public void afterWrite() { itemWriteListener.afterWrite(); @@ -158,7 +158,7 @@ public class ListenerMulticaster implements StepListener, ChunkListener, ItemRea /** * @param item - * @see org.springframework.batch.execution.listener.CompositeItemWriteListener#beforeWrite(java.lang.Object) + * @see org.springframework.batch.core.listener.CompositeItemWriteListener#beforeWrite(java.lang.Object) */ public void beforeWrite(Object item) { itemWriteListener.beforeWrite(item); @@ -167,7 +167,7 @@ public class ListenerMulticaster implements StepListener, ChunkListener, ItemRea /** * @param ex * @param item - * @see org.springframework.batch.execution.listener.CompositeItemWriteListener#onWriteError(java.lang.Exception, + * @see org.springframework.batch.core.listener.CompositeItemWriteListener#onWriteError(java.lang.Exception, * java.lang.Object) */ public void onWriteError(Exception ex, Object item) { diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/NeverSkipItemSkipPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/NeverSkipItemSkipPolicy.java similarity index 94% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/NeverSkipItemSkipPolicy.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/NeverSkipItemSkipPolicy.java index 42eea1ff0..a1b2693c3 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/NeverSkipItemSkipPolicy.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/NeverSkipItemSkipPolicy.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.core.ItemSkipPolicy; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/RepeatOperationsStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/RepeatOperationsStepFactoryBean.java new file mode 100644 index 000000000..f499320b3 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/RepeatOperationsStepFactoryBean.java @@ -0,0 +1,140 @@ +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.core.step.support; + +import org.springframework.batch.core.BatchListener; +import org.springframework.batch.core.Step; +import org.springframework.batch.core.StepListener; +import org.springframework.batch.core.step.ItemOrientedStep; +import org.springframework.batch.item.ItemReader; +import org.springframework.batch.item.ItemStream; +import org.springframework.batch.item.ItemWriter; +import org.springframework.batch.repeat.RepeatOperations; +import org.springframework.batch.repeat.support.RepeatTemplate; + +/** + * Factory bean for {@link Step} implementations allowing registration of + * listeners and also direct injection of the {@link RepeatOperations} needed at + * step and chunk level. + * + * @author Dave Syer + * + */ +public class RepeatOperationsStepFactoryBean extends AbstractStepFactoryBean { + + private ItemStream[] streams = new ItemStream[0]; + + private BatchListener[] listeners = new BatchListener[0]; + + private RepeatOperations chunkOperations = new RepeatTemplate(); + + private RepeatOperations stepOperations = new RepeatTemplate(); + + /** + * The streams to inject into the {@link Step}. Any instance of + * {@link ItemStream} can be used, and will then receive callbacks at the + * appropriate stage in the step. + * + * @param streams an array of listeners + */ + public void setStreams(ItemStream[] streams) { + this.streams = streams; + } + + /** + * The listeners to inject into the {@link Step}. Any instance of + * {@link BatchListener} can be used, and will then receive callbacks at the + * appropriate stage in the step. + * + * @param listeners an array of listeners + */ + public void setListeners(BatchListener[] listeners) { + this.listeners = listeners; + } + + /** + * The {@link RepeatOperations} to use for the outer loop of the batch + * processing. Should be set up by the caller through a factory. Defaults to + * a plain {@link RepeatTemplate}. + * + * @param stepOperations a {@link RepeatOperations} instance. + */ + public void setStepOperations(RepeatOperations stepOperations) { + this.stepOperations = stepOperations; + } + + /** + * The {@link RepeatOperations} to use for the inner loop of the batch + * processing. should be set up by the caller through a factory. defaults to + * a plain {@link RepeatTemplate}. + * + * @param chunkOperations a {@link RepeatOperations} instance. + */ + public void setChunkOperations(RepeatOperations chunkOperations) { + this.chunkOperations = chunkOperations; + } + + /** + * @param step + * + */ + protected void applyConfiguration(ItemOrientedStep step) { + + super.applyConfiguration(step); + + step.setStreams(streams); + + ItemReader itemReader = getItemReader(); + ItemWriter itemWriter = getItemWriter(); + + /* + * Since we are going to wrap these things with listener callbacks we + * need to register them here because the step will not know we did + * that. + */ + if (itemReader instanceof ItemStream) { + step.registerStream((ItemStream) itemReader); + } + if (itemReader instanceof StepListener) { + step.registerStepListener((StepListener) itemReader); + } + if (itemWriter instanceof ItemStream) { + step.registerStream((ItemStream) itemWriter); + } + if (itemWriter instanceof StepListener) { + step.registerStepListener((StepListener) itemWriter); + } + + BatchListenerFactoryHelper helper = new BatchListenerFactoryHelper(); + + StepListener[] stepListeners = helper.getStepListeners(listeners); + itemReader = helper.getItemReader(itemReader, listeners); + itemWriter = helper.getItemWriter(itemWriter, listeners); + RepeatOperations stepOperations = helper.addChunkListeners(this.stepOperations, listeners); + + // In case they are used by subclasses: + setItemReader(itemReader); + setItemWriter(itemWriter); + + step.setStepListeners(stepListeners); + step.setItemHandler(new SimpleItemHandler(itemReader, itemWriter)); + + step.setChunkOperations(chunkOperations); + step.setStepOperations(stepOperations); + + } + +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/SimpleExitStatusExceptionClassifier.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/SimpleExitStatusExceptionClassifier.java similarity index 95% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/SimpleExitStatusExceptionClassifier.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/SimpleExitStatusExceptionClassifier.java index da2222df0..524e9a432 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/SimpleExitStatusExceptionClassifier.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/SimpleExitStatusExceptionClassifier.java @@ -13,15 +13,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import java.io.PrintWriter; import java.io.StringWriter; import org.springframework.batch.core.JobInterruptedException; +import org.springframework.batch.core.launch.support.ExitCodeMapper; import org.springframework.batch.core.repository.NoSuchJobException; import org.springframework.batch.core.runtime.ExitStatusExceptionClassifier; -import org.springframework.batch.execution.launch.support.ExitCodeMapper; import org.springframework.batch.repeat.ExitStatus; /** diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/SimpleItemHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/SimpleItemHandler.java new file mode 100644 index 000000000..bd12868b6 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/SimpleItemHandler.java @@ -0,0 +1,115 @@ +/* + * Copyright 2006-2007 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.springframework.batch.core.step.support; + +import org.springframework.batch.core.StepContribution; +import org.springframework.batch.core.step.ItemHandler; +import org.springframework.batch.item.ClearFailedException; +import org.springframework.batch.item.FlushFailedException; +import org.springframework.batch.item.ItemReader; +import org.springframework.batch.item.ItemWriter; +import org.springframework.batch.item.MarkFailedException; +import org.springframework.batch.item.ResetFailedException; +import org.springframework.batch.repeat.ExitStatus; + +/** + * Simplest possible implementation of {@link ItemHandler} with no skipping or + * recovering. Just delegates all calls to the provided {@link ItemReader} and + * {@link ItemWriter}. + * + * @author Dave Syer + * + */ +public class SimpleItemHandler implements ItemHandler { + + private ItemReader itemReader; + + private ItemWriter itemWriter; + + /** + * @param itemReader + * @param itemWriter + */ + public SimpleItemHandler(ItemReader itemReader, ItemWriter itemWriter) { + super(); + this.itemReader = itemReader; + this.itemWriter = itemWriter; + } + + /** + * Public getter for the ItemReader. + * @return the itemReader + */ + public ItemReader getItemReader() { + return itemReader; + } + + /** + * Public getter for the ItemWriter. + * @return the itemWriter + */ + public ItemWriter getItemWriter() { + return itemWriter; + } + + /** + * Read from the {@link ItemReader} and process (if not null) with the + * {@link ItemWriter}. + * + * @see org.springframework.batch.core.step.ItemHandler#handle(org.springframework.batch.core.StepContribution) + */ + public ExitStatus handle(StepContribution contribution) throws Exception { + Object item = itemReader.read(); + if (item == null) { + return ExitStatus.FINISHED; + } + itemWriter.write(item); + return ExitStatus.CONTINUABLE; + } + + /** + * @throws MarkFailedException + * @see org.springframework.batch.item.ItemReader#mark() + */ + public void mark() throws MarkFailedException { + itemReader.mark(); + } + + /** + * @throws ResetFailedException + * @see org.springframework.batch.item.ItemReader#reset() + */ + public void reset() throws ResetFailedException { + itemReader.reset(); + } + + /** + * @throws ClearFailedException + * @see org.springframework.batch.item.ItemWriter#clear() + */ + public void clear() throws ClearFailedException { + itemWriter.clear(); + } + + /** + * @throws FlushFailedException + * @see org.springframework.batch.item.ItemWriter#flush() + */ + public void flush() throws FlushFailedException { + itemWriter.flush(); + } + +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/SimpleRetryExceptionHandler.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/SimpleRetryExceptionHandler.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/SimpleRetryExceptionHandler.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/SimpleRetryExceptionHandler.java index 615d163dd..78ea3494e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/SimpleRetryExceptionHandler.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/SimpleRetryExceptionHandler.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.repeat.RepeatContext; import org.springframework.batch.repeat.exception.ExceptionHandler; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/SkipLimitExceededException.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/SkipLimitExceededException.java similarity index 95% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/SkipLimitExceededException.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/SkipLimitExceededException.java index 786cec394..59ec95883 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/SkipLimitExceededException.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/SkipLimitExceededException.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.core.UnexpectedJobExecutionException; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/StatefulRetryStepFactoryBean.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/StatefulRetryStepFactoryBean.java similarity index 98% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/StatefulRetryStepFactoryBean.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/StatefulRetryStepFactoryBean.java index 2b5f6d4aa..1bf4b3e8a 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/StatefulRetryStepFactoryBean.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/StatefulRetryStepFactoryBean.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepContribution; -import org.springframework.batch.execution.step.ItemOrientedStep; +import org.springframework.batch.core.step.ItemOrientedStep; import org.springframework.batch.item.ItemKeyGenerator; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemRecoverer; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/StepExecutionSynchronizer.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/StepExecutionSynchronizer.java similarity index 95% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/StepExecutionSynchronizer.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/StepExecutionSynchronizer.java index 8cb67df9e..ec5ff4d93 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/StepExecutionSynchronizer.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/StepExecutionSynchronizer.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.core.StepExecution; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/StepInterruptionPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/StepInterruptionPolicy.java similarity index 95% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/StepInterruptionPolicy.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/StepInterruptionPolicy.java index 08616e3c1..e756bfd66 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/StepInterruptionPolicy.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/StepInterruptionPolicy.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.Step; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/ThreadStepInterruptionPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/ThreadStepInterruptionPolicy.java similarity index 96% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/ThreadStepInterruptionPolicy.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/ThreadStepInterruptionPolicy.java index b2b49b9da..f03d68bc9 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/ThreadStepInterruptionPolicy.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/ThreadStepInterruptionPolicy.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/package.html b/spring-batch-core/src/main/java/org/springframework/batch/core/step/support/package.html similarity index 100% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/step/support/package.html rename to spring-batch-core/src/main/java/org/springframework/batch/core/step/support/package.html diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/tasklet/TaskletAdapter.java b/spring-batch-core/src/main/java/org/springframework/batch/core/tasklet/support/TaskletAdapter.java similarity index 97% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/tasklet/TaskletAdapter.java rename to spring-batch-core/src/main/java/org/springframework/batch/core/tasklet/support/TaskletAdapter.java index 04c95b4c6..2a97af09e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/execution/tasklet/TaskletAdapter.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/tasklet/support/TaskletAdapter.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.tasklet; +package org.springframework.batch.core.tasklet.support; import org.springframework.batch.core.tasklet.Tasklet; import org.springframework.batch.item.adapter.AbstractMethodInvokingDelegator; diff --git a/spring-batch-core/src/main/java/org/springframework/batch/execution/tasklet/package.html b/spring-batch-core/src/main/java/org/springframework/batch/core/tasklet/support/package.html similarity index 100% rename from spring-batch-core/src/main/java/org/springframework/batch/execution/tasklet/package.html rename to spring-batch-core/src/main/java/org/springframework/batch/core/tasklet/support/package.html diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessorTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessorTests.java similarity index 94% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessorTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessorTests.java index 38faf3717..8ab437294 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/configuration/JobRegistryBeanPostProcessorTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/JobRegistryBeanPostProcessorTests.java @@ -13,15 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.configuration; +package org.springframework.batch.core.configuration.support; import java.util.Collection; import junit.framework.TestCase; +import org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor; +import org.springframework.batch.core.configuration.support.MapJobRegistry; +import org.springframework.batch.core.job.JobSupport; import org.springframework.batch.core.repository.DuplicateJobException; import org.springframework.batch.core.repository.NoSuchJobException; -import org.springframework.batch.execution.job.JobSupport; import org.springframework.beans.FatalBeanException; import org.springframework.context.support.ClassPathXmlApplicationContext; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/configuration/MapJobRegistryTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/MapJobRegistryTests.java similarity index 78% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/configuration/MapJobRegistryTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/MapJobRegistryTests.java index 9f79ff3e3..2d060b82f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/configuration/MapJobRegistryTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/configuration/support/MapJobRegistryTests.java @@ -13,16 +13,18 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.configuration; +package org.springframework.batch.core.configuration.support; import java.util.Collection; import junit.framework.TestCase; import org.springframework.batch.core.configuration.JobFactory; +import org.springframework.batch.core.configuration.support.MapJobRegistry; +import org.springframework.batch.core.configuration.support.ReferenceJobFactory; +import org.springframework.batch.core.job.JobSupport; import org.springframework.batch.core.repository.DuplicateJobException; import org.springframework.batch.core.repository.NoSuchJobException; -import org.springframework.batch.execution.job.JobSupport; /** * @author Dave Syer @@ -33,7 +35,7 @@ public class MapJobRegistryTests extends TestCase { private MapJobRegistry registry = new MapJobRegistry(); /** - * Test method for {@link org.springframework.batch.execution.configuration.MapJobRegistry#unregister(String)}. + * Test method for {@link org.springframework.batch.core.configuration.support.MapJobRegistry#unregister(String)}. * @throws Exception */ public void testUnregister() throws Exception { @@ -51,7 +53,7 @@ public class MapJobRegistryTests extends TestCase { } /** - * Test method for {@link org.springframework.batch.execution.configuration.MapJobRegistry#getJob(java.lang.String)}. + * Test method for {@link org.springframework.batch.core.configuration.support.MapJobRegistry#getJob(java.lang.String)}. */ public void testReplaceDuplicateConfiguration() throws Exception { registry.register(new ReferenceJobFactory(new JobSupport("foo"))); @@ -65,7 +67,7 @@ public class MapJobRegistryTests extends TestCase { } /** - * Test method for {@link org.springframework.batch.execution.configuration.MapJobRegistry#getJob(java.lang.String)}. + * Test method for {@link org.springframework.batch.core.configuration.support.MapJobRegistry#getJob(java.lang.String)}. */ public void testRealDuplicateConfiguration() throws Exception { JobFactory jobFactory = new ReferenceJobFactory(new JobSupport("foo")); @@ -80,7 +82,7 @@ public class MapJobRegistryTests extends TestCase { } /** - * Test method for {@link org.springframework.batch.execution.configuration.MapJobRegistry#getJobNames()}. + * Test method for {@link org.springframework.batch.core.configuration.support.MapJobRegistry#getJobNames()}. * @throws Exception */ public void testGetJobConfigurations() throws Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/job/AbstractJobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/AbstractJobTests.java similarity index 75% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/job/AbstractJobTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/job/AbstractJobTests.java index 4aaeb16ae..4181fd826 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/job/AbstractJobTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/AbstractJobTests.java @@ -13,11 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.job; +package org.springframework.batch.core.job; import java.util.Collections; -import org.springframework.batch.execution.step.StepSupport; +import org.springframework.batch.core.step.StepSupport; import junit.framework.TestCase; @@ -32,7 +32,7 @@ public class AbstractJobTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.job.AbstractJob#JobConfiguration()}. + * {@link org.springframework.batch.core.job.AbstractJob#JobConfiguration()}. */ public void testJobConfiguration() { job = new JobSupport(); @@ -41,7 +41,7 @@ public class AbstractJobTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.job.AbstractJob#setBeanName(java.lang.String)}. + * {@link org.springframework.batch.core.job.AbstractJob#setBeanName(java.lang.String)}. */ public void testSetBeanName() { job.setBeanName("foo"); @@ -50,7 +50,7 @@ public class AbstractJobTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.job.AbstractJob#setBeanName(java.lang.String)}. + * {@link org.springframework.batch.core.job.AbstractJob#setBeanName(java.lang.String)}. */ public void testSetBeanNameWithNullName() { job = new JobSupport(null); @@ -61,7 +61,7 @@ public class AbstractJobTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.job.AbstractJob#setStepNames(java.util.List)}. + * {@link org.springframework.batch.core.job.AbstractJob#setStepNames(java.util.List)}. */ public void testSetSteps() { job.setSteps(Collections.singletonList(new StepSupport("step"))); @@ -70,7 +70,7 @@ public class AbstractJobTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.job.AbstractJob#addStepName(org.springframework.batch.core.configuration.StepConfiguration)}. + * {@link org.springframework.batch.core.job.AbstractJob#addStepName(org.springframework.batch.core.configuration.StepConfiguration)}. */ public void testAddStep() { job.addStep(new StepSupport("step")); @@ -79,7 +79,7 @@ public class AbstractJobTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.job.AbstractJob#setStartLimit(int)}. + * {@link org.springframework.batch.core.job.AbstractJob#setStartLimit(int)}. */ public void testSetStartLimit() { assertEquals(Integer.MAX_VALUE, job.getStartLimit()); @@ -89,7 +89,7 @@ public class AbstractJobTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.job.AbstractJob#setRestartable(boolean)}. + * {@link org.springframework.batch.core.job.AbstractJob#setRestartable(boolean)}. */ public void testSetRestartable() { assertFalse(job.isRestartable()); diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/job/JobSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/JobSupport.java similarity index 98% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/job/JobSupport.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/job/JobSupport.java index 1a6e9bd97..8f49d6051 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/job/JobSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/JobSupport.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.job; +package org.springframework.batch.core.job; import java.util.ArrayList; import java.util.List; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/job/SimpleJobTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java similarity index 94% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/job/SimpleJobTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java index ed6b028ac..06b0d7f52 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/job/SimpleJobTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/job/SimpleJobTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.job; +package org.springframework.batch.core.job; import java.util.ArrayList; import java.util.List; @@ -31,17 +31,18 @@ import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; +import org.springframework.batch.core.job.SimpleJob; import org.springframework.batch.core.listener.JobListenerSupport; import org.springframework.batch.core.repository.JobRepository; -import org.springframework.batch.execution.repository.SimpleJobRepository; -import org.springframework.batch.execution.repository.dao.JobExecutionDao; -import org.springframework.batch.execution.repository.dao.JobInstanceDao; -import org.springframework.batch.execution.repository.dao.MapJobExecutionDao; -import org.springframework.batch.execution.repository.dao.MapJobInstanceDao; -import org.springframework.batch.execution.repository.dao.MapStepExecutionDao; -import org.springframework.batch.execution.repository.dao.StepExecutionDao; -import org.springframework.batch.execution.step.AbstractStep; -import org.springframework.batch.execution.step.support.NeverSkipItemSkipPolicy; +import org.springframework.batch.core.repository.support.SimpleJobRepository; +import org.springframework.batch.core.repository.support.dao.JobExecutionDao; +import org.springframework.batch.core.repository.support.dao.JobInstanceDao; +import org.springframework.batch.core.repository.support.dao.MapJobExecutionDao; +import org.springframework.batch.core.repository.support.dao.MapJobInstanceDao; +import org.springframework.batch.core.repository.support.dao.MapStepExecutionDao; +import org.springframework.batch.core.repository.support.dao.StepExecutionDao; +import org.springframework.batch.core.step.AbstractStep; +import org.springframework.batch.core.step.support.NeverSkipItemSkipPolicy; import org.springframework.batch.item.AbstractItemReader; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemWriter; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/EmptyItemWriter.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/EmptyItemWriter.java similarity index 97% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/launch/EmptyItemWriter.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/launch/EmptyItemWriter.java index 732d16076..2b2b543fa 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/EmptyItemWriter.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/EmptyItemWriter.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.launch; +package org.springframework.batch.core.launch; import java.util.ArrayList; import java.util.List; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/SimpleJobLauncherTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/SimpleJobLauncherTests.java similarity index 95% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/launch/SimpleJobLauncherTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/launch/SimpleJobLauncherTests.java index 09bb42aa0..0514febd6 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/SimpleJobLauncherTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/SimpleJobLauncherTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.launch; +package org.springframework.batch.core.launch; import java.util.ArrayList; import java.util.List; @@ -25,8 +25,9 @@ import org.easymock.MockControl; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.launch.SimpleJobLauncher; import org.springframework.batch.core.repository.JobRepository; -import org.springframework.batch.execution.job.JobSupport; import org.springframework.batch.repeat.ExitStatus; import org.springframework.core.task.TaskExecutor; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/CommandLineJobRunnerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/CommandLineJobRunnerTests.java similarity index 90% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/CommandLineJobRunnerTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/CommandLineJobRunnerTests.java index c6269afdd..52f13bc1d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/CommandLineJobRunnerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/CommandLineJobRunnerTests.java @@ -13,19 +13,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; import junit.framework.TestCase; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; +import org.springframework.batch.core.launch.JobLauncher; +import org.springframework.batch.core.launch.support.CommandLineJobRunner; +import org.springframework.batch.core.launch.support.SystemExiter; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.runtime.ExitStatusExceptionClassifier; -import org.springframework.batch.execution.launch.JobLauncher; -import org.springframework.batch.execution.launch.support.CommandLineJobRunner; -import org.springframework.batch.execution.launch.support.SystemExiter; import org.springframework.batch.repeat.ExitStatus; +import org.springframework.util.ClassUtils; /** * @author Lucas Ward @@ -33,7 +34,8 @@ import org.springframework.batch.repeat.ExitStatus; */ public class CommandLineJobRunnerTests extends TestCase { - private static final String JOB = "org/springframework/batch/execution/bootstrap/support/job.xml"; + private static final String JOB = ClassUtils.addResourcePathToPackagePath(CommandLineJobRunnerTests.class, + "job.xml"); private static final String JOB_NAME = "test-job"; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/DefaultJobParametersFactoryTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/DefaultJobParametersFactoryTests.java similarity index 97% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/DefaultJobParametersFactoryTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/DefaultJobParametersFactoryTests.java index 14fbd0dca..e495310d0 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/DefaultJobParametersFactoryTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/DefaultJobParametersFactoryTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; import java.text.DateFormat; import java.text.DecimalFormat; @@ -25,7 +25,7 @@ import junit.framework.TestCase; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; -import org.springframework.batch.execution.launch.support.DefaultJobParametersFactory; +import org.springframework.batch.core.launch.support.DefaultJobParametersFactory; import org.springframework.util.StringUtils; /** diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/ScheduledJobParametersFactoryTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/ScheduledJobParametersFactoryTests.java similarity index 95% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/ScheduledJobParametersFactoryTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/ScheduledJobParametersFactoryTests.java index a4af6ba0d..1da32fe82 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/ScheduledJobParametersFactoryTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/ScheduledJobParametersFactoryTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -24,7 +24,7 @@ import junit.framework.TestCase; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; -import org.springframework.batch.execution.launch.support.ScheduledJobParametersFactory; +import org.springframework.batch.core.launch.support.ScheduledJobParametersFactory; import org.springframework.util.StringUtils; /** diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/SimpleExportedJobLauncherTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleExportedJobLauncherTests.java similarity index 79% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/SimpleExportedJobLauncherTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleExportedJobLauncherTests.java index b86feb600..534368c3c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/SimpleExportedJobLauncherTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleExportedJobLauncherTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; import java.util.ArrayList; import java.util.List; @@ -26,14 +26,14 @@ import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; import org.springframework.batch.core.StepExecution; +import org.springframework.batch.core.configuration.support.MapJobRegistry; +import org.springframework.batch.core.configuration.support.ReferenceJobFactory; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.launch.JobLauncher; +import org.springframework.batch.core.launch.support.SimpleExportedJobLauncher; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.runtime.JobParametersFactory; -import org.springframework.batch.execution.configuration.MapJobRegistry; -import org.springframework.batch.execution.configuration.ReferenceJobFactory; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.launch.JobLauncher; -import org.springframework.batch.execution.launch.support.SimpleExportedJobLauncher; -import org.springframework.batch.execution.step.StepSupport; +import org.springframework.batch.core.step.StepSupport; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.support.PropertiesConverter; @@ -66,7 +66,7 @@ public class SimpleExportedJobLauncherTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.launch.support.SimpleExportedJobLauncher#afterPropertiesSet()}. + * {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#afterPropertiesSet()}. * @throws Exception */ public void testAfterPropertiesSet() throws Exception { @@ -83,7 +83,7 @@ public class SimpleExportedJobLauncherTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.launch.support.SimpleExportedJobLauncher#afterPropertiesSet()}. + * {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#afterPropertiesSet()}. * @throws Exception */ public void testAfterPropertiesSetWithLauncher() throws Exception { @@ -105,7 +105,7 @@ public class SimpleExportedJobLauncherTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.launch.support.SimpleExportedJobLauncher#getStatistics()}. + * {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#getStatistics()}. */ public void testGetStatistics() { Properties props = launcher.getStatistics(); @@ -115,7 +115,7 @@ public class SimpleExportedJobLauncherTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.launch.support.SimpleExportedJobLauncher#getStatistics()}. + * {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#getStatistics()}. * @throws Exception */ public void testGetStatisticsWithContent() throws Exception { @@ -128,7 +128,7 @@ public class SimpleExportedJobLauncherTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.launch.support.SimpleExportedJobLauncher#isRunning()}. + * {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#isRunning()}. * @throws Exception */ public void testIsRunning() throws Exception { @@ -139,7 +139,7 @@ public class SimpleExportedJobLauncherTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.launch.support.SimpleExportedJobLauncher#isRunning()}. + * {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#isRunning()}. * @throws Exception */ public void testAlreadyRunning() throws Exception { @@ -155,7 +155,7 @@ public class SimpleExportedJobLauncherTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.launch.support.SimpleExportedJobLauncher#run(java.lang.String)}. + * {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#run(java.lang.String)}. */ public void testRunNonExistentJob() { String value = launcher.run("foo"); @@ -164,7 +164,7 @@ public class SimpleExportedJobLauncherTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.launch.support.SimpleExportedJobLauncher#run(java.lang.String)}. + * {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#run(java.lang.String)}. * @throws Exception */ public void testRunJobWithParameters() throws Exception { @@ -176,7 +176,7 @@ public class SimpleExportedJobLauncherTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.launch.support.SimpleExportedJobLauncher#run(java.lang.String)}. + * {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#run(java.lang.String)}. * @throws Exception */ public void testRunJobWithParametersAndFactory() throws Exception { @@ -196,7 +196,7 @@ public class SimpleExportedJobLauncherTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.launch.support.SimpleExportedJobLauncher#stop()}. + * {@link org.springframework.batch.core.launch.support.SimpleExportedJobLauncher#stop()}. * @throws Exception */ public void testStop() throws Exception { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/SimpleJvmExitCodeMapperTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapperTests.java similarity index 92% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/SimpleJvmExitCodeMapperTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapperTests.java index 4ac89e447..d33ce36da 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/SimpleJvmExitCodeMapperTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/SimpleJvmExitCodeMapperTests.java @@ -14,15 +14,15 @@ * limitations under the License. */ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; import java.util.HashMap; import java.util.Map; import junit.framework.TestCase; -import org.springframework.batch.execution.launch.support.ExitCodeMapper; -import org.springframework.batch.execution.launch.support.SimpleJvmExitCodeMapper; +import org.springframework.batch.core.launch.support.ExitCodeMapper; +import org.springframework.batch.core.launch.support.SimpleJvmExitCodeMapper; import org.springframework.batch.repeat.ExitStatus; public class SimpleJvmExitCodeMapperTests extends TestCase { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/StubJobLauncher.java b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/StubJobLauncher.java similarity index 91% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/StubJobLauncher.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/StubJobLauncher.java index 71467d490..eb537ebbb 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/launch/support/StubJobLauncher.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/launch/support/StubJobLauncher.java @@ -1,10 +1,10 @@ -package org.springframework.batch.execution.launch.support; +package org.springframework.batch.core.launch.support; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; +import org.springframework.batch.core.launch.JobLauncher; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; -import org.springframework.batch.execution.launch.JobLauncher; /** * Mock Job Launcher. Normally, something like EasyMock would diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeChunkListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeChunkListenerTests.java similarity index 92% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeChunkListenerTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeChunkListenerTests.java index d28f9f087..a3a0c165d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeChunkListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeChunkListenerTests.java @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.listener; +package org.springframework.batch.core.listener; import org.easymock.MockControl; import org.springframework.batch.core.ChunkListener; +import org.springframework.batch.core.listener.CompositeChunkListener; import junit.framework.TestCase; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeItemReadListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemReadListenerTests.java similarity index 93% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeItemReadListenerTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemReadListenerTests.java index d08bb8564..e5a4d4d6d 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeItemReadListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemReadListenerTests.java @@ -13,12 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.listener; +package org.springframework.batch.core.listener; import junit.framework.TestCase; import org.easymock.MockControl; import org.springframework.batch.core.ItemReadListener; +import org.springframework.batch.core.listener.CompositeItemReadListener; /** * @author Lucas Ward diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeItemWriteListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemWriteListenerTests.java similarity index 93% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeItemWriteListenerTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemWriteListenerTests.java index d25d78eec..54d536e5f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeItemWriteListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeItemWriteListenerTests.java @@ -13,12 +13,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.listener; +package org.springframework.batch.core.listener; import junit.framework.TestCase; import org.easymock.MockControl; import org.springframework.batch.core.ItemWriteListener; +import org.springframework.batch.core.listener.CompositeItemWriteListener; /** * @author Lucas Ward diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeJobListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeJobListenerTests.java similarity index 78% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeJobListenerTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeJobListenerTests.java index 853b98450..fef028518 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeJobListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeJobListenerTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.listener; +package org.springframework.batch.core.listener; import java.util.ArrayList; import java.util.List; @@ -23,9 +23,9 @@ import junit.framework.TestCase; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobListener; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.listener.CompositeJobListener; import org.springframework.batch.core.listener.JobListenerSupport; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.listener.CompositeJobListener; /** * @author Dave Syer @@ -39,7 +39,7 @@ public class CompositeJobListenerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.listener.CompositeJobListener#setListeners(org.springframework.batch.core.JobListener[])}. + * {@link org.springframework.batch.core.listener.CompositeJobListener#setListeners(org.springframework.batch.core.JobListener[])}. */ public void testSetListeners() { listener.setListeners(new JobListener[] { new JobListenerSupport() { @@ -57,7 +57,7 @@ public class CompositeJobListenerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.listener.CompositeJobListener#registerListener(org.springframework.batch.core.JobListener)}. + * {@link org.springframework.batch.core.listener.CompositeJobListener#registerListener(org.springframework.batch.core.JobListener)}. */ public void testSetListener() { listener.register(new JobListenerSupport() { @@ -71,7 +71,7 @@ public class CompositeJobListenerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.listener.CompositeJobListener#beforeJob(JobExecution)}. + * {@link org.springframework.batch.core.listener.CompositeJobListener#beforeJob(JobExecution)}. */ public void testOpen() { listener.register(new JobListenerSupport() { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeStepListenerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeStepListenerTests.java similarity index 80% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeStepListenerTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeStepListenerTests.java index 6712f1cfd..50b3dae61 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/listener/CompositeStepListenerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/listener/CompositeStepListenerTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.listener; +package org.springframework.batch.core.listener; import java.util.ArrayList; import java.util.List; @@ -22,8 +22,9 @@ import junit.framework.TestCase; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.StepListener; +import org.springframework.batch.core.listener.CompositeStepListener; import org.springframework.batch.core.listener.StepListenerSupport; -import org.springframework.batch.execution.step.StepSupport; +import org.springframework.batch.core.step.StepSupport; import org.springframework.batch.repeat.ExitStatus; /** @@ -38,7 +39,7 @@ public class CompositeStepListenerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.listener.CompositeStepListener#setListeners(org.springframework.batch.core.StepListener[])}. + * {@link org.springframework.batch.core.listener.CompositeStepListener#setListeners(org.springframework.batch.core.StepListener[])}. */ public void testSetListeners() { listener.setListeners(new StepListener[] { new StepListenerSupport() { @@ -58,7 +59,7 @@ public class CompositeStepListenerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.listener.CompositeStepListener#registerListener(org.springframework.batch.core.StepListener)}. + * {@link org.springframework.batch.core.listener.CompositeStepListener#registerListener(org.springframework.batch.core.StepListener)}. */ public void testSetListener() { listener.register(new StepListenerSupport() { @@ -73,7 +74,7 @@ public class CompositeStepListenerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.listener.CompositeStepListener#beforeStep(StepExecution)}. + * {@link org.springframework.batch.core.listener.CompositeStepListener#beforeStep(StepExecution)}. */ public void testOpen() { listener.register(new StepListenerSupport() { @@ -87,7 +88,7 @@ public class CompositeStepListenerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.listener.CompositeStepListener#beforeStep(StepExecution)}. + * {@link org.springframework.batch.core.listener.CompositeStepListener#beforeStep(StepExecution)}. */ public void testOnError() { listener.register(new StepListenerSupport() { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/JobRepositoryFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBeanTests.java similarity index 95% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/JobRepositoryFactoryBeanTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBeanTests.java index 40bdb47a4..cca0a3d39 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/JobRepositoryFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/JobRepositoryFactoryBeanTests.java @@ -13,13 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.repository; +package org.springframework.batch.core.repository.support; import javax.sql.DataSource; import junit.framework.TestCase; import org.easymock.MockControl; +import org.springframework.batch.core.repository.support.JobRepositoryFactoryBean; import org.springframework.batch.item.database.support.DataFieldMaxValueIncrementerFactory; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/MockStepDao.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/MockStepDao.java similarity index 91% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/MockStepDao.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/MockStepDao.java index 2fd61548d..60fd4be4e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/MockStepDao.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/MockStepDao.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.repository; +package org.springframework.batch.core.repository.support; import java.util.List; @@ -22,7 +22,7 @@ import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; -import org.springframework.batch.execution.repository.dao.StepExecutionDao; +import org.springframework.batch.core.repository.support.dao.StepExecutionDao; import org.springframework.batch.item.ExecutionContext; public class MockStepDao implements StepExecutionDao { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryIntegrationTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryIntegrationTests.java similarity index 96% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryIntegrationTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryIntegrationTests.java index 6218f5742..422f58327 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryIntegrationTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryIntegrationTests.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository; +package org.springframework.batch.core.repository.support; import java.util.Date; import java.util.HashMap; @@ -9,10 +9,11 @@ import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; +import org.springframework.batch.core.job.JobSupport; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.repository.JobRestartException; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.step.StepSupport; +import org.springframework.batch.core.repository.support.SimpleJobRepository; +import org.springframework.batch.core.step.StepSupport; import org.springframework.batch.item.ExecutionContext; import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests; import org.springframework.util.ClassUtils; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryTests.java similarity index 96% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryTests.java index f6adf4ba2..155efb054 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/SimpleJobRepositoryTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/SimpleJobRepositoryTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.repository; +package org.springframework.batch.core.repository.support; import java.util.ArrayList; import java.util.List; @@ -28,11 +28,12 @@ import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.repository.dao.JobExecutionDao; -import org.springframework.batch.execution.repository.dao.JobInstanceDao; -import org.springframework.batch.execution.repository.dao.StepExecutionDao; -import org.springframework.batch.execution.step.StepSupport; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.repository.support.SimpleJobRepository; +import org.springframework.batch.core.repository.support.dao.JobExecutionDao; +import org.springframework.batch.core.repository.support.dao.JobInstanceDao; +import org.springframework.batch.core.repository.support.dao.StepExecutionDao; +import org.springframework.batch.core.step.StepSupport; import org.springframework.batch.item.ExecutionContext; /** diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/AbstractJobDaoTests.java similarity index 96% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/AbstractJobDaoTests.java index f2db753e3..9cfc88138 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/AbstractJobDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/AbstractJobDaoTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.util.Date; import java.util.List; @@ -26,7 +26,10 @@ import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; -import org.springframework.batch.execution.job.JobSupport; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.repository.support.dao.JobExecutionDao; +import org.springframework.batch.core.repository.support.dao.JobInstanceDao; +import org.springframework.batch.core.repository.support.dao.NoSuchObjectException; import org.springframework.batch.repeat.ExitStatus; import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests; import org.springframework.util.ClassUtils; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/AbstractStepDaoTests.java similarity index 95% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/AbstractStepDaoTests.java index fab188b27..71733d4c8 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/AbstractStepDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/AbstractStepDaoTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.util.Date; @@ -25,9 +25,12 @@ import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.repository.support.dao.JobExecutionDao; +import org.springframework.batch.core.repository.support.dao.JobInstanceDao; +import org.springframework.batch.core.repository.support.dao.StepExecutionDao; import org.springframework.batch.core.runtime.ExitStatusExceptionClassifier; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.step.StepSupport; +import org.springframework.batch.core.step.StepSupport; import org.springframework.batch.item.ExecutionContext; import org.springframework.batch.repeat.ExitStatus; import org.springframework.dao.OptimisticLockingFailureException; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/JdbcJobDaoQueryTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/JdbcJobDaoQueryTests.java similarity index 92% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/JdbcJobDaoQueryTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/JdbcJobDaoQueryTests.java index dac08b8fc..1bd30f15a 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/JdbcJobDaoQueryTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/JdbcJobDaoQueryTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.util.ArrayList; import java.util.List; @@ -23,7 +23,8 @@ import junit.framework.TestCase; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobParameters; -import org.springframework.batch.execution.job.JobSupport; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.repository.support.dao.JdbcJobExecutionDao; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.support.incrementer.DataFieldMaxValueIncrementer; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/JdbcJobDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/JdbcJobDaoTests.java similarity index 81% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/JdbcJobDaoTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/JdbcJobDaoTests.java index a86df022a..635e5bcae 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/JdbcJobDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/JdbcJobDaoTests.java @@ -1,8 +1,11 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.util.List; import java.util.Map; +import org.springframework.batch.core.repository.support.dao.AbstractJdbcBatchMetadataDao; +import org.springframework.batch.core.repository.support.dao.JdbcJobExecutionDao; +import org.springframework.batch.core.repository.support.dao.JdbcJobInstanceDao; import org.springframework.batch.repeat.ExitStatus; public class JdbcJobDaoTests extends AbstractJobDaoTests { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/JdbcStepDaoPrefixTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/JdbcStepDaoPrefixTests.java similarity index 93% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/JdbcStepDaoPrefixTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/JdbcStepDaoPrefixTests.java index 42485f418..82807cded 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/JdbcStepDaoPrefixTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/JdbcStepDaoPrefixTests.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.util.List; @@ -10,8 +10,9 @@ import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.step.StepSupport; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.repository.support.dao.JdbcStepExecutionDao; +import org.springframework.batch.core.step.StepSupport; import org.springframework.dao.DataAccessException; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/JdbcStepDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/JdbcStepDaoTests.java similarity index 84% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/JdbcStepDaoTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/JdbcStepDaoTests.java index bb762732b..8dd04c28c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/JdbcStepDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/JdbcStepDaoTests.java @@ -1,8 +1,10 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.util.List; import java.util.Map; +import org.springframework.batch.core.repository.support.dao.AbstractJdbcBatchMetadataDao; +import org.springframework.batch.core.repository.support.dao.JdbcStepExecutionDao; import org.springframework.batch.repeat.ExitStatus; public class JdbcStepDaoTests extends AbstractStepDaoTests { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/MapJobExecutionDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/MapJobExecutionDaoTests.java similarity index 90% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/MapJobExecutionDaoTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/MapJobExecutionDaoTests.java index f86debe7d..0e4113b15 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/MapJobExecutionDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/MapJobExecutionDaoTests.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.util.Date; import java.util.List; @@ -9,7 +9,9 @@ import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobParameters; -import org.springframework.batch.execution.job.JobSupport; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.repository.support.dao.JobExecutionDao; +import org.springframework.batch.core.repository.support.dao.MapJobExecutionDao; public class MapJobExecutionDaoTests extends TestCase { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/MapJobInstanceDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/MapJobInstanceDaoTests.java similarity index 86% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/MapJobInstanceDaoTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/MapJobInstanceDaoTests.java index 0d3bdb5f7..dc90d9f8c 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/MapJobInstanceDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/MapJobInstanceDaoTests.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import junit.framework.TestCase; @@ -6,7 +6,9 @@ import org.springframework.batch.core.Job; import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; -import org.springframework.batch.execution.job.JobSupport; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.repository.support.dao.JobInstanceDao; +import org.springframework.batch.core.repository.support.dao.MapJobInstanceDao; public class MapJobInstanceDaoTests extends TestCase { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/MapStepExecutionDaoTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/MapStepExecutionDaoTests.java similarity index 94% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/MapStepExecutionDaoTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/MapStepExecutionDaoTests.java index 0005fad49..e37c10f94 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/MapStepExecutionDaoTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/MapStepExecutionDaoTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; import java.util.HashMap; @@ -26,8 +26,10 @@ import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.step.StepSupport; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.repository.support.dao.MapStepExecutionDao; +import org.springframework.batch.core.repository.support.dao.StepExecutionDao; +import org.springframework.batch.core.step.StepSupport; import org.springframework.batch.item.ExecutionContext; import org.springframework.dao.OptimisticLockingFailureException; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/NoSuchBatchDomainObjectExceptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/NoSuchBatchDomainObjectExceptionTests.java similarity index 86% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/NoSuchBatchDomainObjectExceptionTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/NoSuchBatchDomainObjectExceptionTests.java index 9a0f2a13a..c9816bd98 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/repository/dao/NoSuchBatchDomainObjectExceptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/repository/support/dao/NoSuchBatchDomainObjectExceptionTests.java @@ -13,9 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.repository.dao; +package org.springframework.batch.core.repository.support.dao; -import org.springframework.batch.execution.repository.dao.NoSuchObjectException; +import org.springframework.batch.core.repository.support.dao.NoSuchObjectException; import junit.framework.TestCase; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/resource/StepExecutionProxyResourceTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionProxyResourceTests.java similarity index 94% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/resource/StepExecutionProxyResourceTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionProxyResourceTests.java index c353706a8..fd1a0443b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/resource/StepExecutionProxyResourceTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/resource/StepExecutionProxyResourceTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.resource; +package org.springframework.batch.core.resource; import java.io.File; import java.io.IOException; @@ -27,8 +27,9 @@ import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.step.StepSupport; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.resource.StepExecutionProxyResource; +import org.springframework.batch.core.step.StepSupport; import org.springframework.core.io.ByteArrayResource; import org.springframework.core.io.DefaultResourceLoader; import org.springframework.core.io.Resource; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/ItemOrientedStepTests.java similarity index 97% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/ItemOrientedStepTests.java index aeab819b0..eef1c203e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/ItemOrientedStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/ItemOrientedStepTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.step; +package org.springframework.batch.core.step; import java.util.ArrayList; import java.util.Arrays; @@ -31,15 +31,17 @@ import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.StepContribution; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.StepListener; +import org.springframework.batch.core.job.JobSupport; import org.springframework.batch.core.listener.StepListenerSupport; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.repository.SimpleJobRepository; -import org.springframework.batch.execution.repository.dao.MapJobExecutionDao; -import org.springframework.batch.execution.repository.dao.MapJobInstanceDao; -import org.springframework.batch.execution.repository.dao.MapStepExecutionDao; -import org.springframework.batch.execution.step.support.JobRepositorySupport; -import org.springframework.batch.execution.step.support.SimpleItemHandler; -import org.springframework.batch.execution.step.support.StepInterruptionPolicy; +import org.springframework.batch.core.repository.support.SimpleJobRepository; +import org.springframework.batch.core.repository.support.dao.MapJobExecutionDao; +import org.springframework.batch.core.repository.support.dao.MapJobInstanceDao; +import org.springframework.batch.core.repository.support.dao.MapStepExecutionDao; +import org.springframework.batch.core.step.AbstractStep; +import org.springframework.batch.core.step.ItemOrientedStep; +import org.springframework.batch.core.step.support.JobRepositorySupport; +import org.springframework.batch.core.step.support.SimpleItemHandler; +import org.springframework.batch.core.step.support.StepInterruptionPolicy; import org.springframework.batch.item.AbstractItemReader; import org.springframework.batch.item.AbstractItemWriter; import org.springframework.batch.item.ExecutionContext; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/StepSupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/StepSupport.java similarity index 98% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/StepSupport.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/StepSupport.java index 9db907b9f..2838b6845 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/StepSupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/StepSupport.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step; +package org.springframework.batch.core.step; import org.springframework.batch.core.UnexpectedJobExecutionException; import org.springframework.batch.core.JobInterruptedException; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/TaskletStepTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/TaskletStepTests.java similarity index 96% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/TaskletStepTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/TaskletStepTests.java index 6d43453e6..486d0b6d5 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/TaskletStepTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/TaskletStepTests.java @@ -1,4 +1,4 @@ -package org.springframework.batch.execution.step; +package org.springframework.batch.core.step; import java.util.ArrayList; import java.util.List; @@ -13,10 +13,11 @@ import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.StepExecution; import org.springframework.batch.core.StepListener; +import org.springframework.batch.core.job.JobSupport; import org.springframework.batch.core.listener.StepListenerSupport; +import org.springframework.batch.core.step.TaskletStep; +import org.springframework.batch.core.step.support.JobRepositorySupport; import org.springframework.batch.core.tasklet.Tasklet; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.step.support.JobRepositorySupport; import org.springframework.batch.repeat.ExitStatus; public class TaskletStepTests extends TestCase { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/DefaultStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/DefaultStepFactoryBeanTests.java similarity index 90% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/DefaultStepFactoryBeanTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/support/DefaultStepFactoryBeanTests.java index aac474287..fa77ca86b 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/DefaultStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/DefaultStepFactoryBeanTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import java.util.ArrayList; import java.util.Arrays; @@ -27,14 +27,15 @@ import org.springframework.batch.core.BatchListener; import org.springframework.batch.core.BatchStatus; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; +import org.springframework.batch.core.job.SimpleJob; import org.springframework.batch.core.listener.ItemListenerSupport; -import org.springframework.batch.execution.job.SimpleJob; -import org.springframework.batch.execution.repository.SimpleJobRepository; -import org.springframework.batch.execution.repository.dao.MapJobExecutionDao; -import org.springframework.batch.execution.repository.dao.MapJobInstanceDao; -import org.springframework.batch.execution.repository.dao.MapStepExecutionDao; -import org.springframework.batch.execution.step.AbstractStep; -import org.springframework.batch.execution.step.ItemOrientedStep; +import org.springframework.batch.core.repository.support.SimpleJobRepository; +import org.springframework.batch.core.repository.support.dao.MapJobExecutionDao; +import org.springframework.batch.core.repository.support.dao.MapJobInstanceDao; +import org.springframework.batch.core.repository.support.dao.MapStepExecutionDao; +import org.springframework.batch.core.step.AbstractStep; +import org.springframework.batch.core.step.ItemOrientedStep; +import org.springframework.batch.core.step.support.DefaultStepFactoryBean; import org.springframework.batch.item.AbstractItemWriter; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemWriter; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/JobRepositorySupport.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/JobRepositorySupport.java similarity index 97% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/JobRepositorySupport.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/support/JobRepositorySupport.java index a8e8232e3..e4f6fe4f2 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/JobRepositorySupport.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/JobRepositorySupport.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobExecution; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/MockItemReader.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/MockItemReader.java similarity index 96% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/MockItemReader.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/support/MockItemReader.java index 77fae5865..9a2cb7e8e 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/MockItemReader.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/MockItemReader.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.MarkFailedException; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/RepeatOperationsStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/RepeatOperationsStepFactoryBeanTests.java similarity index 91% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/RepeatOperationsStepFactoryBeanTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/support/RepeatOperationsStepFactoryBeanTests.java index ba030cc69..d1fb563d1 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/RepeatOperationsStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/RepeatOperationsStepFactoryBeanTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import java.util.ArrayList; import java.util.List; @@ -25,8 +25,9 @@ import org.springframework.batch.core.JobInstance; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.launch.EmptyItemWriter; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.launch.EmptyItemWriter; +import org.springframework.batch.core.step.support.RepeatOperationsStepFactoryBean; import org.springframework.batch.item.reader.ListItemReader; import org.springframework.batch.repeat.ExitStatus; import org.springframework.batch.repeat.RepeatCallback; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/SimpleExitStatusExceptionClassifierTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/SimpleExitStatusExceptionClassifierTests.java similarity index 93% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/SimpleExitStatusExceptionClassifierTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/support/SimpleExitStatusExceptionClassifierTests.java index 4f7b92899..36ad41f29 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/SimpleExitStatusExceptionClassifierTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/SimpleExitStatusExceptionClassifierTests.java @@ -13,14 +13,14 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import org.springframework.batch.core.JobInterruptedException; +import org.springframework.batch.core.launch.support.ExitCodeMapper; import org.springframework.batch.core.repository.NoSuchJobException; import org.springframework.batch.core.runtime.ExitStatusExceptionClassifier; -import org.springframework.batch.execution.launch.support.ExitCodeMapper; -import org.springframework.batch.execution.step.support.SimpleExitStatusExceptionClassifier; +import org.springframework.batch.core.step.support.SimpleExitStatusExceptionClassifier; import org.springframework.batch.repeat.ExitStatus; import junit.framework.TestCase; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/SimpleRetryExceptionHandlerTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/SimpleRetryExceptionHandlerTests.java similarity index 87% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/SimpleRetryExceptionHandlerTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/support/SimpleRetryExceptionHandlerTests.java index dbdcf48a5..7e3318b4f 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/SimpleRetryExceptionHandlerTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/SimpleRetryExceptionHandlerTests.java @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import junit.framework.TestCase; +import org.springframework.batch.core.step.support.SimpleRetryExceptionHandler; import org.springframework.batch.repeat.RepeatContext; import org.springframework.batch.repeat.context.RepeatContextSupport; import org.springframework.batch.repeat.exception.SimpleLimitExceptionHandler; @@ -51,7 +52,7 @@ public class SimpleRetryExceptionHandlerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.step.support.SimpleRetryExceptionHandler#handleException(org.springframework.batch.repeat.RepeatContext, java.lang.Throwable)}. + * {@link org.springframework.batch.core.step.support.SimpleRetryExceptionHandler#handleException(org.springframework.batch.repeat.RepeatContext, java.lang.Throwable)}. */ public void testRethrowWhenRetryExhausted() { @@ -76,7 +77,7 @@ public class SimpleRetryExceptionHandlerTests extends TestCase { /** * Test method for - * {@link org.springframework.batch.execution.step.support.SimpleRetryExceptionHandler#handleException(org.springframework.batch.repeat.RepeatContext, java.lang.Throwable)}. + * {@link org.springframework.batch.core.step.support.SimpleRetryExceptionHandler#handleException(org.springframework.batch.repeat.RepeatContext, java.lang.Throwable)}. */ public void testNoRethrowWhenRetryNotExhausted() { diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/SkipLimitReadFailurePolicyTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/SkipLimitReadFailurePolicyTests.java similarity index 88% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/SkipLimitReadFailurePolicyTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/support/SkipLimitReadFailurePolicyTests.java index fedd01466..1820d6c27 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/SkipLimitReadFailurePolicyTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/SkipLimitReadFailurePolicyTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import java.io.FileNotFoundException; import java.util.ArrayList; @@ -21,6 +21,8 @@ import java.util.List; import junit.framework.TestCase; +import org.springframework.batch.core.step.support.LimitCheckingItemSkipPolicy; +import org.springframework.batch.core.step.support.SkipLimitExceededException; import org.springframework.batch.item.file.FlatFileParseException; /** diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/StatefulRetryStepFactoryBeanTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/StatefulRetryStepFactoryBeanTests.java similarity index 87% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/StatefulRetryStepFactoryBeanTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/support/StatefulRetryStepFactoryBeanTests.java index c445c0a60..70a79c769 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/StatefulRetryStepFactoryBeanTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/StatefulRetryStepFactoryBeanTests.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import java.util.ArrayList; import java.util.Arrays; @@ -27,12 +27,13 @@ import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; import org.springframework.batch.core.Step; import org.springframework.batch.core.StepExecution; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.repository.SimpleJobRepository; -import org.springframework.batch.execution.repository.dao.MapJobExecutionDao; -import org.springframework.batch.execution.repository.dao.MapJobInstanceDao; -import org.springframework.batch.execution.repository.dao.MapStepExecutionDao; -import org.springframework.batch.execution.step.ItemOrientedStep; +import org.springframework.batch.core.job.JobSupport; +import org.springframework.batch.core.repository.support.SimpleJobRepository; +import org.springframework.batch.core.repository.support.dao.MapJobExecutionDao; +import org.springframework.batch.core.repository.support.dao.MapJobInstanceDao; +import org.springframework.batch.core.repository.support.dao.MapStepExecutionDao; +import org.springframework.batch.core.step.ItemOrientedStep; +import org.springframework.batch.core.step.support.StatefulRetryStepFactoryBean; import org.springframework.batch.item.AbstractItemWriter; import org.springframework.batch.item.ItemReader; import org.springframework.batch.item.ItemRecoverer; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/StepExecutorInterruptionTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/StepExecutorInterruptionTests.java similarity index 88% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/StepExecutorInterruptionTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/support/StepExecutorInterruptionTests.java index 950fcc140..39e92d3e5 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/StepExecutorInterruptionTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/StepExecutorInterruptionTests.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import junit.framework.TestCase; @@ -23,13 +23,15 @@ import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobInterruptedException; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.StepExecution; +import org.springframework.batch.core.job.JobSupport; import org.springframework.batch.core.repository.JobRepository; -import org.springframework.batch.execution.job.JobSupport; -import org.springframework.batch.execution.repository.SimpleJobRepository; -import org.springframework.batch.execution.repository.dao.MapJobExecutionDao; -import org.springframework.batch.execution.repository.dao.MapJobInstanceDao; -import org.springframework.batch.execution.repository.dao.MapStepExecutionDao; -import org.springframework.batch.execution.step.ItemOrientedStep; +import org.springframework.batch.core.repository.support.SimpleJobRepository; +import org.springframework.batch.core.repository.support.dao.MapJobExecutionDao; +import org.springframework.batch.core.repository.support.dao.MapJobInstanceDao; +import org.springframework.batch.core.repository.support.dao.MapStepExecutionDao; +import org.springframework.batch.core.step.ItemOrientedStep; +import org.springframework.batch.core.step.support.SimpleItemHandler; +import org.springframework.batch.core.step.support.StepExecutionSynchronizer; import org.springframework.batch.item.AbstractItemReader; import org.springframework.batch.item.AbstractItemWriter; import org.springframework.batch.repeat.policy.SimpleCompletionPolicy; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/ThreadStepInterruptionPolicyTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/ThreadStepInterruptionPolicyTests.java similarity index 93% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/ThreadStepInterruptionPolicyTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/step/support/ThreadStepInterruptionPolicyTests.java index 08919e694..453ca3fb3 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/step/support/ThreadStepInterruptionPolicyTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/step/support/ThreadStepInterruptionPolicyTests.java @@ -13,12 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.step.support; +package org.springframework.batch.core.step.support; import junit.framework.TestCase; import org.springframework.batch.core.JobInterruptedException; -import org.springframework.batch.execution.step.support.ThreadStepInterruptionPolicy; import org.springframework.batch.repeat.RepeatContext; import org.springframework.batch.repeat.context.RepeatContextSupport; diff --git a/spring-batch-core/src/test/java/org/springframework/batch/execution/tasklet/TaskletAdapterTests.java b/spring-batch-core/src/test/java/org/springframework/batch/core/tasklet/support/TaskletAdapterTests.java similarity index 78% rename from spring-batch-core/src/test/java/org/springframework/batch/execution/tasklet/TaskletAdapterTests.java rename to spring-batch-core/src/test/java/org/springframework/batch/core/tasklet/support/TaskletAdapterTests.java index 4248f0f89..12d1821cf 100644 --- a/spring-batch-core/src/test/java/org/springframework/batch/execution/tasklet/TaskletAdapterTests.java +++ b/spring-batch-core/src/test/java/org/springframework/batch/core/tasklet/support/TaskletAdapterTests.java @@ -13,8 +13,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.springframework.batch.execution.tasklet; +package org.springframework.batch.core.tasklet.support; +import org.springframework.batch.core.tasklet.support.TaskletAdapter; import org.springframework.batch.repeat.ExitStatus; import junit.framework.TestCase; @@ -45,7 +46,7 @@ public class TaskletAdapterTests extends TestCase { } /** - * Test method for {@link org.springframework.batch.execution.tasklet.TaskletAdapter#execute()}. + * Test method for {@link org.springframework.batch.core.tasklet.support.TaskletAdapter#execute()}. * @throws Exception */ public void testExecuteWithExitStatus() throws Exception { @@ -53,7 +54,7 @@ public class TaskletAdapterTests extends TestCase { } /** - * Test method for {@link org.springframework.batch.execution.tasklet.TaskletAdapter#mapResult(java.lang.Object)}. + * Test method for {@link org.springframework.batch.core.tasklet.support.TaskletAdapter#mapResult(java.lang.Object)}. */ public void testMapResultWithNull() throws Exception { tasklet.setTargetMethod("process"); @@ -61,7 +62,7 @@ public class TaskletAdapterTests extends TestCase { } /** - * Test method for {@link org.springframework.batch.execution.tasklet.TaskletAdapter#mapResult(java.lang.Object)}. + * Test method for {@link org.springframework.batch.core.tasklet.support.TaskletAdapter#mapResult(java.lang.Object)}. */ public void testMapResultWithNonNull() throws Exception { tasklet.setTargetMethod("process"); diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/execution/configuration/test-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/support/test-context.xml similarity index 74% rename from spring-batch-core/src/test/resources/org/springframework/batch/execution/configuration/test-context.xml rename to spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/support/test-context.xml index 4c84c2588..bf1c5fde3 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/execution/configuration/test-context.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/configuration/support/test-context.xml @@ -10,17 +10,17 @@ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"> + class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor"> + class="org.springframework.batch.core.configuration.support.MapJobRegistry" /> + class="org.springframework.batch.core.job.JobSupport"> - + @@ -35,26 +35,26 @@ + class="org.springframework.batch.core.launch.EmptyItemWriter" /> + class="org.springframework.batch.core.step.support.JobRepositorySupport" /> + class="org.springframework.batch.core.job.JobSupport"> + class="org.springframework.batch.core.job.JobSupport"> @@ -66,7 +66,7 @@ p:name="bucket" /> + class="org.springframework.batch.core.job.JobSupport" /> diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/execution/bootstrap/support/job.xml b/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/job.xml similarity index 80% rename from spring-batch-core/src/test/resources/org/springframework/batch/execution/bootstrap/support/job.xml rename to spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/job.xml index a7c87f72b..f2515475a 100644 --- a/spring-batch-core/src/test/resources/org/springframework/batch/execution/bootstrap/support/job.xml +++ b/spring-batch-core/src/test/resources/org/springframework/batch/core/launch/support/job.xml @@ -12,10 +12,10 @@ + class="org.springframework.batch.core.job.JobSupport"> + class="org.springframework.batch.core.step.support.DefaultStepFactoryBean"> @@ -24,11 +24,11 @@ + class="org.springframework.batch.core.launch.EmptyItemWriter" /> + class="org.springframework.batch.core.step.support.JobRepositorySupport" /> - + - + + class="org.springframework.batch.core.launch.support.CommandLineJobRunnerTests$StubSystemExiter" /> + class="org.springframework.batch.core.launch.support.CommandLineJobRunnerTests$StubExceptionClassifier" /> diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/data-source-context.xml b/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/data-source-context.xml deleted file mode 100644 index 33b2f5f80..000000000 --- a/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/data-source-context.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/destroy.sql b/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/destroy.sql deleted file mode 100644 index 461b9682d..000000000 --- a/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/destroy.sql +++ /dev/null @@ -1,10 +0,0 @@ --- Autogenerated: do not edit this file -DROP TABLE BATCH_STEP_EXECUTION_CONTEXT IF EXISTS; -DROP TABLE BATCH_STEP_EXECUTION IF EXISTS; -DROP TABLE BATCH_JOB_EXECUTION IF EXISTS; -DROP TABLE BATCH_JOB_PARAMS IF EXISTS; -DROP TABLE BATCH_JOB_INSTANCE IF EXISTS; - -DROP TABLE BATCH_STEP_EXECUTION_SEQ IF EXISTS; -DROP TABLE BATCH_JOB_EXECUTION_SEQ IF EXISTS; -DROP TABLE BATCH_JOB_SEQ IF EXISTS; \ No newline at end of file diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/init.sql b/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/init.sql deleted file mode 100644 index ee822b8d7..000000000 --- a/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/init.sql +++ /dev/null @@ -1,73 +0,0 @@ --- Autogenerated: do not edit this file -CREATE TABLE BATCH_JOB_INSTANCE ( - JOB_INSTANCE_ID BIGINT IDENTITY PRIMARY KEY , - VERSION BIGINT, - JOB_NAME VARCHAR(100) NOT NULL , - JOB_KEY VARCHAR(2500) -); - -CREATE TABLE BATCH_JOB_EXECUTION ( - JOB_EXECUTION_ID BIGINT IDENTITY PRIMARY KEY , - VERSION BIGINT, - JOB_INSTANCE_ID BIGINT NOT NULL, - START_TIME TIMESTAMP, - END_TIME TIMESTAMP , - STATUS VARCHAR(10), - CONTINUABLE CHAR(1), - EXIT_CODE VARCHAR(20), - EXIT_MESSAGE VARCHAR(2500), - constraint JOB_INSTANCE_EXECUTION_FK foreign key (JOB_INSTANCE_ID) - references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID) -); - -CREATE TABLE BATCH_JOB_PARAMS ( - JOB_INSTANCE_ID BIGINT NOT NULL , - TYPE_CD VARCHAR(6) NOT NULL , - KEY_NAME VARCHAR(100) NOT NULL , - STRING_VAL VARCHAR(250) , - DATE_VAL TIMESTAMP , - LONG_VAL BIGINT , - DOUBLE_VAL DOUBLE PRECISION, - constraint JOB_INSTANCE_PARAMS_FK foreign key (JOB_INSTANCE_ID) - references BATCH_JOB_INSTANCE(JOB_INSTANCE_ID) -); - -CREATE TABLE BATCH_STEP_EXECUTION ( - STEP_EXECUTION_ID BIGINT IDENTITY PRIMARY KEY , - VERSION BIGINT NOT NULL, - STEP_NAME VARCHAR(100) NOT NULL, - JOB_EXECUTION_ID BIGINT NOT NULL, - START_TIME TIMESTAMP NOT NULL , - END_TIME TIMESTAMP , - STATUS VARCHAR(10), - COMMIT_COUNT BIGINT , - TASK_COUNT BIGINT , - CONTINUABLE CHAR(1), - EXIT_CODE VARCHAR(20), - EXIT_MESSAGE VARCHAR(2500), - constraint JOB_EXECUTION_STEP_FK foreign key (JOB_EXECUTION_ID) - references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID) -); - -CREATE TABLE BATCH_STEP_EXECUTION_CONTEXT ( - STEP_EXECUTION_ID BIGINT NOT NULL , - TYPE_CD VARCHAR(6) NOT NULL , - KEY_NAME VARCHAR(1000) NOT NULL , - STRING_VAL VARCHAR(1000) , - DATE_VAL TIMESTAMP , - LONG_VAL VARCHAR(10) , - DOUBLE_VAL DOUBLE PRECISION , - OBJECT_VAL LONGVARBINARY, - constraint STEP_EXECUTION_CONTEXT_FK foreign key (STEP_EXECUTION_ID) - references BATCH_STEP_EXECUTION(STEP_EXECUTION_ID) -); - -CREATE TABLE BATCH_STEP_EXECUTION_SEQ ( - ID BIGINT IDENTITY -); -CREATE TABLE BATCH_JOB_EXECUTION_SEQ ( - ID BIGINT IDENTITY -); -CREATE TABLE BATCH_JOB_SEQ ( - ID BIGINT IDENTITY -); diff --git a/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/sql-dao-test.xml b/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/sql-dao-test.xml deleted file mode 100644 index b2ee99cf2..000000000 --- a/spring-batch-core/src/test/resources/org/springframework/batch/execution/repository/dao/sql-dao-test.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/advice/JobExecutionNotificationPublisher.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/advice/JobExecutionNotificationPublisher.java index c137a54f9..54378303d 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/advice/JobExecutionNotificationPublisher.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/advice/JobExecutionNotificationPublisher.java @@ -53,7 +53,7 @@ public class JobExecutionNotificationPublisher implements ApplicationListener, N * close we log the event at INFO level and send a JMX notification if we * are also an MBean. * - * @see org.springframework.batch.execution.launch.SimpleJobLauncher#onApplicationEvent(org.springframework.context.ApplicationEvent) + * @see org.springframework.batch.core.launch.SimpleJobLauncher#onApplicationEvent(org.springframework.context.ApplicationEvent) */ public void onApplicationEvent(ApplicationEvent applicationEvent) { if (applicationEvent instanceof SimpleMessageApplicationEvent) { diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/quartz/JobLauncherDetails.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/quartz/JobLauncherDetails.java index 600507195..86f3a5fe7 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/quartz/JobLauncherDetails.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/quartz/JobLauncherDetails.java @@ -26,10 +26,10 @@ import org.quartz.JobExecutionContext; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.JobParametersBuilder; import org.springframework.batch.core.configuration.JobLocator; +import org.springframework.batch.core.launch.JobLauncher; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.repository.JobRestartException; import org.springframework.batch.core.repository.NoSuchJobException; -import org.springframework.batch.execution.launch.JobLauncher; import org.springframework.scheduling.quartz.QuartzJobBean; /** diff --git a/spring-batch-samples/src/main/java/org/springframework/batch/sample/step/support/NoopStepInterruptionPolicy.java b/spring-batch-samples/src/main/java/org/springframework/batch/sample/step/support/NoopStepInterruptionPolicy.java index c2c639207..7e0ac5a46 100644 --- a/spring-batch-samples/src/main/java/org/springframework/batch/sample/step/support/NoopStepInterruptionPolicy.java +++ b/spring-batch-samples/src/main/java/org/springframework/batch/sample/step/support/NoopStepInterruptionPolicy.java @@ -1,7 +1,7 @@ package org.springframework.batch.sample.step.support; import org.springframework.batch.core.JobInterruptedException; -import org.springframework.batch.execution.step.support.StepInterruptionPolicy; +import org.springframework.batch.core.step.support.StepInterruptionPolicy; import org.springframework.batch.repeat.RepeatContext; public class NoopStepInterruptionPolicy implements StepInterruptionPolicy { diff --git a/spring-batch-samples/src/main/resources/jobs/infiniteLoopJob.xml b/spring-batch-samples/src/main/resources/jobs/infiniteLoopJob.xml index 5d0631c12..9496d38ed 100644 --- a/spring-batch-samples/src/main/resources/jobs/infiniteLoopJob.xml +++ b/spring-batch-samples/src/main/resources/jobs/infiniteLoopJob.xml @@ -9,7 +9,7 @@ - + diff --git a/spring-batch-samples/src/main/resources/jobs/retrySample.xml b/spring-batch-samples/src/main/resources/jobs/retrySample.xml index 2e712dc11..e2c17c527 100644 --- a/spring-batch-samples/src/main/resources/jobs/retrySample.xml +++ b/spring-batch-samples/src/main/resources/jobs/retrySample.xml @@ -10,7 +10,7 @@ + class="org.springframework.batch.core.step.StatefulRetryStepFactoryBean"> diff --git a/spring-batch-samples/src/main/resources/simple-job-launcher-context.xml b/spring-batch-samples/src/main/resources/simple-job-launcher-context.xml index 25e8cce8f..993e42b49 100644 --- a/spring-batch-samples/src/main/resources/simple-job-launcher-context.xml +++ b/spring-batch-samples/src/main/resources/simple-job-launcher-context.xml @@ -10,15 +10,15 @@ + class="org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor"> - + - + - + class="org.springframework.batch.core.repository.support.dao.MapJobInstanceDao" /> + class="org.springframework.batch.core.repository.support.dao.MapJobExecutionDao" /> + class="org.springframework.batch.core.repository.support.dao.MapStepExecutionDao" /> - + - + - diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/AbstractBatchLauncherTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/AbstractBatchLauncherTests.java index 6d09b126a..9cf66065c 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/AbstractBatchLauncherTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/AbstractBatchLauncherTests.java @@ -18,7 +18,7 @@ package org.springframework.batch.sample; import org.springframework.batch.core.Job; import org.springframework.batch.core.JobParameters; -import org.springframework.batch.execution.launch.JobLauncher; +import org.springframework.batch.core.launch.JobLauncher; import org.springframework.test.AbstractDependencyInjectionSpringContextTests; import org.springframework.util.ClassUtils; diff --git a/spring-batch-samples/src/test/java/org/springframework/batch/sample/quartz/JobLauncherDetailsTests.java b/spring-batch-samples/src/test/java/org/springframework/batch/sample/quartz/JobLauncherDetailsTests.java index 576e78d35..32c8cb5f8 100644 --- a/spring-batch-samples/src/test/java/org/springframework/batch/sample/quartz/JobLauncherDetailsTests.java +++ b/spring-batch-samples/src/test/java/org/springframework/batch/sample/quartz/JobLauncherDetailsTests.java @@ -31,10 +31,10 @@ import org.quartz.spi.TriggerFiredBundle; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobParameters; import org.springframework.batch.core.configuration.JobLocator; +import org.springframework.batch.core.launch.JobLauncher; import org.springframework.batch.core.repository.JobExecutionAlreadyRunningException; import org.springframework.batch.core.repository.JobRestartException; import org.springframework.batch.core.repository.NoSuchJobException; -import org.springframework.batch.execution.launch.JobLauncher; import org.springframework.batch.sample.tasklet.JobSupport; /**