@Override
 public void done(String message, Exception e) {
   if (emitOutput) {
     System.out.println(
         '\n'
             + "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-");
     System.out.println("  RunBook : " + runbook.getRunBookPath() + "  |  " + " State : COMPLETE");
     System.out.println("  Error Reason :");
     e.printStackTrace();
     System.out.println(
         "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-"
             + '\n');
   }
   try {
     execStatus.setEndTime(System.currentTimeMillis());
     // TODO: handle exception later.
     execStatus.setComplete(true);
     execStatus.setFinerStatus(message);
     execStatus.setState(ExecState.FAILED);
     store.update(execStatus);
     store.done();
   } finally {
     barrier.release(blockingKey);
   }
 }
 @Override
 public StepExecutionStatus pausedItem(DtRunbookItem runbookItem) {
   StepExecutionStatus itemStatus = new StepExecutionStatus(runbookItem.getItemId());
   itemStatus.setStartTime(System.currentTimeMillis());
   itemStatus.setState(ExecState.PAUSED);
   execStatus.addItemStatus(runbookItem.getItemId(), itemStatus);
   store.update(execStatus);
   return itemStatus;
 }
 @Override
 public StepExecutionStatus resumedItem(DtRunbookItem runbookItem) {
   StepExecutionStatus itemStatus =
       (StepExecutionStatus) execStatus.getItemStatus(runbookItem.getItemId());
   itemStatus.setComplete(false);
   itemStatus.setState(ExecState.RESUMED);
   store.update(itemStatus);
   return itemStatus;
 }
 @Override
 public void done(String message) {
   if (emitOutput) {
     System.out.println(
         '\n'
             + "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-");
     System.out.println("  RunBook : " + runbook.getRunBookPath() + "  |  " + " COMPLETE");
     System.out.println(
         "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-"
             + '\n');
   }
   try {
     execStatus.setEndTime(System.currentTimeMillis());
     execStatus.setComplete(true);
     execStatus.setState(didLatestStepFail() ? ExecState.FAILED : ExecState.SUCCESSFUL);
     execStatus.setFinerStatus(message);
     store.update(execStatus);
     store.done();
   } finally {
     barrier.release(blockingKey);
   }
 }
 @Override
 public void started() {
   if (emitOutput) {
     System.out.println(
         '\n'
             + "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-");
     System.out.println("  RunBook : " + runbook.getRunBookPath() + "  |  " + " STARTED");
     System.out.println(
         "-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-"
             + '\n');
   }
   execStatus.setStartTime(System.currentTimeMillis());
   store.create(execStatus);
 }
  @Override
  public StepExecutionStatus completedItem(DtRunbookItem runbookItem) {
    StepExecutionStatus itemStatus =
        (StepExecutionStatus) execStatus.getItemStatus(runbookItem.getItemId());
    itemStatus.setComplete(true);
    itemStatus.setEndTime(System.currentTimeMillis());
    System.out.println(
        '\n'
            + "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -");
    System.out.println("  Step : " + runbookItem.getId() + "  |  " + " COMPLETE");
    System.out.println(
        "-----------------------------------------------------------------------------------"
            + '\n');

    store.update(execStatus);
    return itemStatus;
  }
  @Override
  public StepExecutionStatus executingItem(DtRunbookItem runbookItem) {
    if (emitOutput) {
      System.out.println(
          '\n'
              + "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-");
      System.out.println("  Step : " + runbookItem.getId() + "  |  " + " STARTED");
      System.out.println(
          "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
              + '\n');
    }

    StepExecutionStatus itemStatus = new StepExecutionStatus(runbookItem.getItemId());
    itemStatus.setStartTime(System.currentTimeMillis());
    execStatus.addItemStatus(runbookItem.getItemId(), itemStatus);
    store.create(itemStatus);
    return itemStatus;
  }