private static void parseCmdLineArgs()

in ruta-ep-ide-ui/src/main/java/org/apache/uima/ruta/ide/launching/RutaLauncher.java [80:166]


  private static void parseCmdLineArgs(String[] args)  {
    int index = 0;
    
    while (index < args.length) {
      String each = args[index++];
      if (RutaLaunchConstants.INPUT_FOLDER.equals(each)) {
        if (index >= args.length) {
          throwException("Not enough arguments! Value of input folder is missing", args, null);
        }
        String in = args[index++];
        try {
          inputFolder = new File(URLDecoder.decode(in, URL_ENCODING));
        } catch (UnsupportedEncodingException e) {
          throwException("Unable to decode input folder argument: " + in, args, e);
        }
      } else if (RutaLaunchConstants.OUTPUT_FOLDER.equals(each)) {
        if (index >= args.length) {
          throwException("Not enough arguments! Value of output folder is missing", args, null);
        }
        String out = args[index++];
        try {
          outputFolder = new File(URLDecoder.decode(out, URL_ENCODING));
        } catch (UnsupportedEncodingException e) {
          throwException("Unable to decode output folder argument: " + out, args, e);
        }
      } else if (RutaLaunchConstants.DESCRIPTOR.equals(each)) {
        if (index >= args.length) {
          throwException("Not enough arguments! Value of descriptor is missing", args, null);
        }
        String desc = args[index++];
        if(desc!= null && desc.equals("null")) {
          throwException("Value for descriptor is missing", args, null);
        }
        try {
          descriptor = new File(URLDecoder.decode(desc, URL_ENCODING));
        } catch (UnsupportedEncodingException e) {
          throwException("Unable to decode descriptor argument: " + desc, args, e);
        }
      } else if (RutaLaunchConstants.RECURSIVE.equals(each)) {
        if (index >= args.length) {
          throwException("Not enough arguments! Value of recursive folder structure is missing", args, null);
        }
        inputRecursive = Boolean.parseBoolean(args[index++]);
      } else if (RutaLaunchConstants.ADD_SDI.equals(each)) {
        if (index >= args.length) {
          throwException("Not enough arguments! Value of adding source document information is missing", args, null);
        }
        addSDI = Boolean.parseBoolean(args[index++]);
      } else if (RutaLaunchConstants.ENCODING.equals(each)) {
        if (index >= args.length) {
          throwException("Not enough arguments! Value of encoding is missing", args, null);
        }
        inputEncoding = args[index++];
      } else if (RutaLaunchConstants.MODE.equals(each)) {
        if (index >= args.length) {
          throwException("Not enough arguments! Value of run mode is missing", args, null);
        }
        launchMode = args[index++];
      } else if (RutaLaunchConstants.VIEW.equals(each)) {
        if (index >= args.length) {
          throwException("Not enough arguments! Value of CAS view is missing", args, null);
        }
        view = args[index++];
      } else if (RutaLaunchConstants.FORMAT.equals(each)) {
        if (index >= args.length) {
          throwException("Not enough arguments! Value of serialization format is missing", args, null);
        }
        serialFormat = args[index++];
      } else if (RutaLaunchConstants.CLASSPATH.equals(each)) {
        if (index >= args.length) {
          throwException("Not enough arguments! Value of classpath is missing", args, null);
        }
        String cp = args[index++];
        try {
          classPath =  URLDecoder.decode(cp, URL_ENCODING);
        } catch (UnsupportedEncodingException e) {
          throwException("Unable to decode classpath argument: " + cp, args, e);
        }
      }
    }
    if(descriptor == null) {
      throwException("Argument for descriptor is missing", args, null);
    }
    if(inputFolder == null) {
      throwException("Argument for input folder is missing", args, null);
    }
  }