.untagForAutomaticRepublish(module);
if (repModule != null) {
ApplicationDeploymentInfo republishDeploymentInfo = repModule.getDeploymentInfo();
if (republishDeploymentInfo != null) {
DeploymentInfoWorkingCopy copy = appModule.resolveDeploymentInfoWorkingCopy(monitor);
copy.setInfo(republishDeploymentInfo);
copy.save();
}
}
// Validate the existing deployment info. Do NOT save or make changes to
// the deployment info prior to this stage
// (for example, saving a working copy of the deployment info with
// default values), unless it was done so for a module that is being
// republished, as if the deployment info is valid,
// the wizard will not open. We want the deployment wizard to ALWAYS
// open when deploying an application for the first time (i.e the app
// will not have
// a deployment info set), even if we have to populate that deployment
// info with default values or values from the manifest file. The latter
// should only occur AFTER the handler decides to open the wizard.
if (!appModule.validateDeploymentInfo().isOK()) {
// Any application that can be pushed to a CF server
// MUST have a delegate
// which knows how to configure that application. If no
// delegate is found,
// the application is not currently deployable to a CF
// server. In that case, a delegate
// may be required to be registered for that application
// type.
final ApplicationWizardDelegate providerDelegate = ApplicationWizardRegistry.getWizardProvider(appModule
.getLocalModule());
if (providerDelegate == null) {
throw CloudErrorUtil.toCoreException("Failed to open application deployment wizard for: " //$NON-NLS-1$
+ appModule.getDeployedApplicationName() + " when attempting to push application to " //$NON-NLS-1$
+ server.getServer().getName()
+ ". No application provider found that corresponds to the application type: " //$NON-NLS-1$
+ appModule.getLocalModule().getModuleType().getId());
}
// Now parse the manifest file, if it exists, and load into a
// deployment info working copy.
// Do NOT save the working copy yet, as a user may cancel the
// operation from the wizard.
// THe working copy should only be saved by the wizard if a user
// clicks "OK".
DeploymentInfoWorkingCopy workingCopy = null;
try {
workingCopy = new ManifestParser(appModule, server).load(monitor);
}
catch (Throwable ce) {
// Some failure occurred reading the manifest file. Proceed
// anyway, to allow the user to manually enter deployment
// values.
CloudFoundryPlugin.logError(ce);
}
// A working copy of the deployment descriptor is needed in order to
// prepopulate the application deployment wizard.
if (workingCopy == null) {
workingCopy = appModule.resolveDeploymentInfoWorkingCopy(monitor);
}
// Get the old working copy in case during the deployment wizard,
// the app name changes
// Apps are looked up by app name in the manifest, therefore if the
// app name changed,
// the old entry in the manifest
ApplicationDeploymentInfo oldInfo = workingCopy.copy();
final boolean[] cancelled = { false };
final boolean[] writeToManifest = { false };
final IStatus[] status = { Status.OK_STATUS };
final DeploymentInfoWorkingCopy finWorkingCopy = workingCopy;
final DeploymentConfiguration[] configuration = new DeploymentConfiguration[1];
Display.getDefault().syncExec(new Runnable() {
public void run() {
CloudFoundryApplicationWizard wizard = new CloudFoundryApplicationWizard(server, appModule,