| | |
| | | |
| | | import org.opends.quicksetup.CliApplicationHelper; |
| | | import org.opends.quicksetup.UserDataException; |
| | | import org.opends.quicksetup.CurrentInstallStatus; |
| | | import org.opends.server.util.args.ArgumentParser; |
| | | import org.opends.server.util.args.StringArgument; |
| | | import org.opends.server.util.args.ArgumentException; |
| | | |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | import java.io.File; |
| | | |
| | | /** |
| | | * Assists Upgrader utility in CLI drudgery. |
| | |
| | | * Creates a set of user data from command line arguments and installation |
| | | * status. |
| | | * @param args String[] of arguments passed in from the command line |
| | | * @param cis the current installation status |
| | | * @return UserData object populated to reflect the input args and status |
| | | * @throws UserDataException if something is wrong |
| | | */ |
| | | public UpgradeUserData createUserData(String[] args, CurrentInstallStatus cis) |
| | | public UpgradeUserData createUserData(String[] args) |
| | | throws UserDataException { |
| | | UpgradeUserData uud = new UpgradeUserData(); |
| | | ArgumentParser ap = createArgumentParser(); |
| | | try { |
| | | ap.parseArguments(args); |
| | | uud.setSilent(isSilent()); |
| | | uud.setNoninteractive(isNoninteractive()); |
| | | if (localInstallPackFileNameArg.isPresent()) { |
| | | String localInstallPackFileName = |
| | | localInstallPackFileNameArg.getValue(); |
| | | File installPackFile = new File(localInstallPackFileName); |
| | | if (!installPackFile.exists()) { |
| | | throw new UserDataException(null, |
| | | getMsg("build-extractor-error-file-no-exist", |
| | | localInstallPackFileName)); |
| | | } else { |
| | | uud.setInstallPackage(installPackFile); |
| | | } |
| | | } else { |
| | | // TODO: ask the user for this information if non noninteractive |
| | | throw new UserDataException(null, |
| | | getMsg("error-option-required", |
| | | "-" + FILE_OPTION_SHORT + "/--" + FILE_OPTION_LONG)); |
| | | } |
| | | uud.setInteractive(isInteractive()); |
| | | |
| | | // There is no need to check/validate the file argument |
| | | // since this is done by the BuildExtractor |
| | | |
| | | } catch (ArgumentException e) { |
| | | throw new UserDataException(null, getMsg("error-parsing-options")); |