use of com.emc.rest.smart.ecs.Vdc in project ecs-dashboard by carone1.
the class ObjectBO method createS3ObjectClients.
private Map<String, S3JerseyClient> createS3ObjectClients(List<ObjectUserDetails> objectUserDetailsList, List<String> ecsObjectHosts) {
Map<String, S3JerseyClient> s3JerseyClientList = new HashMap<String, S3JerseyClient>();
// collect objects for all users
for (ObjectUserDetails objectUserDetails : objectUserDetailsList) {
if (objectUserDetails.getObjectUser().getUserId() == null || objectUserDetails.getSecretKeys().getSecretKey1() == null) {
// in that case we just skip over that user
continue;
}
// Create object client user
Vdc vdc = new Vdc((String[]) this.ecsObjectHosts.toArray());
S3Config s3config = new S3Config(Protocol.HTTP, vdc);
// in all cases, you need to provide your credentials
s3config.withIdentity(objectUserDetails.getObjectUser().getUserId().toString()).withSecretKey(objectUserDetails.getSecretKeys().getSecretKey1());
s3config.setSmartClient(true);
URLConnectionClientHandler urlHandler = new URLConnectionClientHandler();
S3JerseyClient s3JerseyClient = new S3JerseyClient(s3config, urlHandler);
s3JerseyClientList.put(objectUserDetails.getObjectUser().getUserId().toString(), s3JerseyClient);
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
logger.error(e.getLocalizedMessage());
}
return s3JerseyClientList;
}
Aggregations