Example usage for org.springframework.ide.eclipse.boot.dash.cloudfoundry.client ClientRequests getSpaces

List of usage examples for org.springframework.ide.eclipse.boot.dash.cloudfoundry.client ClientRequests getSpaces

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.dash.cloudfoundry.client ClientRequests getSpaces.

Prototype

List<CFSpace> getSpaces() throws Exception;

Source Link

Usage

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

private OrgsAndSpaces getCloudSpaces(final CloudFoundryTargetProperties targetProperties,
        IRunnableContext context) throws Exception {

    OrgsAndSpaces spaces = null;//from  w w w  .j  ava2  s  . c o  m

    Operation<List<CFSpace>> op = new Operation<List<CFSpace>>(
            "Connecting to the Cloud Foundry target. Please wait while the list of spaces is resolved...") {
        protected List<CFSpace> runOp(IProgressMonitor monitor) throws Exception, OperationCanceledException {
            ClientRequests client = clientFactory.getClient(targetProperties);
            List<CFSpace> spaces = client.getSpaces();
            String t = client.getRefreshToken();
            if (t != null) {
                refreshToken = t;
            }
            String effectiveUser = client.getUserName().block();
            if (effectiveUser != null) {
                userName.setValue(effectiveUser);
            }
            return spaces;
        }
    };

    List<CFSpace> actualSpaces = op.run(context, true);
    if (actualSpaces != null && !actualSpaces.isEmpty()) {
        spaces = new OrgsAndSpaces(actualSpaces);
    }

    return spaces;
}