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 java.util.Collection;
19  
20  /**
21   * @author Dave Syer
22   * @since 2.0
23   */
24  public interface Flow {
25  
26  	/**
27  	 * @return the name of the flow
28  	 */
29  	String getName();
30  
31  	/**
32  	 * Retrieve the State with the given name. If there is no State with the
33  	 * given name, then return null.
34  	 * 
35  	 * @param stateName
36  	 * @return the State
37  	 */
38  	State getState(String stateName);
39  
40  	/**
41  	 * @throws FlowExecutionException
42  	 */
43  	FlowExecution start(FlowExecutor executor) throws FlowExecutionException;
44  
45  	/**
46  	 * @param stateName the name of the state to resume on
47  	 * @param executor the context to be passed into each state executed
48  	 * @return a {@link FlowExecution} containing the exit status of the flow
49  	 * @throws FlowExecutionException
50  	 */
51  	FlowExecution resume(String stateName, FlowExecutor executor) throws FlowExecutionException;
52  
53  	/**
54  	 * Convenient accessor for clients needing to explore the states of this
55  	 * flow.
56  	 * @return the states
57  	 */
58  	Collection<State> getStates();
59  
60  }