Codota Logo
StringUtils.popOptionWithArgument
Code IndexAdd Codota to your IDE (free)

How to use
popOptionWithArgument
method
in
org.apache.hadoop.util.StringUtils

Best Java code snippets using org.apache.hadoop.util.StringUtils.popOptionWithArgument (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
origin: org.apache.hadoop/hadoop-common

@Override
protected void processOptions(LinkedList<String> args) throws IOException {
 name = StringUtils.popOptionWithArgument("-n", args);
 String v = StringUtils.popOptionWithArgument("-v", args);
 if (v != null) {
  value = XAttrCodec.decodeValue(v);
 }
 xname = StringUtils.popOptionWithArgument("-x", args);
 if (name != null && xname != null) {
  throw new HadoopIllegalArgumentException(
    "Can not specify both '-n name' and '-x name' option.");
 }
 if (name == null && xname == null) {
  throw new HadoopIllegalArgumentException(
    "Must specify '-n name' or '-x name' option.");
 }
 if (args.isEmpty()) {
  throw new HadoopIllegalArgumentException("<path> is missing.");
 }
 if (args.size() > 1) {
  throw new HadoopIllegalArgumentException("Too many arguments.");
 }
}
origin: org.apache.hadoop/hadoop-common

private int addSpanReceiver(List<String> args) throws IOException {
 String className = StringUtils.popOptionWithArgument("-class", args);
 if (className == null) {
  System.err.println("You must specify the classname with -class.");
origin: org.apache.hadoop/hadoop-common

@Override
public int run(String[] argv) throws Exception {
 List<String> args = new LinkedList<>(Arrays.asList(argv));
 String keytabName = popOptionWithArgument(ARG_KEYTAB, args);
 if (keytabName != null) {
  keytab = new File(keytabName);
 principal = popOptionWithArgument(ARG_PRINCIPAL, args);
 String outf = popOptionWithArgument(ARG_OUTPUT, args);
 String mkl = popOptionWithArgument(ARG_KEYLEN, args);
 if (mkl != null) {
  minKeyLength = Integer.parseInt(mkl);
 while (null != (resource = popOptionWithArgument(ARG_RESOURCE, args))) {
origin: org.apache.hadoop/hadoop-common

@Override
protected void processOptions(LinkedList<String> args) throws IOException {
 name = StringUtils.popOptionWithArgument("-n", args);
 String en = StringUtils.popOptionWithArgument("-e", args);
 if (en != null) {
  try {
   encoding = XAttrCodec.valueOf(StringUtils.toUpperCase(en));
  } catch (IllegalArgumentException e) {
   throw new IllegalArgumentException(
     "Invalid/unsupported encoding option specified: " + en);
  }
  Preconditions.checkArgument(encoding != null,
    "Invalid/unsupported encoding option specified: " + en);
 }
 boolean r = StringUtils.popOption("-R", args);
 setRecursive(r);
 dump = StringUtils.popOption("-d", args);
 if (!dump && name == null) {
  throw new HadoopIllegalArgumentException(
    "Must specify '-n name' or '-d' option.");
 }
 if (args.isEmpty()) {
  throw new HadoopIllegalArgumentException("<path> is missing.");
 }
 if (args.size() > 1) {
  throw new HadoopIllegalArgumentException("Too many arguments.");
 }
}
origin: org.apache.hadoop/hadoop-common

@Override
protected void processOptions(LinkedList<String> args) {
 this.timestamp =
   StringUtils.popOptionWithArgument("-" + OPTION_USE_TIMESTAMP, args);
 CommandFormat cf = new CommandFormat(1, Integer.MAX_VALUE,
   OPTION_USE_TIMESTAMP, OPTION_CHANGE_ONLY_ACCESS_TIME,
   OPTION_CHANGE_ONLY_MODIFICATION_TIME);
 cf.parse(args);
 this.changeModTime = cf.getOpt(OPTION_CHANGE_ONLY_MODIFICATION_TIME);
 this.changeAccessTime = cf.getOpt(OPTION_CHANGE_ONLY_ACCESS_TIME);
 this.doNotCreate = cf.getOpt(OPTION_DO_NOT_CREATE_FILE);
}
origin: org.apache.hadoop/hadoop-common

 return 0;
String hostPort = StringUtils.popOptionWithArgument("-host", args);
if (hostPort == null) {
 System.err.println("You must specify a host with -host.");
 return 1;
String servicePrincipal = StringUtils.popOptionWithArgument("-principal",
  args);
if (servicePrincipal != null) {
origin: org.apache.hadoop/hadoop-hdfs

 @Override
 public int run(Configuration conf, List<String> args) throws IOException {
  final String path = StringUtils.popOptionWithArgument("-path", args);
  if (!args.isEmpty()) {
   System.err.println("Can't understand argument: " + args.get(0));
   return 1;
  }
  Path p = new Path(path);
  HdfsAdmin admin = new HdfsAdmin(p.toUri(), conf);
  try {
   admin.provisionEncryptionZoneTrash(p);
   System.out.println("Created a trash directory for " + path);
  } catch (IOException ioe) {
   System.err.println(prettifyException(ioe));
   return 2;
  }
  return 0;
 }
}
origin: org.apache.hadoop/hadoop-hdfs

@Override
public int run(Configuration conf, List<String> args) throws IOException {
 final String path = StringUtils.popOptionWithArgument("-path", args);
 if (path == null) {
  System.err.println("You must specify a path with -path.");
   StringUtils.popOptionWithArgument("-keyName", args);
 if (keyName == null) {
  System.err.println("You must specify a key name with -keyName.");
origin: org.apache.hadoop/hadoop-hdfs

 @Override
 public int run(Configuration conf, List<String> args) throws IOException {
  final String path = StringUtils.popOptionWithArgument("-path", args);
  if (path == null) {
   System.err.println("Please specify the path from which "
     + "the storage policy will be unset.\nUsage: " + getLongUsage());
   return 1;
  }
  Path p = new Path(path);
  final FileSystem fs = FileSystem.get(p.toUri(), conf);
  try {
   fs.unsetStoragePolicy(p);
   System.out.println("Unset storage policy from " + path);
  } catch (Exception e) {
   System.err.println(AdminHelper.prettifyException(e));
   return 2;
  }
  return 0;
 }
}
origin: org.apache.hadoop/hadoop-hdfs

 @Override
 public int run(Configuration conf, List<String> args) throws IOException {
  final String path = StringUtils.popOptionWithArgument("-path", args);
  if (!args.isEmpty()) {
   System.err.println("Can't understand argument: " + args.get(0));
   return 1;
  }
  Path p = new Path(path);
  final HdfsAdmin admin =
    new HdfsAdmin(p.toUri(), conf);
  try {
   final FileEncryptionInfo fei =
     admin.getFileEncryptionInfo(p);
   if (fei == null) {
    System.err.println("No FileEncryptionInfo found for path " + path);
    return 2;
   }
   System.out.println(fei.toStringStable());
  } catch (IOException e) {
   System.err.println(prettifyException(e));
   return 3;
  }
  return 0;
 }
}
origin: org.apache.hadoop/hadoop-hdfs

 @Override
 public int run(Configuration conf, List<String> args) throws IOException {
  final String path = StringUtils.popOptionWithArgument("-path", args);
  if (path == null) {
   System.err.println("Please specify the path for setting the storage " +
     "policy.\nUsage: " + getLongUsage());
   return 1;
  }
  final String policyName = StringUtils.popOptionWithArgument("-policy",
    args);
  if (policyName == null) {
   System.err.println("Please specify the policy name.\nUsage: " +
     getLongUsage());
   return 1;
  }
  Path p = new Path(path);
  final FileSystem fs = FileSystem.get(p.toUri(), conf);
  try {
   fs.setStoragePolicy(p, policyName);
   System.out.println("Set storage policy " + policyName + " on " + path);
  } catch (Exception e) {
   System.err.println(AdminHelper.prettifyException(e));
   return 2;
  }
  return 0;
 }
}
origin: org.apache.hadoop/hadoop-hdfs

 @Override
 public int run(Configuration conf, List<String> args) throws IOException {
  final String path = StringUtils.popOptionWithArgument("-path", args);
  if (path == null) {
   System.err.println("Please specify the path for setting the storage " +
     "policy.\nUsage: " + getLongUsage());
   return 1;
  }
  final DistributedFileSystem dfs = AdminHelper.getDFS(conf);
  try {
   dfs.satisfyStoragePolicy(new Path(path));
   System.out.println("Scheduled blocks to move based on the current"
     + " storage policy on " + path);
  } catch (Exception e) {
   System.err.println(AdminHelper.prettifyException(e));
   return 2;
  }
  return 0;
 }
}
origin: org.apache.hadoop/hadoop-hdfs

/** Constructor */
SetSpaceQuotaCommand(String[] args, int pos, Configuration conf) {
 super(conf);
 CommandFormat c = new CommandFormat(2, Integer.MAX_VALUE);
 List<String> parameters = c.parse(args, pos);
 String str = parameters.remove(0).trim();
 try {
  quota = StringUtils.TraditionalBinaryPrefix.string2long(str);
 } catch (NumberFormatException nfe) {
  throw new IllegalArgumentException("\"" + str + "\" is not a valid value for a quota.");
 }
 String storageTypeString =
   StringUtils.popOptionWithArgument("-storageType", parameters);
 if (storageTypeString != null) {
  try {
   this.type = StorageType.parseStorageType(storageTypeString);
  } catch (IllegalArgumentException e) {
   throw new IllegalArgumentException("Storage type "
     + storageTypeString
     + " is not available. Available storage types are "
     + StorageType.getTypesSupportingQuota());
  }
 }
 this.args = parameters.toArray(new String[parameters.size()]);
}

origin: org.apache.hadoop/hadoop-hdfs

 @Override
 public int run(Configuration conf, List<String> args) throws IOException {
  final String ecPolicyName = StringUtils.popOptionWithArgument("-policy",
    args);
  if (ecPolicyName == null) {
   System.err.println("Please specify the policy name.\nUsage: " +
     getLongUsage());
   return 1;
  }
  if (args.size() > 0) {
   System.err.println(getName() + ": Too many arguments");
   return 1;
  }
  final DistributedFileSystem dfs = AdminHelper.getDFS(conf);
  try {
   dfs.disableErasureCodingPolicy(ecPolicyName);
   System.out.println("Erasure coding policy " + ecPolicyName +
     " is disabled");
  } catch (IOException e) {
   System.err.println(AdminHelper.prettifyException(e));
   return 2;
  }
  return 0;
 }
}
origin: org.apache.hadoop/hadoop-hdfs

 @Override
 public int run(Configuration conf, List<String> args) throws IOException {
  final String ecPolicyName = StringUtils.popOptionWithArgument(
    "-policy", args);
  if (ecPolicyName == null) {
   System.err.println("Please specify the policy name.\nUsage: " +
     getLongUsage());
   return 1;
  }
  if (args.size() > 0) {
   System.err.println(getName() + ": Too many arguments");
   return 1;
  }
  final DistributedFileSystem dfs = AdminHelper.getDFS(conf);
  try {
   dfs.removeErasureCodingPolicy(ecPolicyName);
   System.out.println("Erasure coding policy " + ecPolicyName +
     "is removed");
  } catch (IOException e) {
   System.err.println(AdminHelper.prettifyException(e));
   return 2;
  }
  return 0;
 }
}
origin: org.apache.hadoop/hadoop-hdfs

 @Override
 public int run(Configuration conf, List<String> args) throws IOException {
  final String path = StringUtils.popOptionWithArgument("-path", args);
  if (path == null) {
   System.err.println("Please specify the path with -path.\nUsage: " +
     getLongUsage());
   return 1;
  }
  if (args.size() > 0) {
   System.err.println(getName() + ": Too many arguments");
   return 1;
  }
  final Path p = new Path(path);
  final DistributedFileSystem dfs = AdminHelper.getDFS(p.toUri(), conf);
  try {
   ErasureCodingPolicy ecPolicy = dfs.getErasureCodingPolicy(p);
   if (ecPolicy != null) {
    System.out.println(ecPolicy.getName());
   } else {
    System.out.println("The erasure coding policy of " + path + " is " +
      "unspecified");
   }
  } catch (Exception e) {
   System.err.println(AdminHelper.prettifyException(e));
   return 2;
  }
  return 0;
 }
}
origin: org.apache.hadoop/hadoop-hdfs

 @Override
 public int run(Configuration conf, List<String> args) throws IOException {
  final String ecPolicyName = StringUtils.popOptionWithArgument("-policy",
    args);
  if (ecPolicyName == null) {
   System.err.println("Please specify the policy name.\nUsage: " +
     getLongUsage());
   return 1;
  }
  if (args.size() > 0) {
   System.err.println(getName() + ": Too many arguments");
   return 1;
  }
  final DistributedFileSystem dfs = AdminHelper.getDFS(conf);
  try {
   dfs.enableErasureCodingPolicy(ecPolicyName);
   System.out.println("Erasure coding policy " + ecPolicyName +
     " is enabled");
  } catch (IOException e) {
   System.err.println(AdminHelper.prettifyException(e));
   return 2;
  }
  return 0;
 }
}
origin: org.apache.hadoop/hadoop-hdfs

@Override
public int run(Configuration conf, List<String> args) throws IOException {
 final String path = StringUtils.popOptionWithArgument("-path", args);
 final boolean start = StringUtils.popOption("-start", args);
 final boolean cancel = StringUtils.popOption("-cancel", args);
origin: org.apache.hadoop/hadoop-hdfs

@Override
public int run(Configuration conf, List<String> args) throws IOException {
 final String filePath =
   StringUtils.popOptionWithArgument("-policyFile", args);
 if (filePath == null) {
  System.err.println("Please specify the path with -policyFile.\nUsage: "
origin: org.apache.hadoop/hadoop-hdfs

@Override
public int run(Configuration conf, List<String> args) throws IOException {
 final String path = StringUtils.popOptionWithArgument("-path", args);
 if (path == null) {
  System.err.println("Please specify a path.\nUsage: " + getLongUsage());
org.apache.hadoop.utilStringUtilspopOptionWithArgument

Javadoc

From a list of command-line arguments, remove both an option and the next argument.

Popular methods of StringUtils

  • stringifyException
    Make a string representation of the exception.
  • join
    Concatenates strings, using a separator.
  • split
  • arrayToString
  • toLowerCase
    Converts all of the characters in this String to lower case with Locale.ENGLISH.
  • escapeString
  • startupShutdownMessage
    Print a log message for starting up and shutting down
  • getStrings
    Returns an arraylist of strings.
  • toUpperCase
    Converts all of the characters in this String to upper case with Locale.ENGLISH.
  • byteToHexString
    Given an array of bytes it will convert the bytes to a hex string representation of the bytes
  • formatTime
    Given the time in long milliseconds, returns a String in the format Xhrs, Ymins, Z sec.
  • unEscapeString
  • formatTime,
  • unEscapeString,
  • getStringCollection,
  • byteDesc,
  • formatPercent,
  • getTrimmedStrings,
  • equalsIgnoreCase,
  • format,
  • formatTimeDiff,
  • getTrimmedStringCollection

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • getResourceAsStream (ClassLoader)
    Returns a stream for the resource with the specified name. See #getResource(String) for a descriptio
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • String (java.lang)
  • MessageFormat (java.text)
    MessageFormat provides a means to produce concatenated messages in language-neutral way. Use this to
  • JLabel (javax.swing)
  • JOptionPane (javax.swing)
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now