Example usage for org.springframework.ide.eclipse.boot.dash.cloudfoundry CloudFoundryBootDashModel removeApplication

List of usage examples for org.springframework.ide.eclipse.boot.dash.cloudfoundry CloudFoundryBootDashModel removeApplication

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.dash.cloudfoundry CloudFoundryBootDashModel removeApplication.

Prototype

public void removeApplication(String appName) 

Source Link

Usage

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

/**
 * Attempt to refresh the data associated with this app in the model. Returns the
 * refreshed element if this was succesful, null if the element was deleted (because during the
 * refresh we discovered it not longer exists) and if something failed trying to refresh the element.
 *///  ww w.  j av a  2 s  .  c om
public CloudAppDashElement refresh() throws Exception {
    debug("Refreshing element: " + this.getName());
    CFApplicationDetail data = getClient().getApplication(getName());
    if (data == null) {
        //Looks like element no longer exist in CF so remove it from the model
        CloudFoundryBootDashModel model = getCloudModel();
        model.removeApplication(getName());
        return null;
    }
    getCloudModel().updateApplication(data);
    return this;
}

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

@Override
public void delete(UserInteractions ui) {
    CloudFoundryBootDashModel model = getCloudModel();
    CloudAppDashElement cloudElement = this;
    cloudElement.cancelOperations();/*  w ww .j  a  va2s .  co  m*/
    CancelationToken cancelToken = cloudElement.createCancelationToken();
    CloudApplicationOperation operation = new CloudApplicationOperation("Deleting: " + cloudElement.getName(),
            model, cloudElement.getName(), cancelToken) {

        @Override
        protected void doCloudOp(IProgressMonitor monitor) throws Exception, OperationCanceledException {
            // Delete from CF first. Do it outside of synch block to avoid
            // deadlock
            model.getRunTarget().getClient().deleteApplication(appName);
            model.getElementConsoleManager().terminateConsole(cloudElement.getName());
            model.removeApplication(cloudElement.getName());
            cloudElement.setProject(null);
        }
    };

    // Allow deletions to occur concurrently with any other application
    // operation
    operation.setSchedulingRule(null);
    getCloudModel().runAsynch(operation, ui);
}