public static void runSubCommand()

in odps-console-dship/src/main/java/com/aliyun/odps/ship/DShip.java [64:126]


  public static void runSubCommand(CommandType type, String[] args)
      throws Throwable {
    String sid = null;
    try {
      switch (type) {
        case upload:
          OptionsBuilder.buildUploadOption(args);
          DshipUpdate uploader = new DshipUpdate(new TunnelUploadSession());
          sid = uploader.getTunnelSessionId();
          uploader.upload();
          break;
        case download:
          OptionsBuilder.buildDownloadOption(args);
          DshipDownload downloader = new DshipDownload();
          downloader.download();
          break;
        case upsert:
          OptionsBuilder.buildUpsertOption(args);
          DshipUpdate upserter = new DshipUpdate(new TunnelUpsertSession());
          sid = upserter.getTunnelSessionId();
          upserter.upload();
          break;
        case resume:
          resume(args);
          break;
        case show:
          show(args);
          break;
        case purge:
          purge(args);
          break;
        case help:
          help(args);
          break;
        default:
          throw new IllegalArgumentException(Constants.ERROR_INDICATOR + "Unknown command");
      }
    } catch(UserInterruptException e) {
      throw(e);
    } catch (IllegalArgumentException e) {
      logException(sid, e);
      throw(e);
    } catch (FileNotFoundException e) {
      logException(sid, e);
      throw(e);
    } catch (TunnelException e) {
      logExceptionWithCause(sid, Constants.ERROR_INDICATOR + "TunnelException - ", e);
      throw(e);
    } catch (OdpsException e) {
      logExceptionWithCause(sid, Constants.ERROR_INDICATOR + "OdpsException - ", e);
      throw(e);
    } catch (IOException e) {
      logExceptionWithCause(sid, Constants.ERROR_INDICATOR + "IOException - ", e);
      throw(e);
    } catch (ParseException e) {
      logException(sid, e);
      throw(e);
    } catch (Throwable e) {
      logException(
          sid, new Exception(Constants.ERROR_INDICATOR + "Unknown error - " + e.getMessage(), e));
      throw(e);
    }
  }