001/*
002 * Copyright 2006-2007 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.batch.repeat;
018
019
020/**
021 * The main interface providing access to batch operations. The batch client is
022 * the {@link RepeatCallback}, where a single item or record is processed. The
023 * batch behaviour, boundary conditions, transactions etc, are dealt with by the
024 * {@link RepeatOperations} in such as way that the client does not need to know
025 * about them. The client may have access to framework abstractions, like
026 * template data sources, but these should work the same whether they are in a
027 * batch or not.
028 * 
029 * @author Dave Syer
030 * 
031 */
032public interface RepeatOperations {
033
034        /**
035         * Execute the callback repeatedly, until a decision can be made to
036         * complete. The decision about how many times to execute or when to
037         * complete, and what to do in the case of an error is delegated to a
038         * {@link CompletionPolicy}.
039         * 
040         * @param callback the batch callback.
041         * @return the aggregate of the result of all the callback operations. An
042         * indication of whether the {@link RepeatOperations} can continue
043         * processing if this method is called again.
044         */
045        RepeatStatus iterate(RepeatCallback callback) throws RepeatException;
046
047}