Package org.springframework.batch.core.job.flow

Examples of org.springframework.batch.core.job.flow.FlowExecutionException


                return null;
            }

            public FlowExecution resume(String stateName, FlowExecutor executor)
                    throws FlowExecutionException {
                throw new FlowExecutionException("Unexpected resume call");
            }

            public Collection<State> getStates() {
                return Collections.emptyList();
            }
View Full Code Here


                return null;
            }

            public FlowExecution start(FlowExecutor executor)
                    throws FlowExecutionException {
                throw new FlowExecutionException("Unexpected start call");
            }

            public FlowExecution resume(String stateName, FlowExecutor executor)
                    throws FlowExecutionException {
                return null;
View Full Code Here

   */
  private State findState(String stateName, FlowExecutionStatus status, StepExecution stepExecution) throws FlowExecutionException {
    Set<StateTransition> set = getTransitionMap().get(stateName);

    if (set == null) {
      throw new FlowExecutionException(String.format("No transitions found in flow=%s for state=%s", getName(),
          stateName));
    }

    String next = null;
    String exitCode = status.getName();
    for (StateTransition stateTransition : set) {
      if (stateTransition.matches(exitCode) || (exitCode.equals("PENDING") && stateTransition.matches("STOPPED"))) {
        if (stateTransition.isEnd()) {
          // End of job
          return null;
        }
        next = stateTransition.getNext();
        break;
      }
    }

    if (next == null) {
      if(stepExecution != null) {
        exitCode = stepExecution.getStatus().toString();

        for (StateTransition stateTransition : set) {
          if (stateTransition.matches(exitCode) || (exitCode.equals("PENDING") && stateTransition.matches("STOPPED"))) {
            if (stateTransition.isEnd()) {
              // End of job
              return null;
            }
            next = stateTransition.getNext();
            break;
          }
        }
      }

      if(next == null) {
        throw new FlowExecutionException(String.format(
            "Next state not found in flow=%s for state=%s with exit status=%s", getName(), stateName, status.getName()));
      }
    }

    if (!getStateMap().containsKey(next)) {
      throw new FlowExecutionException(String.format("Next state not specified in flow=%s for next=%s",
          getName(), next));
    }

    return getStateMap().get(next);
  }
View Full Code Here

        executor.close(new FlowExecution(stateName, status));
        throw e;
      }
      catch (Exception e) {
        executor.close(new FlowExecution(stateName, status));
        throw new FlowExecutionException(String.format("Ended flow=%s at state=%s with exception", name,
                                    stateName), e);
      }

      logger.debug("Completed state="+stateName+" with status="+status);
View Full Code Here

   */
  protected State nextState(String stateName, FlowExecutionStatus status, StepExecution stepExecution) throws FlowExecutionException {
    Set<StateTransition> set = transitionMap.get(stateName);

    if (set == null) {
      throw new FlowExecutionException(String.format("No transitions found in flow=%s for state=%s", getName(),
                                  stateName));
    }

    String next = null;
    String exitCode = status.getName();

    for (StateTransition stateTransition : set) {
      if (stateTransition.matches(exitCode) || (exitCode.equals("PENDING") && stateTransition.matches("STOPPED"))) {
        if (stateTransition.isEnd()) {
          // End of job
          return null;
        }
        next = stateTransition.getNext();
        break;
      }
    }

    if (next == null) {
      throw new FlowExecutionException(String.format("Next state not found in flow=%s for state=%s with exit status=%s", getName(), stateName, status.getName()));
    }

    if (!stateMap.containsKey(next)) {
      throw new FlowExecutionException(String.format("Next state not specified in flow=%s for next=%s",
                                  getName(), next));
    }

    return stateMap.get(next);

View Full Code Here

      try {
        taskExecutor.execute(task);
      }
      catch (TaskRejectedException e) {
        throw new FlowExecutionException("TaskExecutor rejected task for flow=" + flow.getName());
      }

    }

    Collection<FlowExecution> results = new ArrayList<FlowExecution>();
View Full Code Here

  /**
   * Test method for {@link FlowExecutionException#FlowExecutionException(String)}.
   */
  @Test
  public void testFlowExecutionExceptionString() {
    FlowExecutionException exception = new FlowExecutionException("foo");
    assertEquals("foo", exception.getMessage());
  }
View Full Code Here

  /**
   * Test method for {@link FlowExecutionException#FlowExecutionException(String, Throwable)}.
   */
  @Test
  public void testFlowExecutionExceptionStringThrowable() {
    FlowExecutionException exception = new FlowExecutionException("foo", new RuntimeException("bar"));
    assertEquals("foo", exception.getMessage());
    assertEquals("bar", exception.getCause().getMessage());
  }
View Full Code Here

TOP

Related Classes of org.springframework.batch.core.job.flow.FlowExecutionException

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.