Advertisement
Guest User

Untitled

a guest
Jan 28th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. Properties overrides = new Properties();
  2. overrides.setProperty(Constants.PROPERTY_ENDPOINT, CLOUD_SERVIE_ENDPOINT);
  3.  
  4. // get a context with nova that offers the portable ComputeService api
  5. BlobStoreContext context = new BlobStoreContextFactory().createContext("aws-s3", ident,
  6. password, ImmutableSet.<Module> of(), overrides);
  7.  
  8. Properties overrides = new Properties();
  9. overrides.setProperty("swift.endpoint", "http://1.1.1.1:8080/auth");
  10.  
  11. BlobStoreContext context = new BlobStoreContextFactory().createContext("swift", "XXXXXX:YYYYY", "password", ImmutableSet.<Module> of(), overrides);
  12.  
  13. import static org.jclouds.s3.reference.S3Constants.PROPERTY_S3_VIRTUAL_HOST_BUCKETS;
  14. ...
  15.  
  16. Properties overrides = new Properties();
  17. overrides.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "false");
  18.  
  19. BlobStore blobstore = ContextBuilder.newBuilder(new S3ApiMetadata()) // or "s3"
  20. .endpoint("http://host:port")
  21. .credentials(accessKey, secretKey)
  22. .overrides(overrides)
  23. .buildView(BlobStoreContext.class).getBlobStore();
  24.  
  25. import static org.jclouds.s3.reference.S3Constants.PROPERTY_S3_SERVICE_PATH;
  26. ...
  27.  
  28. overrides.setProperty(PROPERTY_S3_SERVICE_PATH, "/services/Walrus");
  29. ...
  30. .endpoint("http://host:port/services/Walrus")
  31.  
  32. String username = "test:tester";
  33. String password = "testing";
  34. Properties overrides = new Properties();
  35. overrides.setProperty(PROPERTY_S3_VIRTUAL_HOST_BUCKETS, "false");
  36.  
  37. BlobStoreContext context = ContextBuilder.newBuilder(new S3ApiMetadata())
  38. .endpoint("http://myserver:8080")
  39. .credentials(username, password)
  40. .overrides(overrides)
  41. .buildView(BlobStoreContext.class);
  42. BlobStore blobStore = context.getBlobStore();
  43. String bucket="public";
  44. blobStore.containerExists(bucket);
  45.  
  46. System.out.println("bucket exist "+ bucket);
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement