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   * The main interface providing access to batch operations. The batch client is
22   * the {@link RepeatCallback}, where a single item or record is processed. The
23   * batch behaviour, boundary conditions, transactions etc, are dealt with by the
24   * {@link RepeatOperations} in such as way that the client does not need to know
25   * about them. The client may have access to framework abstractions, like
26   * template data sources, but these should work the same whether they are in a
27   * batch or not.
28   * 
29   * @author Dave Syer
30   * 
31   */
32  public interface RepeatOperations {
33  
34  	/**
35  	 * Execute the callback repeatedly, until a decision can be made to
36  	 * complete. The decision about how many times to execute or when to
37  	 * complete, and what to do in the case of an error is delegated to a
38  	 * {@link CompletionPolicy}.
39  	 * 
40  	 * @param callback the batch callback.
41  	 * @return the aggregate of the result of all the callback operations. An
42  	 * indication of whether the {@link RepeatOperations} can continue
43  	 * processing if this method is called again.
44  	 */
45  	RepeatStatus iterate(RepeatCallback callback) throws RepeatException;
46  
47  }