use of org.apache.ignite.internal.commandline.cache.argument.ValidateIndexesCommandArg in project ignite by apache.
the class CacheValidateIndexes method parseArguments.
/**
* {@inheritDoc}
*/
@Override
public void parseArguments(CommandArgIterator argIter) {
int checkFirst = -1;
int checkThrough = -1;
UUID nodeId = null;
Set<String> caches = null;
boolean checkCrc = false;
boolean checkSizes = false;
while (argIter.hasNextSubArg()) {
String nextArg = argIter.nextArg("");
ValidateIndexesCommandArg arg = CommandArgUtils.of(nextArg, ValidateIndexesCommandArg.class);
if (arg == CHECK_FIRST || arg == CHECK_THROUGH) {
if (!argIter.hasNextSubArg())
throw new IllegalArgumentException("Numeric value for '" + nextArg + "' parameter expected.");
int numVal;
String numStr = argIter.nextArg("");
try {
numVal = Integer.parseInt(numStr);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException("Not numeric value was passed for '" + nextArg + "' parameter: " + numStr);
}
if (numVal <= 0)
throw new IllegalArgumentException("Value for '" + nextArg + "' property should be positive.");
if (arg == CHECK_FIRST)
checkFirst = numVal;
else
checkThrough = numVal;
continue;
} else if (arg == CHECK_CRC) {
checkCrc = true;
continue;
} else if (CHECK_SIZES == arg) {
checkSizes = true;
continue;
}
try {
nodeId = UUID.fromString(nextArg);
continue;
} catch (IllegalArgumentException ignored) {
// No-op.
}
caches = argIter.parseStringSet(nextArg);
}
args = new Arguments(caches, nodeId, checkFirst, checkThrough, checkCrc, checkSizes);
}
Aggregations