Package org.apache.commons.cli

Examples of org.apache.commons.cli.MissingArgumentException


      setDebugging(cl.hasOption(debugOption.getLongOpt()));
      authTimeout = Integer.parseInt(cl.getOptionValue(authTimeoutOpt.getLongOpt(), DEFAULT_AUTH_TIMEOUT)) * 60 * 1000;
      disableAuthTimeout = cl.hasOption(disableAuthTimeoutOpt.getLongOpt());
     
      if (cl.hasOption(zooKeeperInstance.getOpt()) && cl.getOptionValues(zooKeeperInstance.getOpt()).length != 2)
        throw new MissingArgumentException(zooKeeperInstance);
     
    } catch (Exception e) {
      configError = true;
      printException(e);
      printHelp("shell", SHELL_DESCRIPTION, opts);
      return true;
    }
   
    // get the options that were parsed
    String sysUser = System.getProperty("user.name");
    if (sysUser == null)
      sysUser = "root";
    String user = cl.getOptionValue(usernameOption.getOpt(), sysUser);
   
    String passw = cl.getOptionValue(passwOption.getOpt(), null);
    tabCompletion = !cl.hasOption(tabCompleteOption.getLongOpt());
    String[] loginOptions = cl.getOptionValues(loginOption.getOpt());
   
    // Use a fake (Mock), ZK, or HdfsZK Accumulo instance
    setInstance(cl);
   
    // process default parameters if unspecified
    try {
      if (loginOptions != null && !cl.hasOption(tokenOption.getOpt()))
        throw new IllegalArgumentException("Must supply '-" + tokenOption.getOpt() + "' option with '-" + loginOption.getOpt() + "' option");
     
      if (loginOptions == null && cl.hasOption(tokenOption.getOpt()))
        throw new IllegalArgumentException("Must supply '-" + loginOption.getOpt() + "' option with '-" + tokenOption.getOpt() + "' option");
     
      if (passw != null && cl.hasOption(tokenOption.getOpt()))
        throw new IllegalArgumentException("Can not supply '-" + passwOption.getOpt() + "' option with '-" + tokenOption.getOpt() + "' option");
     
      if (user == null)
        throw new MissingArgumentException(usernameOption);
     
      if (loginOptions != null && cl.hasOption(tokenOption.getOpt())) {
        Properties props = new Properties();
        for (String loginOption : loginOptions)
          for (String lo : loginOption.split(",")) {
            String[] split = lo.split("=");
            props.put(split[0], split[1]);
          }
       
        this.token = Class.forName(cl.getOptionValue(tokenOption.getOpt())).asSubclass(AuthenticationToken.class).newInstance();
        this.token.init(props);
      }
     
      if (!cl.hasOption(fakeOption.getLongOpt())) {
        DistributedTrace.enable(instance, new ZooReader(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut()), "shell", InetAddress.getLocalHost()
            .getHostName());
      }
     
      Runtime.getRuntime().addShutdownHook(new Thread() {
        @Override
        public void start() {
          reader.getTerminal().enableEcho();
        }
      });
     
      if (passw != null) {
        this.token = new PasswordToken(passw);
      }
     
      if (this.token == null) {
        passw = readMaskedLine("Password: ", '*');
        if (passw != null)
          this.token = new PasswordToken(passw);
      }
     
      if (this.token == null) {
        reader.printNewline();
        throw new MissingArgumentException("No password or token option supplied");
      } // user canceled
     
      this.setTableName("");
      this.principal = user;
      connector = instance.getConnector(this.principal, token);
View Full Code Here


    final PrintFile printFile = getOutputFile(cl);
   
    final String tableName = OptUtil.getTableOpt(cl, shellState);
   
    if (cl.getArgList().isEmpty()) {
      throw new MissingArgumentException("No terms specified");
    }
    final Class<? extends Formatter> formatter = getFormatter(cl, tableName, shellState);
    final ScanInterpreter interpeter = getInterpreter(cl, tableName, shellState);
   
    // handle first argument, if present, the authorizations list to
View Full Code Here

          splits.add(decode ? new Text(Base64.decodeBase64(line.getBytes(Constants.UTF8))) : new Text(line));
        }
      }
    } else {
      if (cl.getArgList().isEmpty()) {
        throw new MissingArgumentException("No split points specified");
      }
      for (String s : cl.getArgs()) {
        splits.add(new Text(s.getBytes(Shell.CHARSET)));
      }
    }
