Package org.springframework.batch.core.step

Examples of org.springframework.batch.core.step.StepLocator


   */
  private void findSteps(Flow flow, Map<String, Step> map) {

    for (State state : flow.getStates()) {
      if (state instanceof StepLocator) {
        StepLocator locator = (StepLocator) state;
        for (String name : locator.getStepNames()) {
          map.put(name, locator.getStep(name));
        }
      } else if (state instanceof StepHolder) {
        Step step = ((StepHolder) state).getStep();
        String name = step.getName();
        stepMap.put(name, step);
View Full Code Here


  }

  @Test
  public void testStepNames() throws Exception {
    for (String name : stepLocators.keySet()) {
      StepLocator stepLocator = stepLocators.get(name);
      Collection<String> stepNames = stepLocator.getStepNames();
      Job job = (Job) context.getBean(name);
      String jobName = job.getName();
      assertTrue("Job has no steps: "+jobName, !stepNames.isEmpty());
      for (String registeredName : stepNames) {
        String stepName = stepLocator.getStep(registeredName).getName();
        assertEquals("Step name not equal to registered value: " + stepName + "!=" + registeredName + ", " + jobName,
            stepName, registeredName);
      }
    }
  }
View Full Code Here

  public JobExecution launchStep(String stepName, JobParameters jobParameters, ExecutionContext jobExecutionContext) {
    if (!(job instanceof StepLocator)) {
      throw new UnsupportedOperationException("Cannot locate step from a Job that is not a StepLocator: job="
          + job.getName() + " does not implement StepLocator");
    }
    StepLocator locator = (StepLocator) this.job;
    Step step = locator.getStep(stepName);
    if (step == null) {
      step = locator.getStep(this.job.getName() + "." + stepName);
    }
    if (step == null) {
      throw new IllegalStateException("No Step found with name: [" + stepName + "]");
    }
    return getStepRunner().launchStep(step, jobParameters, jobExecutionContext);
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.step.StepLocator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.