Esempio n. 1
0
  /**
   * The main method for TaskInfo tool.
   *
   * @param args The command-line arguments provided to this program.
   */
  public static void main(String[] args) {
    int retCode = mainTaskInfo(args, System.in, System.out, System.err);

    if (retCode != 0) {
      System.exit(filterExitCode(retCode));
    }
  }
Esempio n. 2
0
  /**
   * The main method for ExportLDIF tool.
   *
   * @param args The command-line arguments provided to this program.
   */
  public static void main(String[] args) {
    int retCode = mainExportLDIF(args, true, System.out, System.err);

    if (retCode != 0) {
      System.exit(filterExitCode(retCode));
    }
  }
Esempio n. 3
0
    /** {@inheritDoc} */
    @Override
    public MenuResult<Void> invoke(ManageTasks app) throws ClientException {
      MenuResult<TaskEntry> res = new PrintTaskInfo(taskId).invoke(app);
      TaskEntry taskEntry = res.getValue();
      if (taskEntry != null) {
        while (true) {
          try {
            taskEntry = app.getTaskClient().getTaskEntry(taskId);

            // Show the menu
            MenuBuilder<TaskEntry> menuBuilder = new MenuBuilder<>(app);
            menuBuilder.addBackOption(true);
            menuBuilder.addCharOption(
                INFO_TASKINFO_CMD_REFRESH_CHAR.get(),
                INFO_TASKINFO_CMD_REFRESH.get(),
                new PrintTaskInfo(taskId));
            List<LocalizableMessage> logs = taskEntry.getLogMessages();
            if (logs != null && !logs.isEmpty()) {
              menuBuilder.addCharOption(
                  INFO_TASKINFO_CMD_VIEW_LOGS_CHAR.get(),
                  INFO_TASKINFO_CMD_VIEW_LOGS.get(),
                  new ViewTaskLogs(taskId));
            }
            if (taskEntry.isCancelable() && !taskEntry.isDone()) {
              menuBuilder.addCharOption(
                  INFO_TASKINFO_CMD_CANCEL_CHAR.get(),
                  INFO_TASKINFO_CMD_CANCEL.get(),
                  new CancelTask(taskId));
            }
            menuBuilder.addQuitOption();
            Menu<TaskEntry> menu = menuBuilder.toMenu();
            MenuResult<TaskEntry> result = menu.run();
            if (result.isCancel()) {
              break;
            } else if (result.isQuit()) {
              System.exit(0);
            }
          } catch (Exception e) {
            app.println(LocalizableMessage.raw(StaticUtils.getExceptionMessage(e)));
          }
        }
      } else {
        app.println(ERR_TASKINFO_UNKNOWN_TASK_ENTRY.get(taskId));
      }
      return MenuResult.success();
    }
Esempio n. 4
0
 /**
  * Provides the command-line arguments to the <CODE>configMain</CODE> method for processing.
  *
  * @param args The set of command-line arguments provided to this program.
  */
 public static void main(String[] args) {
   int exitCode = configMain(args, System.out, System.err);
   if (exitCode != 0) {
     System.exit(filterExitCode(exitCode));
   }
 }