Package org.cloudfoundry.ide.eclipse.server.core.internal.application

Examples of org.cloudfoundry.ide.eclipse.server.core.internal.application.ManifestParser


    // initial push, or through start/update restart)
    // so it will keep manifest reading I/O only to these cases, rather than
    // on deployment info update, which occurs on
    // every refresh.
    if (archivePath == null) {
      archivePath = new ManifestParser(appModule, cloudServer)
          .getApplicationProperty(null, ManifestParser.PATH_PROP);
    }

    File packagedFile = null;
    if (archivePath != null) {
View Full Code Here


    if (appModule == null) {
      return;
    }

    if (saveManifest != null) {
      ManifestParser parser = new ManifestParser(appModule, cloudServer);
      if (!parser.canWriteToManifest()) {
        saveManifest.setEnabled(false);
        saveManifest.setToolTipText(Messages.ApplicationDetailsPart_TEXT_MANIFEST_SAVE_CREATE_TOOLTIP);
      }
      else {
        saveManifest.setEnabled(true);
View Full Code Here

                // point
                // to
                // the updated services
                serverBehaviour.refreshApplicationBoundServices(appModule, monitor);

                ManifestParser parser = new ManifestParser(appModule, cloudServer);
                parser.write(monitor, null);
              }
              catch (CoreException ce) {
                errorStatus[0] = ce.getStatus();
                return errorStatus[0];
              }
View Full Code Here

      // 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,
              finWorkingCopy, providerDelegate);

          try {
            // Update the lookup
            ApplicationUrlLookupService.update(server, monitor);
            WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getModalDialogShellProvider()
                .getShell(), wizard);
            int dialogueStatus = dialog.open();

            if (dialogueStatus == Dialog.OK) {

              // First add any new services to the server
              final List<CloudService> addedServices = wizard.getCloudServicesToCreate();
              writeToManifest[0] = wizard.persistManifestChanges();
              configuration[0] = wizard.getDeploymentConfiguration();

              if (addedServices != null && !addedServices.isEmpty()) {
                IProgressMonitor subMonitor = new SubProgressMonitor(monitor, addedServices.size());
                try {
                  server.getBehaviour().createService(addedServices.toArray(new CloudService[0]),
                      subMonitor);
                }
                catch (CoreException e) {
                  // Do not let service creation errors
                  // stop the application deployment
                  CloudFoundryPlugin.log(e);
                }
                finally {
                  subMonitor.done();
                }
              }

            }
            else {
              cancelled[0] = true;
            }
          }
          catch (Throwable t) {
            // Any error in the wizard should result in the module
            // being deleted (i.e. cancelled)
            cancelled[0] = true;
            status[0] = CloudFoundryPlugin.getErrorStatus(t);
          }
        }
      });

      if (cancelled[0]) {
        if (!status[0].isOK()) {
          CloudFoundryPlugin.logError("Failed to deploy application due to: " + status[0].getMessage(), //$NON-NLS-1$
              status[0].getException());
        }
        throw new OperationCanceledException();
      }
      else {
        if (status[0].isOK()) {
          status[0] = appModule.validateDeploymentInfo();
        }
        if (!status[0].isOK()) {
          throw new CoreException(status[0]);
        }
        else if (writeToManifest[0]) {

          IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
          try {
            new ManifestParser(appModule, server).write(subMonitor, oldInfo);
          }
          catch (Throwable ce) {
            // Do not let this error propagate, as failing to write
            // to the manifest should not stop the app's deployment
            CloudFoundryPlugin.logError(ce);
View Full Code Here

TOP

Related Classes of org.cloudfoundry.ide.eclipse.server.core.internal.application.ManifestParser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.