use of org.apache.ignite.internal.commandline.defragmentation.DefragmentationSubcommands in project ignite by apache.
the class DefragmentationCommand method parseArguments.
/**
* {@inheritDoc}
*/
@Override
public void parseArguments(CommandArgIterator argIter) {
DefragmentationSubcommands cmd = DefragmentationSubcommands.of(argIter.nextArg("Expected defragmentation subcommand."));
if (cmd == null)
throw new IllegalArgumentException("Expected correct defragmentation subcommand.");
args = new DefragmentationArguments(cmd);
switch(cmd) {
case SCHEDULE:
List<String> consistentIds = null;
List<String> cacheNames = null;
String subarg;
do {
subarg = argIter.peekNextArg();
if (subarg == null)
break;
subarg = subarg.toLowerCase(Locale.ENGLISH);
switch(subarg) {
case NODES_ARG:
{
argIter.nextArg("");
Set<String> ids = argIter.nextStringSet(NODES_ARG);
if (ids.isEmpty())
throw new IllegalArgumentException("Consistent ids list is empty.");
consistentIds = new ArrayList<>(ids);
break;
}
case CACHES_ARG:
{
argIter.nextArg("");
Set<String> ids = argIter.nextStringSet(CACHES_ARG);
if (ids.isEmpty())
throw new IllegalArgumentException("Caches list is empty.");
cacheNames = new ArrayList<>(ids);
break;
}
default:
subarg = null;
}
} while (subarg != null);
if (consistentIds == null)
throw new IllegalArgumentException("--nodes argument is missing.");
args.setNodeIds(consistentIds);
args.setCacheNames(cacheNames);
break;
case STATUS:
case CANCEL:
}
}
Aggregations