From 2843c17229105b3fce93fd95097380d7a2deafc8 Mon Sep 17 00:00:00 2001 From: lucasward Date: Tue, 28 Oct 2008 23:36:26 +0000 Subject: [PATCH] OPEN - issue BATCH-891: Create Annotations http://jira.springframework.org/browse/BATCH-891 I started creating some of the annotations we'll need. I still have a few open questions, but I'll add them to the Jira issue. --- .../batch/core/annotation/AfterJob.java | 27 +++++++++++++++++ .../batch/core/annotation/AfterStep.java | 27 +++++++++++++++++ .../batch/core/annotation/BeforeJob.java | 29 +++++++++++++++++++ .../batch/core/annotation/BeforeStep.java | 28 ++++++++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterJob.java create mode 100644 spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterStep.java create mode 100644 spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeJob.java create mode 100644 spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeStep.java diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterJob.java b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterJob.java new file mode 100644 index 000000000..85b98d206 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterJob.java @@ -0,0 +1,27 @@ +/** + * + */ +package org.springframework.batch.core.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.batch.core.Job; +import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobExecutionListener; + +/** + * Marks a method to be called after a {@link Job} has completed. Annotated methods + * will be called regardless of the status of the {@link JobExecution}. + * + * @author Lucas Ward + * @since 2.0 + * @see JobExecutionListener + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface AfterJob { + +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterStep.java new file mode 100644 index 000000000..a0e4ae9f3 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/AfterStep.java @@ -0,0 +1,27 @@ +/** + * + */ +package org.springframework.batch.core.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.batch.core.Step; +import org.springframework.batch.core.StepExecution; +import org.springframework.batch.core.StepExecutionListener; + +/** + * Marks a method to be called after a {@link Step} has completed. Annotated methods + * will be called regardless of the status of the {@link StepExecution}. + * + * @author Lucas Ward + * @since 2.0 + * @see StepExecutionListener + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface AfterStep { + +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeJob.java b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeJob.java new file mode 100644 index 000000000..ebc071adf --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeJob.java @@ -0,0 +1,29 @@ +/** + * + */ +package org.springframework.batch.core.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.batch.core.Job; +import org.springframework.batch.core.JobExecution; +import org.springframework.batch.core.JobExecutionListener; +import org.springframework.batch.core.Step; + +/** + * Marks a method to be called before a {@link Job} is executed, which comes + * after a {@link JobExecution} is created and persisted, but before the first + * {@link Step} is executed. + * + * @author Lucas Ward + * @since 2.0 + * @see JobExecutionListener + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface BeforeJob { + +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeStep.java b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeStep.java new file mode 100644 index 000000000..7bcd88920 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/annotation/BeforeStep.java @@ -0,0 +1,28 @@ +/** + * + */ +package org.springframework.batch.core.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.springframework.batch.core.Step; +import org.springframework.batch.core.StepExecution; +import org.springframework.batch.core.StepExecutionListener; + +/** + * Marks a method to be called before a {@link Step} is executed, which comes + * after a {@link StepExecution} is created and persisted, but before the first + * item is read. + * + * @author Lucas Ward + * @since 2.0 + * @see StepExecutionListener + */ +@Retention(RetentionPolicy.RUNTIME) +@Target({ElementType.METHOD}) +public @interface BeforeStep { + +}