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.job.flow;
17  
18  import org.springframework.batch.core.JobExecution;
19  import org.springframework.batch.core.StepExecution;
20  
21  /**
22   * Interface allowing for programmatic access to the decision on what the status
23   * of a flow should be.  For example, if some condition that's stored in the 
24   * database indicates that the job should stop for a manual check, a decider
25   * implementation could check that value to determine the status of the flow. 
26   * 
27   * @author Dave Syer
28   * @since 2.0
29   */
30  public interface JobExecutionDecider {
31  
32  	/**
33  	 * Strategy for branching an execution based on the state of an ongoing
34  	 * {@link JobExecution}. The return value will be used as a status to
35  	 * determine the next step in the job.
36  	 * 
37  	 * @param jobExecution a job execution
38  	 * @param stepExecution the latest step execution (may be null)
39  	 * @return the exit status code
40  	 */
41  	FlowExecutionStatus decide(JobExecution jobExecution, StepExecution stepExecution);
42  
43  }