List of usage examples for org.springframework.ide.eclipse.boot.dash.cloudfoundry CloudFoundryTargetProperties setUserName
public void setUserName(String value)
From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.CloudFoundryTargetWizardModel.java
/** * Create target properties based on current input values in the wizard. * <p>// w ww. ja v a 2 s . c om * Note that there are two slightly different ways to produce these properties. * <p> * a) to create a intermediate client just to fetch orgs and spaces. * <p> * b) the final properties used to create the client after space is selected and the user * clicks 'finish' button. */ private CloudFoundryTargetProperties createTargetProperties(boolean toFetchSpaces) throws CannotAccessPropertyException { CloudFoundryTargetProperties targetProps = new CloudFoundryTargetProperties(runTargetType, context); if (!toFetchSpaces) { //Take care: when fetching spaces the space may not be known yet, so neither is the id String id = CloudFoundryTargetProperties.getId(this.getUsername(), this.getUrl(), this.getOrganizationName(), this.getSpaceName()); targetProps.put(TargetProperties.RUN_TARGET_ID, id); } targetProps.setUrl(url.getValue()); targetProps.setSelfSigned(selfsigned.getValue()); targetProps.setSkipSslValidation(skipSslValidation.getValue()); targetProps.setUserName(userName.getValue()); if (toFetchSpaces) { targetProps.setStoreCredentials(StoreCredentialsMode.STORE_NOTHING); targetProps.setCredentials(CFCredentials.fromLogin(method.getValue(), password.getValue())); } else { //use credentials of a style that is consistent with the 'store mode'. if (method.getValue() == LoginMethod.TEMPORARY_CODE && storeCredentials.getValue() == StoreCredentialsMode.STORE_PASSWORD) { //The one token shouldn't be stored since its meaningless. Silently downgrade storemode to store storeCredentials.setValue(StoreCredentialsMode.STORE_NOTHING); } StoreCredentialsMode mode = storeCredentials.getValue(); targetProps.setStoreCredentials(storeCredentials.getValue()); switch (mode) { case STORE_NOTHING: case STORE_TOKEN: Assert.isTrue(refreshToken != null); targetProps.setCredentials(CFCredentials.fromRefreshToken(refreshToken)); break; case STORE_PASSWORD: targetProps.setCredentials(CFCredentials.fromPassword(password.getValue())); break; default: throw new IllegalStateException("BUG: Missing switch case?"); } } targetProps.setSpace(space.getValue()); return targetProps; }