1 package org.springframework.batch.core.configuration;
2
3 import org.springframework.batch.core.Step;
4 import org.springframework.batch.core.launch.NoSuchJobException;
5 import org.springframework.batch.core.step.NoSuchStepException;
6
7 import java.util.Collection;
8
9 /**
10 * Registry keeping track of all the {@link Step} defined in a
11 * {@link org.springframework.batch.core.Job}.
12 *
13 * @author Sebastien Gerard
14 * @author Stephane Nicoll
15 */
16 public interface StepRegistry {
17
18 /**
19 * Registers all the step of the given job. If the job is already registered,
20 * the method {@link #unregisterStepsFromJob(String)} is called before registering
21 * the given steps.
22 *
23 * @param jobName the give job name
24 * @param steps the job steps
25 * @throws DuplicateJobException if a job with the same job name has already been registered.
26 */
27 void register(String jobName, Collection<Step> steps) throws DuplicateJobException;
28
29 /**
30 * Unregisters all the steps of the given job. If the job is not registered,
31 * nothing happens.
32 *
33 * @param jobName the given job name
34 */
35 void unregisterStepsFromJob(String jobName);
36
37 /**
38 * Returns the {@link Step} of the specified job based on its name.
39 *
40 * @param jobName the name of the job
41 * @param stepName the name of the step to retrieve
42 * @return the step with the given name belonging to the mentioned job
43 * @throws NoSuchJobException no such job with that name exists
44 * @throws NoSuchStepException no such step with that name for that job exists
45 */
46 Step getStep(String jobName, String stepName) throws NoSuchJobException, NoSuchStepException;
47
48 }