Example #1
0
  void moveTo(AgentContext ctx, AgentState nextState) throws Exception {
    boolean found = false;
    int nextId = nextState.getId();

    for (int id : m_nextIds) {
      if (id == nextId) {
        found = true;
        break;
      }
    }

    if (!found) {
      throw new IllegalStateException(
          String.format("Can't move deploy state from %s to %s!", this, nextState));
    }

    doEpilog(ctx);
    nextState.doProlog(ctx);
    ctx.setState(nextState);
    nextState.doActivity(ctx);
  }
Example #2
0
  public static void execute(AgentContext ctx) throws Exception {
    AgentState initial = CREATED;

    ctx.setState(initial);
    initial.doActivity(ctx);
  }