Example usage for org.springframework.ide.eclipse.boot.dash.cloudfoundry.deployment CloudApplicationDeploymentProperties toPushArguments

List of usage examples for org.springframework.ide.eclipse.boot.dash.cloudfoundry.deployment CloudApplicationDeploymentProperties toPushArguments

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.dash.cloudfoundry.deployment CloudApplicationDeploymentProperties toPushArguments.

Prototype

public CFPushArguments toPushArguments(List<CFCloudDomain> cloudDomains) throws Exception 

Source Link

Usage

From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.CloudAppDashElement.java

public void push(CloudApplicationDeploymentProperties deploymentProperties, RunState runningOrDebugging,
        DebugSupport debugSupport, CancelationToken cancelationToken, UserInteractions ui,
        IProgressMonitor monitor) throws Exception {

    boolean isDebugging = runningOrDebugging == RunState.DEBUGGING;
    whileStarting(ui, cancelationToken, monitor, () -> {
        // Refresh app data and check that the application (still) exists in
        // Cloud Foundry
        // This also ensures that the 'diff change dialog' will pick up on
        // the latest changes.
        // TODO: should this refresh be moved closer to the where we
        // actually compute the diff?
        CloudAppDashElement updatedApp = this.refresh();
        if (updatedApp == null) {
            ExceptionUtil.coreException(new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID,
                    "No Cloud Application found for '" + getName() + "'"));
        }/*from   ww  w  . j  ava 2s. c  om*/
        IProject project = getProject();
        if (project == null) {
            ExceptionUtil.coreException(new Status(IStatus.ERROR, BootDashActivator.PLUGIN_ID,
                    "Local project not associated to CF app '" + getName() + "'"));
        }

        checkTerminationRequested(cancelationToken, monitor);

        CloudApplicationDeploymentProperties properties = deploymentProperties == null
                ? getCloudModel().resolveDeploymentProperties(updatedApp, ui, monitor)
                : deploymentProperties;

        // Update JAVA_OPTS env variable with Remote DevTools Client secret
        DevtoolsUtil.setupEnvVarsForRemoteClient(properties.getEnvironmentVariables(),
                DevtoolsUtil.getSecret(project));
        if (debugSupport != null) {
            if (isDebugging) {
                debugSupport.setupEnvVars(properties.getEnvironmentVariables());
            } else {
                debugSupport.clearEnvVars(properties.getEnvironmentVariables());
            }
        }

        checkTerminationRequested(cancelationToken, monitor);

        CFPushArguments pushArgs = properties.toPushArguments(getCloudModel().getCloudDomains(monitor));

        getClient().push(pushArgs, CancelationTokens.merge(cancelationToken, monitor));

        log("Application pushed to Cloud Foundry: " + getName());
    });
}