<div dir="ltr"><div><div><div>Luis, thanks for your quick reply! Seems I'm missing something very important, because I can't use all this classes/types(Access, Authenticate, Tenants, KeystoneUtils, ObjectForUpload,etc). <br>
I've installed the os-java-sdk in this way:<br><br>$ git clone<br></div>$ mvn compile package<br></div>$ find . -name '*.jar' -exec cp {} sbt_lib_dir/. \;<br></div><div>$ sbt console<br></div><div>> import org.openstack._<br>
<br></div><div>What am I doing wrong? What am I missing? <br>Is there a proper way to install the os-java-sdk?<br><br></div><div>Thank you very much! <br>With lots of regards.<br></div><div><br></div><br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, Jan 3, 2013 at 4:00 AM, Luis Gervaso <span dir="ltr"><<a href="mailto:luis@woorea.es" target="_blank">luis@woorea.es</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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>private<span> </span>static<span> </span>final<span> File </span><span>TEST_FILE</span><span> = </span>new<span> File(</span><span>"pom.xml"</span><span>);</span></p>
<p><span> </span></p>
<p><span> </span><span>private</span><span> </span><span>static</span><span> </span><span>final</span><span> String </span><span>KEYSTONE_AUTH_URL</span><span> = </span>"<a href="https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0" target="_blank">https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0</a>"<span>;</span></p>
<p><span> </span></p>
<p><span> </span>private<span> </span>static<span> </span>final<span> String </span><span>KEYSTONE_USERNAME</span><span> = </span><span>""</span><span>;</span></p>
<p><span> </span></p>
<p><span> </span>private<span> </span>static<span> </span>final<span> String </span><span>KEYSTONE_PASSWORD</span><span> = </span><span>""</span><span>;</span></p>
<p><br></p>
<p><span> </span>/**</p>
<p><span> </span> * <span>@param</span> args</p>
<p><span> </span> */</p>
<p><span> </span><span>public</span> <span>static</span> <span>void</span> main(String[] args) <span>throws</span> Exception {</p>
<p><span> </span><span> </span>KeystoneClient keystone = <span>new</span> KeystoneClient(<span>KEYSTONE_AUTH_URL</span>);<span> </span><span> </span></p>
<p><span><span> </span><span> </span></span>//access with <span>unscoped</span> token</p>
<p><span> </span><span> </span>Access access = keystone.execute(Authenticate.withPasswordCredentials(<span>KEYSTONE_USERNAME</span>, <span>KEYSTONE_PASSWORD</span>));</p>
<p><span> </span><span> </span></p>
<p><span><span> </span><span> </span></span>//use the token in the following requests</p>
<p><span> </span><span> </span>keystone.setToken(access.getToken().getId());</p>
<p><span> </span><span> </span></p>
<p><span> </span><span> </span>Tenants tenants = keystone.execute(<span>new</span> ListTenants());</p>
<p><span> </span><span> </span></p>
<p><span><span> </span><span> </span></span>//try to exchange token using the first tenant</p>
<p><span> </span><span> </span><span>if</span>(tenants.getList().size() > 0) {</p>
<p><span> </span><span> </span><span> </span></p>
<p><span> </span><span> </span><span> </span>access = keystone.execute(Authenticate.withToken(access.getToken().getId()).withTenantId(tenants.getList().get(0).getId()));</p>
<p><span> </span><span> </span><span> </span></p>
<p><span> </span><span> </span><span> </span>SwiftClient swiftClient = <span>new</span> SwiftClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(), <span>"object-store"</span>, <span>null</span>, <span>"public"</span>), access.getToken().getId());</p>
<p><span> </span><span> </span></p>
<p><span><span> </span><span> </span><span> </span></span>//swiftClient.execute(new DeleteContainer("navidad2"));</p>
<p><span> </span><span> </span><span> </span></p>
<p><span> </span><span> </span><span> </span>swiftClient.execute(<span>new</span> CreateContainer(<span>"navidad2"</span>));</p>
<p><span> </span><span> </span><span> </span></p>
<p><span> </span><span> </span><span> </span>System.<span>out</span>.println(swiftClient.execute(<span>new</span> ListContainers()));</p>
<p><span> </span><span> </span><span> </span></p>
<p><span> </span><span> </span><span> </span>ObjectForUpload upload = <span>new</span> ObjectForUpload();</p>
<p><span> </span><span> </span><span> </span>upload.setContainer(<span>"navidad2"</span>);</p>
<p><span> </span><span> </span><span> </span>upload.setName(<span>"example2"</span>);</p>
<p><span> </span><span> </span><span> </span>upload.setInputStream(<span>new</span> FileInputStream(<span>TEST_FILE</span>));</p>
<p><span> </span><span> </span><span> </span>swiftClient.execute(<span>new</span> UploadObject(upload));</p>
<p><span> </span><span> </span><span> </span></p>
<p><span> </span><span> </span><span> </span>System.<span>out</span>.println(swiftClient.execute(<span>new</span> ListObjects(<span>"navidad2"</span>, <span>new</span> <span>HashMap<String, String>()</span> {{</p>
<p><span> </span><span> </span><span> </span><span> </span>put(<span>"path"</span>, <span>""</span>);</p>
<p><span> </span><span> </span><span> </span>}})).get(0).getContentType());</p>
<p><span> </span><span> </span><span> </span></p>
<p><span> </span><span> </span>}</p>
<p><br></p>
<p><span> </span>}</p><br><div class="gmail_quote"><div><div class="h5">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>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><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><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></div></div>_______________________________________________<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" target="_blank">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><span class="HOEnZb"><font color="#888888"><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>
</font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><font face="Arial, Helvetica, sans-serif"><b>guilherme</b> \n<br>\<font>t</font> <b>maluf</b><br></font>
</div>