// clean up any left over repository files
if ( ! keepreposdir.booleanValue()) {
FileUtils.whack(new File(env.getApplicationRepositoryPath(), VersioningUtils.getRepositoryName(name)));
}
ExtendedDeploymentContext deploymentContext = deployment.getBuilder(logger, this, report).source(archive).build();
// clean up any remaining generated files
deploymentContext.clean();
deploymentContext.getAppProps().putAll(appprops);
processGeneratedContent(generatedcontent, deploymentContext, logger);
Transaction t = null;
Application application = applications.getApplication(name);
if (application != null) {
// application element already been synchronized over
t = new Transaction();
} else {
t = deployment.prepareAppConfigChanges(deploymentContext);
}
ApplicationInfo appInfo;
appInfo = deployment.deploy(deploymentContext);
if (report.getActionExitCode()==ActionReport.ExitCode.SUCCESS) {
try {
moveAltDDFilesToPermanentLocation(deploymentContext, logger);
// register application information in domain.xml
if (application != null) {
// application element already synchronized over
// just write application-ref
deployment.registerAppInDomainXML(appInfo, deploymentContext, t, true);
} else {
// write both application and application-ref
deployment.registerAppInDomainXML(appInfo, deploymentContext, t);
}
} catch (Exception e) {
// roll back the deployment and re-throw the exception
deployment.undeploy(name, deploymentContext);
deploymentContext.clean();
throw e;
}
}
} catch (Throwable e) {
report.setActionExitCode(ActionReport.ExitCode.FAILURE);