当前位置: 首页>>代码示例>>Java>>正文


Java CommandFormat类代码示例

本文整理汇总了Java中org.apache.hadoop.fs.shell.CommandFormat的典型用法代码示例。如果您正苦于以下问题:Java CommandFormat类的具体用法?Java CommandFormat怎么用?Java CommandFormat使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CommandFormat类属于org.apache.hadoop.fs.shell包,在下文中一共展示了CommandFormat类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processOptions

import org.apache.hadoop.fs.shell.CommandFormat; //导入依赖的package包/类
@Override
protected void processOptions(LinkedList<String> args) throws IOException {
  CommandFormat cf = new CommandFormat(2, Integer.MAX_VALUE, "R", null);
  cf.parse(args);
  setRecursive(cf.getOpt("R"));

  String modeStr = args.removeFirst();
  try {
    pp = new ChmodParser(modeStr);
  } catch (IllegalArgumentException iea) {
    // TODO: remove "chmod : " so it's not doubled up in output, but it's
    // here for backwards compatibility...
    throw new IllegalArgumentException(
        "chmod : mode '" + modeStr + "' does not match the expected pattern.");      
  }
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:17,代码来源:FsShellPermissions.java

示例2: checkArgLimits

import org.apache.hadoop.fs.shell.CommandFormat; //导入依赖的package包/类
private static <T> CommandFormat checkArgLimits(
    Class<? extends IllegalArgumentException> expectedErr,
    int min, int max, String ... opts)
{
  CommandFormat cf = new CommandFormat(min, max, opts);
  List<String> parsedArgs = new ArrayList<String>(args);
  
  Class<?> cfError = null;
  try {
    cf.parse(parsedArgs);
  } catch (IllegalArgumentException e) {
    System.out.println(e.getMessage());
    cfError = e.getClass();
  }

  assertEquals(expectedErr, cfError);
  if (expectedErr == null) {
    assertEquals(expectedArgs, parsedArgs);
    assertEquals(expectedOpts, cf.getOpts());
  }
  return cf;
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:23,代码来源:TestCommandFormat.java

示例3: SetSpaceQuotaCommand

import org.apache.hadoop.fs.shell.CommandFormat; //导入依赖的package包/类
/** Constructor */
SetSpaceQuotaCommand(String[] args, int pos, FileSystem fs) {
  super(fs);
  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) {
    this.type = StorageType.parseStorageType(storageTypeString);
  }
  
  this.args = parameters.toArray(new String[parameters.size()]);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:20,代码来源:DFSAdmin.java

示例4: SetSpaceQuotaCommand

import org.apache.hadoop.fs.shell.CommandFormat; //导入依赖的package包/类
/** Constructor */
SetSpaceQuotaCommand(String[] args, int pos, FileSystem fs) {
  super(fs);
  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()]);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:26,代码来源:DFSAdmin.java

示例5: processOptions

import org.apache.hadoop.fs.shell.CommandFormat; //导入依赖的package包/类
@Override
protected void processOptions(LinkedList<String> args) throws IOException {
  CommandFormat cf =
      new CommandFormat(1, Integer.MAX_VALUE, OPTION_FOLLOW_LINK,
          OPTION_FOLLOW_ARG_LINK, null);
  cf.parse(args);

  if (cf.getOpt(OPTION_FOLLOW_LINK)) {
    getOptions().setFollowLink(true);
  } else if (cf.getOpt(OPTION_FOLLOW_ARG_LINK)) {
    getOptions().setFollowArgLink(true);
  }

  // search for first non-path argument (ie starts with a "-") and capture and
  // remove the remaining arguments as expressions
  LinkedList<String> expressionArgs = new LinkedList<String>();
  Iterator<String> it = args.iterator();
  boolean isPath = true;
  while (it.hasNext()) {
    String arg = it.next();
    if (isPath) {
      if (arg.startsWith("-")) {
        isPath = false;
      }
    }
    if (!isPath) {
      expressionArgs.add(arg);
      it.remove();
    }
  }

  if (args.isEmpty()) {
    args.add(Path.CUR_DIR);
  }

  Expression expression = parseExpression(expressionArgs);
  if (!expression.isAction()) {
    Expression and = getExpression(And.class);
    Deque<Expression> children = new LinkedList<Expression>();
    children.add(getExpression(Print.class));
    children.add(expression);
    and.addChildren(children);
    expression = and;
  }

  setRootExpression(expression);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:48,代码来源:Find.java

示例6: ClearQuotaCommand

import org.apache.hadoop.fs.shell.CommandFormat; //导入依赖的package包/类
/** Constructor */
ClearQuotaCommand(String[] args, int pos, FileSystem fs) {
  super(fs);
  CommandFormat c = new CommandFormat(1, Integer.MAX_VALUE);
  List<String> parameters = c.parse(args, pos);
  this.args = parameters.toArray(new String[parameters.size()]);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:DFSAdmin.java

示例7: SetQuotaCommand

import org.apache.hadoop.fs.shell.CommandFormat; //导入依赖的package包/类
/** Constructor */
SetQuotaCommand(String[] args, int pos, FileSystem fs) {
  super(fs);
  CommandFormat c = new CommandFormat(2, Integer.MAX_VALUE);
  List<String> parameters = c.parse(args, pos);
  this.quota = Long.parseLong(parameters.remove(0));
  this.args = parameters.toArray(new String[parameters.size()]);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:DFSAdmin.java

示例8: ClearSpaceQuotaCommand

import org.apache.hadoop.fs.shell.CommandFormat; //导入依赖的package包/类
/** Constructor */
ClearSpaceQuotaCommand(String[] args, int pos, FileSystem fs) {
  super(fs);
  CommandFormat c = new CommandFormat(1, Integer.MAX_VALUE);
  List<String> parameters = c.parse(args, pos);
  String storageTypeString =
      StringUtils.popOptionWithArgument("-storageType", parameters);
  if (storageTypeString != null) {
    this.type = StorageType.parseStorageType(storageTypeString);
  }
  this.args = parameters.toArray(new String[parameters.size()]);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:DFSAdmin.java

示例9: ClearSpaceQuotaCommand

import org.apache.hadoop.fs.shell.CommandFormat; //导入依赖的package包/类
/** Constructor */
ClearSpaceQuotaCommand(String[] args, int pos, FileSystem fs) {
  super(fs);
  CommandFormat c = new CommandFormat(1, Integer.MAX_VALUE);
  c.addOptionWithValue("storageType");
  List<String> parameters = c.parse(args, pos);
  String storageTypeString = c.getOptValue("storageType");
  if (storageTypeString != null) {
    this.type = StorageType.parseStorageType(storageTypeString);
  }
  this.args = parameters.toArray(new String[parameters.size()]);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:13,代码来源:DFSAdmin.java


注:本文中的org.apache.hadoop.fs.shell.CommandFormat类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。