Hi Gui!<div><br></div><div>I just upgraded the code to work properly with latest Jersey release</div><div><br></div><div>Below the swift example code (just tested and working with HPCloud)</div><div><br></div><div>Hope it helps you :)</div>
<div><br></div><div>







<p class="p1">private<span class="s1"> </span>static<span class="s1"> </span>final<span class="s1"> File </span><span class="s2">TEST_FILE</span><span class="s1"> = </span>new<span class="s1"> File(</span><span class="s3">"pom.xml"</span><span class="s1">);</span></p>

<p class="p2"><span class="Apple-tab-span">     </span></p>
<p class="p3"><span class="s1"> </span><span class="s4">private</span><span class="s1"> </span><span class="s4">static</span><span class="s1"> </span><span class="s4">final</span><span class="s1"> String </span><span class="s2">KEYSTONE_AUTH_URL</span><span class="s1"> = </span>"<a href="https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0">https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0</a>"<span class="s1">;</span></p>

<p class="p2"><span class="Apple-tab-span">     </span></p>
<p class="p1"><span class="s1"> </span>private<span class="s1"> </span>static<span class="s1"> </span>final<span class="s1"> String </span><span class="s2">KEYSTONE_USERNAME</span><span class="s1"> = </span><span class="s3">""</span><span class="s1">;</span></p>

<p class="p2"><span class="Apple-tab-span">     </span></p>
<p class="p1"><span class="s1"> </span>private<span class="s1"> </span>static<span class="s1"> </span>final<span class="s1"> String </span><span class="s2">KEYSTONE_PASSWORD</span><span class="s1"> = </span><span class="s3">""</span><span class="s1">;</span></p>

<p class="p2"><br></p>
<p class="p4"><span class="s1"> </span>/**</p>
<p class="p4"><span class="Apple-tab-span">     </span> * <span class="s5">@param</span> args</p>
<p class="p4"><span class="Apple-tab-span">     </span> */</p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="s4">public</span> <span class="s4">static</span> <span class="s4">void</span> main(String[] args) <span class="s4">throws</span> Exception {</p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span>KeystoneClient keystone = <span class="s4">new</span> KeystoneClient(<span class="s2">KEYSTONE_AUTH_URL</span>);<span class="Apple-tab-span">  </span><span class="Apple-tab-span">      </span></p>

<p class="p6"><span class="s1"><span class="Apple-tab-span">    </span><span class="Apple-tab-span">      </span></span>//access with <span class="s6">unscoped</span> token</p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span>Access access = keystone.execute(Authenticate.withPasswordCredentials(<span class="s2">KEYSTONE_USERNAME</span>, <span class="s2">KEYSTONE_PASSWORD</span>));</p>

<p class="p2"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span></p>
<p class="p6"><span class="s1"><span class="Apple-tab-span">    </span><span class="Apple-tab-span">      </span></span>//use the token in the following requests</p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span>keystone.setToken(access.getToken().getId());</p>
<p class="p2"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span></p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span>Tenants tenants = keystone.execute(<span class="s4">new</span> ListTenants());</p>
<p class="p2"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span></p>
<p class="p6"><span class="s1"><span class="Apple-tab-span">    </span><span class="Apple-tab-span">      </span></span>//try to exchange token using the first tenant</p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="s4">if</span>(tenants.getList().size() > 0) {</p>
<p class="p2"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span></p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span>access = keystone.execute(Authenticate.withToken(access.getToken().getId()).withTenantId(tenants.getList().get(0).getId()));</p>

<p class="p2"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span></p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span>SwiftClient swiftClient = <span class="s4">new</span> SwiftClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), <span class="s3">"object-store"</span>, <span class="s4">null</span>, <span class="s3">"public"</span>), access.getToken().getId());</p>

<p class="p2"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span></p>
<p class="p6"><span class="s1"><span class="Apple-tab-span">    </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span></span>//swiftClient.execute(new DeleteContainer("navidad2"));</p>
<p class="p2"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span></p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span>swiftClient.execute(<span class="s4">new</span> CreateContainer(<span class="s3">"navidad2"</span>));</p>

<p class="p2"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span></p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span>System.<span class="s2">out</span>.println(swiftClient.execute(<span class="s4">new</span> ListContainers()));</p>

<p class="p2"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span></p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span>ObjectForUpload upload = <span class="s4">new</span> ObjectForUpload();</p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span>upload.setContainer(<span class="s3">"navidad2"</span>);</p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span>upload.setName(<span class="s3">"example2"</span>);</p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span>upload.setInputStream(<span class="s4">new</span> FileInputStream(<span class="s2">TEST_FILE</span>));</p>

<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span>swiftClient.execute(<span class="s4">new</span> UploadObject(upload));</p>
<p class="p2"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span></p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span>System.<span class="s2">out</span>.println(swiftClient.execute(<span class="s4">new</span> ListObjects(<span class="s3">"navidad2"</span>, <span class="s4">new</span> <span class="s6">HashMap<String, String>()</span> {{</p>

<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span>put(<span class="s3">"path"</span>, <span class="s3">""</span>);</p>

<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span>}})).get(0).getContentType());</p>
<p class="p2"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span><span class="Apple-tab-span">      </span></p>
<p class="p5"><span class="Apple-tab-span">     </span><span class="Apple-tab-span">      </span>}</p>
<p class="p2"><br></p>
<p class="p5"><span class="Apple-tab-span">     </span>}</p><br><div class="gmail_quote">On Wed, Jan 2, 2013 at 8:01 PM, Gui Maluf <span dir="ltr"><<a href="mailto:guimalufb@gmail.com" target="_blank">guimalufb@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>Hey guys, <br>I'm trying to extend a <a href="https://github.com/VirtualCloudDrive/CloudDrive" target="_blank">software project</a> to talk with Swift. <br>
<br>This project was developed on Scala, and my issue is: how should I access Swift resource? Should I use <a href="https://github.com/woorea/openstack-java-sdk/" target="_blank">openstack-java-sdk</a>, <a href="http://www.jclouds.org/documentation/quickstart/openstack/" target="_blank">jclouds</a> or develop my own library to access the REST API?<br>


I've tried to use openstack-java-sdk but I wasn't able to import the libraries exposed at examples.<br><br>I'm really confuse about that and I'll appreciate any help, hint, advice!<br><br></div>Thanks in advance.!<span class="HOEnZb"><font color="#888888"><br clear="all">


<div><div><br>-- <br><font face="Arial, Helvetica, sans-serif"><b>guilherme</b> \n<br>\<font>t</font> <b>maluf</b><br></font>
</div></div></font></span></div>
<br>_______________________________________________<br>
Mailing list: <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
Post to     : <a href="mailto:openstack@lists.launchpad.net">openstack@lists.launchpad.net</a><br>
Unsubscribe : <a href="https://launchpad.net/~openstack" target="_blank">https://launchpad.net/~openstack</a><br>
More help   : <a href="https://help.launchpad.net/ListHelp" target="_blank">https://help.launchpad.net/ListHelp</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>-------------------------------------------<br>Luis Alberto Gervaso Martin<div>Woorea Solutions, S.L<br>CEO & CTO<br>mobile: (+34) 627983344<br><a href="mailto:luis.gervaso@gmail.com" target="_blank">luis@</a><a href="http://woorea.es/" target="_blank">woorea.es</a></div>

</div>