Package com.woorea.openstack.swift

Examples of com.woorea.openstack.swift.Swift


    //try to exchange token using the first tenant
    if(tenants.getList().size() > 0) {
     
      access = keystone.tokens().authenticate(new TokenAuthentication(access.getToken().getId())).withTenantId(tenants.getList().get(0).getId()).execute();
     
      Swift swift = new Swift(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), "object-store", null, "public"));
      swift.setTokenProvider(new OpenStackSimpleTokenProvider(access.getToken().getId()));
   
      //swiftClient.execute(new DeleteContainer("navidad2"));
     
      swift.containers().create("navidad2").execute();
     
      System.out.println(swift.containers().list());
     
      ObjectForUpload upload = new ObjectForUpload();
      upload.setContainer("navidad2");
      upload.setName("example2");
      upload.setInputStream(new FileInputStream(TEST_FILE));
      swift.containers().container("navidad2").upload(upload).execute();
     
//      System.out.println(swiftClient.execute(new ListObjects("navidad2", new HashMap<String, String>() {{
//        put("path", "");
//      }})).get(0).getContentType());
     
     
      ObjectDownload download = swift.containers().container("navidad").download("example2").execute();
      write(download.getInputStream(), "example2");
    }

  }
View Full Code Here

TOP

Related Classes of com.woorea.openstack.swift.Swift

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.