if (blobStoreContext == null) {
String username = getConnectionCredentials().getIdentity();
String password = getConnectionCredentials().getCredential();
if (!StringUtils.hasText(username) || !StringUtils.hasText(password)) {
throw new InvalidCredentialsException("You must supply an identity/username for cloud connections.");
}
try {
blobStoreContext = ContextBuilder.newBuilder("aws-s3")
.credentials(username, password)
.modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()))
.buildView(BlobStoreContext.class);
} catch (AuthorizationException ae) {
throw new InvalidCredentialsException(ae);
}
}
return blobStoreContext;
}