return 0;
}
@Override
public ConnectOperationOptions parseOptions(String[] operationArgs) throws Exception {
ConnectOperationOptions operationOptions = new ConnectOperationOptions();
OptionParser parser = new OptionParser();
OptionSpec<String> optionPlugin = parser.acceptsAll(asList("P", "plugin")).withRequiredArg();
OptionSpec<String> optionPluginOpts = parser.acceptsAll(asList("o", "plugin-option")).withRequiredArg();
OptionSpec<Void> optionAddDaemon = parser.acceptsAll(asList("n", "add-daemon"));
OptionSpec<String> optionPassword = parser.acceptsAll(asList("password")).withRequiredArg();
OptionSet options = parser.parse(operationArgs);
List<?> nonOptionArgs = options.nonOptionArguments();
// Set interactivity mode
isInteractive = !options.has(optionPlugin) && !options.has(optionPassword);
// Plugin
TransferSettings transferSettings = null;
if (nonOptionArgs.size() == 1) {
String connectLink = (String) nonOptionArgs.get(0);
operationOptions.setStrategy(ConnectOptionsStrategy.CONNECTION_LINK);
operationOptions.setConnectLink(connectLink);
transferSettings = null;
}
else if (nonOptionArgs.size() == 0) {
operationOptions.setStrategy(ConnectOptionsStrategy.CONNECTION_TO);
operationOptions.setConnectLink(null);
transferSettings = createTransferSettingsFromOptions(options, optionPlugin, optionPluginOpts);
}
else {
throw new Exception("Invalid syntax.");
}
ConfigTO configTO = createConfigTO(transferSettings);
operationOptions.setLocalDir(localDir);
operationOptions.setConfigTO(configTO);
operationOptions.setDaemon(options.has(optionAddDaemon));
operationOptions.setPassword(validateAndGetPassword(options, optionPassword));
return operationOptions;
}