Search in sources :

Example 1 with Vdc

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;
}
Also used : S3Config(com.emc.object.s3.S3Config) S3JerseyClient(com.emc.object.s3.jersey.S3JerseyClient) ObjectUserDetails(com.emc.ecs.management.entity.ObjectUserDetails) Vdc(com.emc.rest.smart.ecs.Vdc) HashMap(java.util.HashMap) URLConnectionClientHandler(com.sun.jersey.client.urlconnection.URLConnectionClientHandler)

Aggregations

ObjectUserDetails (com.emc.ecs.management.entity.ObjectUserDetails)1 S3Config (com.emc.object.s3.S3Config)1 S3JerseyClient (com.emc.object.s3.jersey.S3JerseyClient)1 Vdc (com.emc.rest.smart.ecs.Vdc)1 URLConnectionClientHandler (com.sun.jersey.client.urlconnection.URLConnectionClientHandler)1 HashMap (java.util.HashMap)1