Added additional menthod to ItemSkipPolicy to determine if a step should fail. Also added a small prototype of domain-specific interceptors.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
Reference in New Issue
Block a user