View Full Code Here

      setDebugging(cl.hasOption(debugOption.getLongOpt()));
      authTimeout = Integer.parseInt(cl.getOptionValue(authTimeoutOpt.getLongOpt(), DEFAULT_AUTH_TIMEOUT)) * 60 * 1000;
      disableAuthTimeout = cl.hasOption(disableAuthTimeoutOpt.getLongOpt());

      if (cl.hasOption(zooKeeperInstance.getOpt()) && cl.getOptionValues(zooKeeperInstance.getOpt()).length != 2)
        throw new MissingArgumentException(zooKeeperInstance);

    } catch (Exception e) {
      configError = true;
      printException(e);
      printHelp("shell", SHELL_DESCRIPTION, opts);
View Full Code Here

          splits.add(decode ? new Text(Base64.decodeBase64(line.getBytes())) : new Text(line));
        }
      }
    } else {
      if (cl.getArgList().isEmpty()) {
        throw new MissingArgumentException("No split points specified");
      }
      for (String s : cl.getArgs()) {
        splits.add(new Text(s.getBytes(Shell.CHARSET)));
      }
    }
View Full Code Here

          splits.add(decode ? new Text(Base64.decodeBase64(line.getBytes(Constants.UTF8))) : new Text(line));
        }
      }
    } else {
      if (cl.getArgList().isEmpty()) {
        throw new MissingArgumentException("No split points specified");
      }
      for (String s : cl.getArgs()) {
        splits.add(new Text(s.getBytes(Shell.CHARSET)));
      }
    }
View Full Code Here

    public int execute(String fullCommand, CommandLine cl, Shell shellState) throws AccumuloException, AccumuloSecurityException, TableNotFoundException,
        IOException, MissingArgumentException {
      shellState.checkTableState();
     
      if (cl.getArgList().isEmpty())
        throw new MissingArgumentException("No terms specified");
     
      // handle first argument, if present, the authorizations list to
      // scan with
      int numThreads = 20;
      if (cl.hasOption(numThreadsOpt.getOpt())) {
View Full Code Here

          if (!line.isEmpty())
            splits.add(decode ? new Text(Base64.decodeBase64(line.getBytes())) : new Text(line));
        }
      } else {
        if (cl.getArgList().isEmpty())
          throw new MissingArgumentException("No split points specified");
       
        for (String s : cl.getArgs()) {
          splits.add(new Text(s));
        }
      }
View Full Code Here

      setDebugging(cl.hasOption(debugOption.getLongOpt()));
      authTimeout = Integer.parseInt(cl.getOptionValue(authTimeoutOpt.getLongOpt(), DEFAULT_AUTH_TIMEOUT)) * 60 * 1000;
      disableAuthTimeout = cl.hasOption(disableAuthTimeoutOpt.getLongOpt());
     
      if (cl.hasOption(zooKeeperInstance.getOpt()) && cl.getOptionValues(zooKeeperInstance.getOpt()).length != 2)
        throw new MissingArgumentException(zooKeeperInstance);
     
    } catch (Exception e) {
      configError = true;
      printException(e);
      printHelp("shell", SHELL_DESCRIPTION, opts);
View Full Code Here

      setDebugging(cl.hasOption(debugOption.getLongOpt()));
      authTimeout = Integer.parseInt(cl.getOptionValue(authTimeoutOpt.getLongOpt(), DEFAULT_AUTH_TIMEOUT)) * 60 * 1000;
      disableAuthTimeout = cl.hasOption(disableAuthTimeoutOpt.getLongOpt());
     
      if (cl.hasOption(zooKeeperInstance.getOpt()) && cl.getOptionValues(zooKeeperInstance.getOpt()).length != 2)
        throw new MissingArgumentException(zooKeeperInstance);
     
    } catch (Exception e) {
      configError = true;
      printException(e);
      printHelp("shell", SHELL_DESCRIPTION, opts);
View Full Code Here

TOP

Related Classes of org.apache.commons.cli.MissingArgumentException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.