本文整理汇总了Java中org.apache.hadoop.fs.shell.CommandFormat.parse方法的典型用法代码示例。如果您正苦于以下问题:Java CommandFormat.parse方法的具体用法?Java CommandFormat.parse怎么用?Java CommandFormat.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.fs.shell.CommandFormat
的用法示例。
在下文中一共展示了CommandFormat.parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.");
}
}
示例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;
}
示例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()]);
}
示例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()]);
}
示例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);
}
示例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()]);
}
示例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()]);
}
示例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()]);
}
示例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()]);
}
示例10: 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.");
}
this.args = parameters.toArray(new String[parameters.size()]);
}
示例11: 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, "f", "r", "R", "skipTrash");
cf.parse(args);
ignoreFNF = cf.getOpt("f");
deleteDirs = cf.getOpt("r") || cf.getOpt("R");
skipTrash = cf.getOpt("skipTrash");
}
示例12: 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");
cf.parse(args);
setRecursive(cf.getOpt("R"));
parseOwnerGroup(args.removeFirst());
}
示例13: 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);
this.args = parameters.toArray(new String[parameters.size()]);
}
示例14: 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()]);
}
示例15: 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.");
}
this.args = parameters.toArray(new String[parameters.size()]);
}