View Javadoc

1   /*
2    * Copyright 2006-2007 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.batch.repeat;
18  
19  
20  /**
21   * Callback interface for batch operations. Many simple processes will be able
22   * to use off-the-shelf implementations of this interface, enabling the
23   * application developer to concentrate on business logic.
24   * 
25   * @see RepeatOperations
26   * 
27   * @author Dave Syer
28   * 
29   */
30  public interface RepeatCallback {
31  
32  	/**
33  	 * Implementations return true if they can continue processing - e.g. there
34  	 * is a data source that is not yet exhausted. Exceptions are not necessarily
35  	 * fatal - processing might continue depending on the Exception type and the
36  	 * implementation of the caller.
37  	 * 
38  	 * @param context the current context passed in by the caller.
39  	 * @return an {@link RepeatStatus} which is continuable if there is (or may
40  	 * be) more data to process.
41  	 * @throws Exception if there is a problem with the processing.
42  	 */
43  	RepeatStatus doInIteration(RepeatContext context) throws Exception;
44  }