// Stop the server if necessary. Task note as to whether the server
// is running since we will leave it in that state when we are done.
Installation installation = getInstallation();
Status status = installation.getStatus();
ServerController sc = new ServerController(installation);
if (status.isServerRunning()) {
restartServer = true;
sc = new ServerController(installation);
try {
setCurrentProgressStep(ReversionProgressStep.STOPPING_SERVER);
LOG.log(Level.INFO, "Stopping server");
if (isVerbose())
{
notifyListeners(getTaskSeparator());
}
else
{
notifyListeners(getFormattedWithPoints(
INFO_PROGRESS_STOPPING_NON_VERBOSE.get()));
}
sc.stopServer(!isVerbose());
if (!isVerbose())
{
notifyListeners(getFormattedDoneWithLineBreak());
}
else
{
notifyListeners(getLineBreak());
}
} catch (ApplicationException ae) {
runError = ae;
notifyListeners(getFormattedErrorWithLineBreak());
}
}
try {
setCurrentProgressStep(ReversionProgressStep.INITIALIZING);
initialize();
notifyListeners(getFormattedDoneWithLineBreak());
} catch (ApplicationException ae) {
LOG.log(Level.INFO, "Error initializing reversion", ae);
notifyListeners(getFormattedErrorWithLineBreak());
throw ae;
}
try {
LOG.log(Level.INFO, "Reverting components");
setCurrentProgressStep(ReversionProgressStep.REVERTING_FILESYSTEM);
revertComponents();
LOG.log(Level.INFO, "Finished reverting components");
notifyListeners(getFormattedDoneWithLineBreak());
} catch (ApplicationException ae) {
LOG.log(Level.INFO, "Error reverting components", ae);
notifyListeners(getFormattedErrorWithLineBreak());
throw ae;
}
if (restartServer) {
try {
LOG.log(Level.INFO, "Restarting server");
setCurrentProgressStep(ReversionProgressStep.STARTING_SERVER);
if (isVerbose())
{
notifyListeners(getTaskSeparator());
}
else
{
notifyListeners(getFormattedWithPoints(
INFO_PROGRESS_STARTING_NON_VERBOSE.get()));
}
sc.startServer(!isVerbose());
if (!isVerbose())
{
notifyListeners(getFormattedDoneWithLineBreak());
}
else