<div dir="ltr"><div><div>Hey Luis,<br>after making a Java-eclipse-maven working example I've copied all jar used by this project in my scala lib dir and bang. The library is working great! I done the example that you sent in Scala and I was able to create and list container, upload an object, but not list object cause I don't know how to make this line<br>
<br>System.<span>out</span>.println(swiftClient.execute(<span>new</span> ListObjects(<span>"navidad2"</span>, <span>new</span> <span>HashMap<String, String>()</span> {{put(<span>"path"</span>, <span>""</span>);}})).get(0).getContentType());<br>
<br></div>in scala.<br><br></div><div>These are the libraries I've managed to make the openstack-java-sdk work in scala! :)<br></div><div><pre>asm-all-repackaged-2.1.51.jar hk2-locator-2.1.51.jar jackson-mapper-asl-1.9.8.jar javax.ws.rs-api-2.0-m15.jar junit-3.8.1.jar osgi-resource-locator-1.0.1.jar
cglib-2.1.51.jar hk2-utils-2.1.51.jar jackson-xc-1.9.8.jar jersey-client-2.0-SNAPSHOT.jar keystone-client-2.0.0-SNAPSHOT.jar swift-client-2.0.0-SNAPSHOT.jar
guava-13.0.jar jackson-core-asl-1.9.8.jar javax.inject-1.jar jersey-common-2.0-SNAPSHOT.jar keystone-model-2.0.0-SNAPSHOT.jar swift-model-2.0.0-SNAPSHOT.jar
hk2-api-2.1.51.jar jackson-jaxrs-1.9.8.jar javax.inject-2.1.51.jar jersey-media-json-jackson-2.0-SNAPSHOT.jar openstack-client-2.0.0-SNAPSHOT.jar</pre></div><div><br></div><div>Thanks for all help!<br>
</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 11, 2013 at 10:08 AM, 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><div>Hey Luis, nice you've copy the list cause it'll help many other with the same doubt.<br>
<br></div>I've added the dependencies you've mentioned but I keep getting the same error: java.lang.NoClassDefFoundError: Could not initialize class org.openstack.OpenStack<br>
<br></div>This is how my build.sbt looks like:<br><br>===<br><br>name := "SBT CloudDrive"<br><br>version := "0.7"<br><br>organization := "<a href="http://vrijheid.net" target="_blank">vrijheid.net</a>"<br>
<br>
scalaVersion := "2.9.1"<br><br>libraryDependencies += "org.jclouds.driver" % "jclouds-enterprise" % "1.5.4"<br><br>libraryDependencies += "org.jclouds.labs" % "openstack-swift" % "1.5.4"<br>
<br>libraryDependencies += "<a href="http://javax.ws.rs" target="_blank">javax.ws.rs</a>" % "javax.ws.rs-api" % "2.0-m15"<br><br>libraryDependencies += "org.codehaus.jackson" % "jackson-jaxrs" % "1.9.11"<br>
<br>libraryDependencies += "org.codehaus.jackson" % "jackson-xc" % "1.9.11"<br><br>libraryDependencies += "org.glassfish.jersey" % "project" % "2.0-m11"<br><br>
libraryDependencies += "org.glassfish.jersey.core" % "jersey-client" % "2.0-m11"<br>
<br>libraryDependencies += "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.0-m11"<br><br>libraryDependencies += "com.google" % "google" % "5"<br>
<br><div><div class="gmail_extra">
===<br><br></div><div class="gmail_extra">Thanks for all your help! I hope I can get this working!<br></div><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 10, 2013 at 4:17 PM, 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
I copy this to the list because somebody can have similar issues<br><br>-----<br><br>Actually I think the issue is sbt ... (It seems that is not resolving transitive dependencies)<br><br>First: Look and check if you added <br>
<p><a href="https://maven.java.net/content/repositories/snapshots" target="_blank">https://maven.java.net/content/repositories/snapshots</a><br>
<a href="https://raw.github.com/woorea/maven/master/snapshots" target="_blank">https://raw.github.com/woorea/maven/master/snapshots</a></p>as maven repositories<br><br><br>A dirty way (but can help you): <br><br><pre><div>
<span><dependency></span></div><div> <span><groupId></span>org.glassfish.jersey.core<span></groupId></span></div><div> <span><artifactId></span>jersey-client<span></artifactId></span></div>
<div> <span><version></span>2.0-SNAPSHOT<span></version></span></div><div> <span></dependency></span></div><div>
<span><dependency></span></div><div> <span><groupId></span>org.glassfish.jersey.media<span></groupId></span></div><div> <span><artifactId></span>jersey-media-json-jackson<span></artifactId></span></div>
<div> <span><version></span>2.0-SNAPSHOT<span></version></span></div><div> <span></dependency></span></div><div>
<span><dependency></span></div><div> <span><groupId></span>org.codehaus.jackson<span></groupId></span></div><div> <span><artifactId></span>jackson-jaxrs<span></artifactId></span></div>
<div> <span><version></span>1.9.8<span></version></span></div><div> <span></dependency></span></div><div>
<span><dependency></span></div><div> <span><groupId></span>org.codehaus.jackson<span></groupId></span></div><div> <span><artifactId></span>jackson-xc<span></artifactId></span></div>
<div> <span><version></span>1.9.8<span></version></span></div><div> <span></dependency></span></div></pre><div><div><br><br><br><br>
<div class="gmail_quote">On Thu, Jan 10, 2013 at 6:55 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div><div>I could find the pathway, but if I try<br><br>scala> var openstack = new OpenStack<br><br>I get this<br><br>java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientFactory<br>
at org.openstack.OpenStack.initialize(OpenStack.java:96)<br> at org.openstack.OpenStack.<clinit>(OpenStack.java:33)<br> at .<init>(<console>:23)<div><br> at .<clinit>(<console>)<br>
at .<init>(<console>:11)<br> at .<clinit>(<console>)<br> at $print(<console>)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<br>
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br> at java.lang.reflect.Method.invoke(Unknown Source)<br> at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)<br>
at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:914)<br> at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:546)<br> at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:577)<br>
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:543)<br> at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:694)<br> at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:745)<br>
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:651)<br> at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:542)<br> at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:550)<br>
</div><div>
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)<br> at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:851)<br> at xsbt.ConsoleInterface.run(ConsoleInterface.scala:57)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br> at java.lang.reflect.Method.invoke(Unknown Source)<br> at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)<br>
at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:64)<br> at sbt.Console.console0$1(Console.scala:23)<br> at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:24)<br>
at sbt.TrapExit$.executeMain$1(TrapExit.scala:33)<br> at sbt.TrapExit$$anon$1.run(TrapExit.scala:42)<br></div>Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientFactory<br>
at javax.ws.rs.client.ClientFactory.getFactory(ClientFactory.java:92)<br> at javax.ws.rs.client.ClientFactory.newClient(ClientFactory.java:103)<br> at org.openstack.OpenStack.initialize(OpenStack.java:57)<br>
... 33 more<br>Caused by: java.lang.ClassNotFoundException: org.glassfish.jersey.client.JerseyClientFactory<br> at java.net.URLClassLoader$1.run(Unknown Source)<br> at java.net.URLClassLoader$1.run(Unknown Source)<br>
at java.security.AccessController.doPrivileged(Native Method)<br> at java.net.URLClassLoader.findClass(Unknown Source)<br> at java.lang.ClassLoader.loadClass(Unknown Source)<br> at java.lang.ClassLoader.loadClass(Unknown Source)<br>
at java.lang.Class.forName0(Native Method)<br> at java.lang.Class.forName(Unknown Source)<br> at javax.ws.rs.client.FactoryFinder.newInstance(FactoryFinder.java:114)<br> at javax.ws.rs.client.FactoryFinder.find(FactoryFinder.java:206)<br>
at javax.ws.rs.client.ClientFactory.getFactory(ClientFactory.java:75)<br> ... 35 more<br><br><br></div><div>If I try<br>scala> var openstack = new OpenStack()<br><br>I get<div><br><br>java.lang.NoClassDefFoundError: Could not initialize class org.openstack.OpenStack<br>
</div>
at .<init>(<console>:23)<div><br> at .<clinit>(<console>)<br> at .<init>(<console>:11)<br> at .<clinit>(<console>)<br> at $print(<console>)<br>
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br>
at java.lang.reflect.Method.invoke(Unknown Source)<br> at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)<br> at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:914)<br>
at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:546)<br> at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:577)<br> at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:543)<br>
at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:694)<br> at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:745)<br> at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:651)<br>
at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:542)<br> at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:550)<br></div><div> at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)<br>
at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:851)<br> at xsbt.ConsoleInterface.run(ConsoleInterface.scala:57)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<br>
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br> at java.lang.reflect.Method.invoke(Unknown Source)<br> at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)<br> at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:64)<br>
at sbt.Console.console0$1(Console.scala:23)<br> at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:24)<br> at sbt.TrapExit$.executeMain$1(TrapExit.scala:33)<br> at sbt.TrapExit$$anon$1.run(TrapExit.scala:42)<br>
<br><br></div></div>Any suggestion?<br></div>Thanks for all your help!<br></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jan 7, 2013 at 1:25 PM, 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">The class is here:<br><br><span><span><a href="https://github.com/woorea/openstack-java-sdk" target="_blank"><span>openstack-java-sdk</span></a></span></span> / <span><a href="https://github.com/woorea/openstack-java-sdk/tree/master/openstack-client" target="_blank"><span>openstack-client</span></a></span> / <span><a href="https://github.com/woorea/openstack-java-sdk/tree/master/openstack-client/src" target="_blank"><span>src</span></a></span> / <span><a href="https://github.com/woorea/openstack-java-sdk/tree/master/openstack-client/src/main" target="_blank"><span>main</span></a></span> / <span><a href="https://github.com/woorea/openstack-java-sdk/tree/master/openstack-client/src/main/java" target="_blank"><span>java</span></a></span> / <span><a href="https://github.com/woorea/openstack-java-sdk/tree/master/openstack-client/src/main/java/org" target="_blank"><span>org</span></a></span> / <span><a href="https://github.com/woorea/openstack-java-sdk/tree/master/openstack-client/src/main/java/org/openstack" target="_blank"><span>openstack</span></a></span> / <b>OpenStack.java</b><br>
<br>Be sure that you have openstack-client jar in your classpath. Maybe a sbt issue .... You can try and force<br>that dependency (openstack-client) in your config file<br><br>Cheers!<div><div><br>
<br><br><br><div class="gmail_quote">
On Mon, Jan 7, 2013 at 3:59 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div dir="ltr"><div><div>Hey Luis, <br></div>Here I'm again! I figure out how access and instantiate some classes, but there is one that I couldn't make it work. Look what I'm doing, and see if you could give me some tips.<br>
<br>import org.openstack._<br><br> val os_auth_url = "<a href="http://150.164.3.236:5000/v2.0" target="_blank">http://150.164.3.236:5000/v2.0</a>"<br> val os_username = "admin"<br> val os_tenant = "admin"<br>
val os_password = "b1gNUv3m."<br><br> var k = new keystone.KeystoneClient(os_auth_url)<br> var auth = keystone.api.Authenticate.withPasswordCredentials( os_username,os_password )<br> var a = k.execute( auth ) //the problem occurs here.<br>
<br></div><div><br>import org.openstack._<br>os_auth_url: java.lang.String = <a href="http://150.164.3.236:5000/v2.0" target="_blank">http://150.164.3.236:5000/v2.0</a><br>os_username: java.lang.String = admin<br>os_tenant: java.lang.String = admin<br>
os_password: java.lang.String = b1gNUv3m.<br>k: org.openstack.keystone.KeystoneClient = org.openstack.keystone.KeystoneClient@d3b1099<br>auth: org.openstack.keystone.api.Authenticate = org.openstack.keystone.api.Authenticate@6440ba5<br>
java.lang.NoClassDefFoundError: Could not initialize class org.openstack.OpenStack<br> at org.openstack.keystone.KeystoneClient.execute(KeystoneClient.java:19)<br> at $$$$3ec621ebf46e4c475aa71182a0c2fcab$$$.<init>(<console>:129)<br>
at $$$$3ec621ebf46e4c475aa71182a0c2fcab$$$.<clinit>(<console>)<br> at .<init>(<console>:11)<br> at .<clinit>(<console>)<br> at $print(<console>)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br> at java.lang.reflect.Method.invoke(Unknown Source)<br> at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)<br>
at scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:914)<br> at scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:546)<br> at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:577)<br>
at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:543)<br> at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:694)<br> at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:745)<br>
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:651)<br> at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:542)<br> at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:550)<br>
at scala.tools.nsc.interpreter.ILoop$$anonfun$interpretAllFrom$1.apply(ILoop.scala:563)<br> at scala.tools.nsc.interpreter.ILoop$$anonfun$interpretAllFrom$1.apply(ILoop.scala:560)<br> at scala.tools.nsc.io.Streamable$Chars$class.applyReader(Streamable.scala:99)<br>
at scala.tools.nsc.io.File.applyReader(File.scala:76)<br> at scala.tools.nsc.interpreter.ILoop.interpretAllFrom(ILoop.scala:560)<br> at scala.tools.nsc.interpreter.ILoop$$anonfun$loadCommand$1.apply(ILoop.scala:604)<br>
at scala.tools.nsc.interpreter.ILoop$$anonfun$loadCommand$1.apply(ILoop.scala:603)<br> at scala.tools.nsc.interpreter.ILoop.withFile(ILoop.scala:597)<br> at scala.tools.nsc.interpreter.ILoop.loadCommand(ILoop.scala:603)<br>
at scala.tools.nsc.interpreter.ILoop$$anonfun$standardCommands$8.apply(ILoop.scala:222)<br> at scala.tools.nsc.interpreter.ILoop$$anonfun$standardCommands$8.apply(ILoop.scala:222)<br> at scala.tools.nsc.interpreter.LoopCommands$LineCmd.apply(LoopCommands.scala:80)<br>
at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:646)<br> at scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:542)<br> at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:550)<br>
at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)<br> at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:851)<br> at xsbt.ConsoleInterface.run(ConsoleInterface.scala:57)<br> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)<br>
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)<br> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)<br> at java.lang.reflect.Method.invoke(Unknown Source)<br> at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)<br>
at sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:64)<br> at sbt.Console.console0$1(Console.scala:23)<br> at sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:24)<br>
at sbt.TrapExit$.executeMain$1(TrapExit.scala:33)<br> at sbt.TrapExit$$anon$1.run(TrapExit.scala:42)<br><br><br>Thanks in advance!<br></div></div><div><div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, Jan 3, 2013 at 8:44 PM, 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Gui,<div><br></div><div>If you are using scala probably the issues come from java collections api </div>
<div>(when you use whatever java library)</div>
<div><br></div><div>Probably you know, look at : <a href="http://www.scala-lang.org/docu/files/collections-api/collections_46.html" target="_blank">http://www.scala-lang.org/docu/files/collections-api/collections_46.html</a></div>
<div><br></div><div>Hope it helps</div><span><font color="#888888"><div><br></div><div>Luis</div></font></span><div><div><div><br><div class="gmail_quote">On Thu, Jan 3, 2013 at 7:40 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Luis, <br>Sorry for fulling your mailbox, but I figure out the problem. Instead of using java, I'm using scala. So there is a little difference accessing those things.<br>
<br></div>Now I'm resolving depencies and I hope I can make it work!<br>
<br>Thanks and sorry again!<br></div><div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 3, 2013 at 4:20 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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Luis,<br>sorry my stupid, but I can't understand this piece of code:<br><p></p><div>
<span> </span><span> </span>Access access = keystone.execute(Authenticate.withPasswordCredentials(<span>KEYSTONE_USERNAME</span>, <span>KEYSTONE_PASSWORD</span>));<br>
</div>
access = keystone.execute(Authenticate.withToken(access.getToken().getId()).withTenantId(tenants.getList().get(0).getId()));<p></p><p></p><p>What should I include in my project in order to have this Authenticate and Access class?</p>
<p>I'm really lost and confused! I would appreciate your help!<br></p><p>Lots of Thanks in advance!<br></p><br><div><div class="gmail_extra"><br><br><div class="gmail_quote"><div>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>
</div><div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);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></p></div></blockquote><div> </div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><p> </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>
<div><div>
<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>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:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><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><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: <a href="tel:%28%2B34%29%20627983344" value="+34627983344" target="_blank">(+34) 627983344</a><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></div></div>
</blockquote></div><div><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></div></div></div></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>
</div></div></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: <a href="tel:%28%2B34%29%20627983344" value="+34627983344" target="_blank">(+34) 627983344</a><br>
<a href="mailto:luis.gervaso@gmail.com" target="_blank">luis@</a><a href="http://woorea.es/" target="_blank">woorea.es</a></div>
</div>
</div></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>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>-------------------------------------------<br>Luis Alberto Gervaso Martin<div>Woorea Solutions, S.L<br>CEO & CTO<br>mobile: <a href="tel:%28%2B34%29%20627983344" value="+34627983344" target="_blank">(+34) 627983344</a><br>
<a href="mailto:luis.gervaso@gmail.com" target="_blank">luis@</a><a href="http://woorea.es/" target="_blank">woorea.es</a></div>
</div></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>
</div></div></blockquote></div><br><br clear="all"><br>-- <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></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></div></div></div></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>