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

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

Introduction

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

Prototype

Mono<String> getUserName();

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  a  v a2s.  c om*/

    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;
}