{
notifyListeners(
getFormattedProgressWithLineBreak(INFO_SUMMARY_CANCELING.get()));
}
Installation installation = getInstallation();
FileManager fm = new FileManager(this);
// Stop the server if necessary
if (installation.getStatus().isServerRunning()) {
try {
if (!isVerbose())
{
notifyListeners(getFormattedWithPoints(
INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
}
new ServerController(installation).stopServer(!isVerbose());
if (!isVerbose())
{
notifyListeners(getFormattedDoneWithLineBreak());
}
} catch (ApplicationException e) {
LOG.log(Level.INFO, "error stopping server", e);
}
}
uninstallServices();
// Revert to the base configuration
try {
File newConfig = fm.copy(installation.getBaseConfigurationFile(),
installation.getConfigurationDirectory(),
/*overwrite=*/true);
fm.rename(newConfig, installation.getCurrentConfigurationFile());
} catch (ApplicationException ae) {
LOG.log(Level.INFO, "failed to restore base configuration", ae);
}
// Cleanup SSL if necessary
SecurityOptions sec = getUserData().getSecurityOptions();
if (sec.getEnableSSL() || sec.getEnableStartTLS()) {
if (SecurityOptions.CertificateType.SELF_SIGNED_CERTIFICATE.equals(
sec.getCertificateType())) {
CertificateManager cm = new CertificateManager(
getSelfSignedKeystorePath(),
CertificateManager.KEY_STORE_TYPE_JKS,
getSelfSignedCertificatePwd());
try {
cm.removeCertificate(SELF_SIGNED_CERT_ALIAS);
} catch (KeyStoreException e) {
LOG.log(Level.INFO, "Error deleting self signed certification", e);
}
}
File keystore = new File(installation.getConfigurationDirectory(),
"keystore");
if (keystore.exists()) {
try {
fm.delete(keystore);
} catch (ApplicationException e) {
LOG.log(Level.INFO, "Failed to delete keystore", e);
}
}
File keystorePin = new File(installation.getConfigurationDirectory(),
"keystore.pin");
if (keystorePin.exists()) {
try {
fm.delete(keystorePin);
} catch (ApplicationException e) {
LOG.log(Level.INFO, "Failed to delete keystore.pin", e);
}
}
File truststore = new File(installation.getConfigurationDirectory(),
"truststore");
if (truststore.exists()) {
try {
fm.delete(truststore);
} catch (ApplicationException e) {
LOG.log(Level.INFO, "Failed to delete truststore", e);
}
}
}
// Remove the databases
try {
fm.deleteChildren(installation.getDatabasesDirectory());
} catch (ApplicationException e) {
LOG.log(Level.INFO, "Error deleting databases", e);
}
if (!isVerbose())