| | |
| | | import java.io.OutputStream; |
| | | import java.io.PrintStream; |
| | | import java.security.KeyStoreException; |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.LinkedList; |
| | | import java.util.logging.Level; |
| | |
| | | CONTINUE(1), |
| | | // Provide information again |
| | | PROVIDE_INFORMATION_AGAIN(2), |
| | | // Display equivalent command-line |
| | | PRINT_EQUIVALENT_COMMAND_LINE(3), |
| | | // Cancel the install |
| | | CANCEL(3); |
| | | |
| | |
| | | return ErrorReturnCode.ERROR_USER_DATA.getReturnCode(); |
| | | } |
| | | } |
| | | if (isInteractive()) |
| | | boolean promptAgain = true; |
| | | if (!isInteractive()) |
| | | { |
| | | userApproved = true; |
| | | } |
| | | else |
| | | { |
| | | printSummary(uData); |
| | | } |
| | | while (isInteractive() && promptAgain) |
| | | { |
| | | promptAgain = false; |
| | | ConfirmCode confirm = askForConfirmation(uData); |
| | | switch (confirm) |
| | | { |
| | |
| | | case CANCEL: |
| | | LOG.log(Level.INFO, "User cancelled setup."); |
| | | return ErrorReturnCode.ERROR_USER_CANCELLED.getReturnCode(); |
| | | case PRINT_EQUIVALENT_COMMAND_LINE: |
| | | printEquivalentCommandLine(uData); |
| | | promptAgain = true; |
| | | break; |
| | | default: |
| | | // Reset the arguments |
| | | try |
| | |
| | | userApproved = false; |
| | | } |
| | | } |
| | | else |
| | | if (!isInteractive()) |
| | | { |
| | | userApproved = true; |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * This method asks the user to confirm to continue the setup. It basically |
| | | * displays the information provided by the user and at the end proposes a |
| | | * menu with the different options to choose from. |
| | | * It displays the information provided by the user. |
| | | * @param uData the UserData that the user provided. |
| | | * @return the answer provided by the user: cancel setup, continue setup or |
| | | * provide information again. |
| | | */ |
| | | private ConfirmCode askForConfirmation(UserData uData) |
| | | private void printSummary(UserData uData) |
| | | { |
| | | ConfirmCode returnValue; |
| | | |
| | | println(); |
| | | println(); |
| | | println(INFO_INSTALLDS_SUMMARY.get()); |
| | |
| | | println(INFO_INSTALLDS_DO_NOT_ENABLE_WINDOWS_SERVICE.get()); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private void printEquivalentCommandLine(UserData uData) |
| | | { |
| | | println(); |
| | | |
| | | println(INFO_INSTALL_SETUP_EQUIVALENT_COMMAND_LINE.get()); |
| | | println(); |
| | | ArrayList<String> cmd = Utils.getSetupEquivalentCommandLine(uData); |
| | | println(Message.raw( |
| | | Utils.getFormattedEquivalentCommandLine(cmd, formatter))); |
| | | } |
| | | |
| | | /** |
| | | * This method asks the user to confirm to continue the setup. It basically |
| | | * displays the information provided by the user and at the end proposes a |
| | | * menu with the different options to choose from. |
| | | * @param uData the UserData that the user provided. |
| | | * @return the answer provided by the user: cancel setup, continue setup or |
| | | * provide information again. |
| | | */ |
| | | private ConfirmCode askForConfirmation(UserData uData) |
| | | { |
| | | ConfirmCode returnValue; |
| | | |
| | | println(); |
| | | println(); |
| | |
| | | Message[] msgs = new Message[] { |
| | | INFO_INSTALLDS_CONFIRM_INSTALL.get(), |
| | | INFO_INSTALLDS_PROVIDE_DATA_AGAIN.get(), |
| | | INFO_INSTALLDS_PRINT_EQUIVALENT_COMMAND_LINE.get(), |
| | | INFO_INSTALLDS_CANCEL.get() |
| | | }; |
| | | |