result.setResult("Invalid Template directory");
} else {
Path templateApplicationsPath = templatePath.resolve(DOMAIN_APPLICATIONS_DIR);
Application application = domain.getApplication(applicationName);
if (application != null) {
ApplicationStatus status = application.getStatus();
if (status != null) {
Appcast appcast = status.getAppcast();
if (appcast != null) {
Set<Path> files = updater.update(applicationName, appcast, templateApplicationsPath);
result.setExitCodeOk();
result.setResult(files.toString());
}