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  package org.springframework.batch.core;
17  
18  /**
19   * Batch domain interface representing the configuration of a step. As with the {@link Job}, a {@link Step} is meant to
20   * explicitly represent the configuration of a step by a developer, but also the ability to execute the step.
21   * 
22   * @author Dave Syer
23   * 
24   */
25  public interface Step {
26  
27  	/**
28  	 * @return the name of this step.
29  	 */
30  	String getName();
31  
32  	/**
33  	 * @return true if a step that is already marked as complete can be started again.
34  	 */
35  	boolean isAllowStartIfComplete();
36  
37  	/**
38  	 * @return the number of times a job can be started with the same identifier.
39  	 */
40  	int getStartLimit();
41  
42  	/**
43  	 * Process the step and assign progress and status meta information to the {@link StepExecution} provided. The
44  	 * {@link Step} is responsible for setting the meta information and also saving it if required by the
45  	 * implementation.<br/>
46  	 * 
47  	 * It is not safe to re-use an instance of {@link Step} to process multiple concurrent executions.
48  	 * 
49  	 * @param stepExecution an entity representing the step to be executed
50  	 * 
51  	 * @throws JobInterruptedException if the step is interrupted externally
52  	 */
53  	void execute(StepExecution stepExecution) throws JobInterruptedException;
54  
55  }