diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/ChunkInterceptor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/ChunkInterceptor.java new file mode 100644 index 000000000..534d08829 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/ChunkInterceptor.java @@ -0,0 +1,35 @@ +/* + * Copyright 2006-2008 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.domain; + +/** + * @author Lucas Ward + * + */ +public interface ChunkInterceptor { + + void beforeRead(); + + void afterRead(Object item); + + void onReadError(Exception ex); + + void beforeWrite(Object item); + + void afterWrite(); + + void onWriterError(Exception ex, Object item); +} diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/ItemSkipPolicy.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/ItemSkipPolicy.java index 9f8bb8dd4..e3dc7328e 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/ItemSkipPolicy.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/ItemSkipPolicy.java @@ -33,4 +33,14 @@ public interface ItemSkipPolicy { * @throws IllegalArgumentException if the exception is null */ boolean shouldSkip(Exception exception, int skipCount); + + /** + * Returns true or false, indicating whether or not an exception + * should cause the step to fail. + * + * @param t throwable encountered while reading + * @return true if the step should continue processing, false otherwise + * @throws IllegalArgumentException if the exception is null + */ + boolean shouldFail(Throwable t); } diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepInterceptor.java b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepInterceptor.java new file mode 100644 index 000000000..805fecc98 --- /dev/null +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/domain/StepInterceptor.java @@ -0,0 +1,34 @@ +/* + * Copyright 2006-2008 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.domain; + +import org.springframework.batch.item.ExecutionContext; +import org.springframework.batch.repeat.ExitStatus; + +/** + * @author Lucas Ward + * + */ +public interface StepInterceptor { + + void open(ExecutionContext executionContext); + + void beforeChunk(); + + void afterChunk(); + + ExitStatus close(); +}