* for the latter like {@link #updatePassword(String, IProgressMonitor)}
*/
protected synchronized CloudFoundryOperations getClient(CloudCredentials credentials, IProgressMonitor monitor)
throws CoreException {
if (client == null) {
CloudFoundryServer cloudServer = getCloudFoundryServer();
String url = cloudServer.getUrl();
if (!cloudServer.hasCloudSpace()) {
throw CloudErrorUtil.toCoreException(NLS.bind(Messages.ERROR_FAILED_CLIENT_CREATION_NO_SPACE,
cloudServer.getServerId()));
}
CloudFoundrySpace cloudFoundrySpace = cloudServer.getCloudFoundrySpace();
if (credentials != null) {
client = createClient(url, credentials, cloudFoundrySpace, cloudServer.getSelfSignedCertificate());
}
else {
String userName = getCloudFoundryServer().getUsername();
String password = getCloudFoundryServer().getPassword();
client = createClient(url, userName, password, cloudFoundrySpace,
cloudServer.getSelfSignedCertificate());
}
}
return client;
}