| | |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | import java.util.Collections; |
| | | import java.util.logging.Level; |
| | | import java.util.logging.Logger; |
| | | import java.io.IOException; |
| | | |
| | | /** |
| | | * The class used to provide some CLI interface in the uninstall. |
| | |
| | | */ |
| | | class UninstallCliHelper extends CliApplicationHelper { |
| | | |
| | | static private final Logger LOG = |
| | | Logger.getLogger(UninstallCliHelper.class.getName()); |
| | | |
| | | static private String FORMAT_KEY = "cli-uninstall-confirm-prompt"; |
| | | |
| | | /** |
| | |
| | | /* Step 2: If this is not a silent install ask for confirmation to delete |
| | | * the different parts of the installation |
| | | */ |
| | | Set<String> outsideDbs = getOutsideDbs(installStatus); |
| | | Set<String> outsideLogs = getOutsideLogs(installStatus); |
| | | Set<String> outsideDbs; |
| | | Set<String> outsideLogs; |
| | | Configuration config = |
| | | Installation.getLocal().getCurrentConfiguration(); |
| | | try { |
| | | outsideDbs = config.getOutsideDbs(); |
| | | } catch (IOException ioe) { |
| | | outsideDbs = Collections.emptySet(); |
| | | LOG.log(Level.INFO, "error determining outside databases", ioe); |
| | | } |
| | | |
| | | try { |
| | | outsideLogs = config.getOutsideLogs(); |
| | | } catch (IOException ioe) { |
| | | outsideLogs = Collections.emptySet(); |
| | | LOG.log(Level.INFO, "error determining outside logs", ioe); |
| | | } |
| | | |
| | | if (silentUninstall) |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Returns a Set of relative paths containing the db paths outside the |
| | | * installation. |
| | | * @param installStatus the Current Install Status object. |
| | | * @return a Set of relative paths containing the db paths outside the |
| | | * installation. |
| | | */ |
| | | private Set<String> getOutsideDbs(CurrentInstallStatus installStatus) |
| | | { |
| | | return Utils.getOutsideDbs(installStatus); |
| | | } |
| | | |
| | | /** |
| | | * Returns a Set of relative paths containing the log paths outside the |
| | | * installation. |
| | | * @param installStatus the Current Install Status object. |
| | | * @return a Set of relative paths containing the log paths outside the |
| | | * installation. |
| | | */ |
| | | private Set<String> getOutsideLogs(CurrentInstallStatus installStatus) |
| | | { |
| | | return Utils.getOutsideLogs(installStatus); |
| | | } |
| | | |
| | | /** |
| | | * Commodity method used to ask the user to confirm the deletion of certain |
| | | * parts of the server. It updates the provided UserData object |
| | | * accordingly. Returns <CODE>true</CODE> if the user cancels and <CODE> |
| | |
| | | throws UserDataException |
| | | { |
| | | boolean cancelled = false; |
| | | |
| | | if (CurrentInstallStatus.isServerRunning()) |
| | | Status status = Installation.getLocal().getStatus(); |
| | | if (status.isServerRunning()) |
| | | { |
| | | if (!silentUninstall) |
| | | { |
| | |
| | | if (!cancelled) |
| | | { |
| | | /* During all the confirmations, the server might be stopped. */ |
| | | userData.setStopServer(CurrentInstallStatus.isServerRunning()); |
| | | userData.setStopServer(status.isServerRunning()); |
| | | } |
| | | } |
| | | else |