← Back to team overview

openstack team mailing list archive

Re: Developing with Scala/Java on OpenStack Swift

 

Hey Luis,
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

System.out.println(swiftClient.execute(new ListObjects("navidad2", new
HashMap<String,
String>() {{put("path", "");}})).get(0).getContentType());

in scala.

These are the libraries I've managed to make the openstack-java-sdk work in
scala! :)

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


Thanks for all help!


On Fri, Jan 11, 2013 at 10:08 AM, Gui Maluf <guimalufb@xxxxxxxxx> wrote:

> Hey Luis, nice you've copy the list cause it'll help many other with the
> same doubt.
>
> 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
>
> This is how my build.sbt looks like:
>
> ===
>
> name := "SBT CloudDrive"
>
> version := "0.7"
>
> organization := "vrijheid.net"
>
> scalaVersion := "2.9.1"
>
> libraryDependencies += "org.jclouds.driver" % "jclouds-enterprise" %
> "1.5.4"
>
> libraryDependencies += "org.jclouds.labs" % "openstack-swift" % "1.5.4"
>
> libraryDependencies += "javax.ws.rs" % "javax.ws.rs-api" % "2.0-m15"
>
> libraryDependencies += "org.codehaus.jackson" % "jackson-jaxrs" % "1.9.11"
>
> libraryDependencies += "org.codehaus.jackson" % "jackson-xc" % "1.9.11"
>
> libraryDependencies += "org.glassfish.jersey" % "project" % "2.0-m11"
>
> libraryDependencies += "org.glassfish.jersey.core" % "jersey-client" %
> "2.0-m11"
>
> libraryDependencies += "org.glassfish.jersey.media" %
> "jersey-media-json-jackson" % "2.0-m11"
>
> libraryDependencies += "com.google" % "google" % "5"
>
> ===
>
> Thanks for all your help! I hope I can get this working!
>
> On Thu, Jan 10, 2013 at 4:17 PM, Luis Gervaso <luis@xxxxxxxxx> wrote:
>
>> I copy this to the list because somebody can have similar issues
>>
>> -----
>>
>> Actually I think the issue is sbt ... (It seems that is not resolving
>> transitive dependencies)
>>
>> First:  Look and check if you added
>>
>> https://maven.java.net/content/repositories/snapshots
>> https://raw.github.com/woorea/maven/master/snapshots
>> as maven repositories
>>
>>
>> A dirty way (but can help you):
>>
>>
>>
>>
>>
>>
>> 		<dependency>
>> 			<groupId>org.glassfish.jersey.core</groupId>
>> 			<artifactId>jersey-client</artifactId>
>>
>>
>>
>>
>> 			<version>2.0-SNAPSHOT</version>
>> 		</dependency>
>>
>> 		<dependency>
>> 			<groupId>org.glassfish.jersey.media</groupId>
>> 			<artifactId>jersey-media-json-jackson</artifactId>
>>
>>
>>
>>
>> 			<version>2.0-SNAPSHOT</version>
>> 		</dependency>
>>
>> 		<dependency>
>> 			<groupId>org.codehaus.jackson</groupId>
>> 			<artifactId>jackson-jaxrs</artifactId>
>>
>>
>>
>>
>> 			<version>1.9.8</version>
>> 		</dependency>
>>
>> 		<dependency>
>> 			<groupId>org.codehaus.jackson</groupId>
>> 			<artifactId>jackson-xc</artifactId>
>> 			<version>1.9.8</version>
>> 		</dependency>
>>
>>
>>
>>
>>
>> On Thu, Jan 10, 2013 at 6:55 PM, Gui Maluf <guimalufb@xxxxxxxxx> wrote:
>>
>>> I could find the pathway, but if I try
>>>
>>> scala> var openstack = new OpenStack
>>>
>>> I get this
>>>
>>> java.lang.RuntimeException: java.lang.ClassNotFoundException:
>>> org.glassfish.jersey.client.JerseyClientFactory
>>>         at org.openstack.OpenStack.initialize(OpenStack.java:96)
>>>         at org.openstack.OpenStack.<clinit>(OpenStack.java:33)
>>>         at .<init>(<console>:23)
>>>
>>>         at .<clinit>(<console>)
>>>         at .<init>(<console>:11)
>>>         at .<clinit>(<console>)
>>>         at $print(<console>)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>>> Source)
>>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>>         at
>>> scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)
>>>         at
>>> scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:914)
>>>         at
>>> scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:546)
>>>         at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:577)
>>>         at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:543)
>>>         at
>>> scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:694)
>>>         at
>>> scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:745)
>>>         at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:651)
>>>         at
>>> scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:542)
>>>         at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:550)
>>>          at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
>>>         at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:851)
>>>         at xsbt.ConsoleInterface.run(ConsoleInterface.scala:57)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>>> Source)
>>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>>         at
>>> sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)
>>>         at
>>> sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:64)
>>>         at sbt.Console.console0$1(Console.scala:23)
>>>         at
>>> sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:24)
>>>         at sbt.TrapExit$.executeMain$1(TrapExit.scala:33)
>>>         at sbt.TrapExit$$anon$1.run(TrapExit.scala:42)
>>> Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException:
>>> org.glassfish.jersey.client.JerseyClientFactory
>>>         at
>>> javax.ws.rs.client.ClientFactory.getFactory(ClientFactory.java:92)
>>>         at
>>> javax.ws.rs.client.ClientFactory.newClient(ClientFactory.java:103)
>>>         at org.openstack.OpenStack.initialize(OpenStack.java:57)
>>>         ... 33 more
>>> Caused by: java.lang.ClassNotFoundException:
>>> org.glassfish.jersey.client.JerseyClientFactory
>>>         at java.net.URLClassLoader$1.run(Unknown Source)
>>>         at java.net.URLClassLoader$1.run(Unknown Source)
>>>         at java.security.AccessController.doPrivileged(Native Method)
>>>         at java.net.URLClassLoader.findClass(Unknown Source)
>>>         at java.lang.ClassLoader.loadClass(Unknown Source)
>>>         at java.lang.ClassLoader.loadClass(Unknown Source)
>>>         at java.lang.Class.forName0(Native Method)
>>>         at java.lang.Class.forName(Unknown Source)
>>>         at
>>> javax.ws.rs.client.FactoryFinder.newInstance(FactoryFinder.java:114)
>>>         at javax.ws.rs.client.FactoryFinder.find(FactoryFinder.java:206)
>>>         at
>>> javax.ws.rs.client.ClientFactory.getFactory(ClientFactory.java:75)
>>>         ... 35 more
>>>
>>>
>>> If I try
>>> scala> var openstack = new OpenStack()
>>>
>>> I get
>>>
>>>
>>> java.lang.NoClassDefFoundError: Could not initialize class
>>> org.openstack.OpenStack
>>>          at .<init>(<console>:23)
>>>
>>>         at .<clinit>(<console>)
>>>         at .<init>(<console>:11)
>>>         at .<clinit>(<console>)
>>>         at $print(<console>)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>>> Source)
>>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>>         at
>>> scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)
>>>         at
>>> scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:914)
>>>         at
>>> scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:546)
>>>         at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:577)
>>>         at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:543)
>>>         at
>>> scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:694)
>>>         at
>>> scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:745)
>>>         at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:651)
>>>         at
>>> scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:542)
>>>         at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:550)
>>>         at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
>>>         at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:851)
>>>         at xsbt.ConsoleInterface.run(ConsoleInterface.scala:57)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>>> Source)
>>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>>         at
>>> sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)
>>>         at
>>> sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:64)
>>>         at sbt.Console.console0$1(Console.scala:23)
>>>         at
>>> sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:24)
>>>         at sbt.TrapExit$.executeMain$1(TrapExit.scala:33)
>>>         at sbt.TrapExit$$anon$1.run(TrapExit.scala:42)
>>>
>>>
>>> Any suggestion?
>>> Thanks for all your help!
>>>
>>>
>>> On Mon, Jan 7, 2013 at 1:25 PM, Luis Gervaso <luis@xxxxxxxxx> wrote:
>>>
>>>> The class is here:
>>>>
>>>> openstack-java-sdk <https://github.com/woorea/openstack-java-sdk> /
>>>> openstack-client<https://github.com/woorea/openstack-java-sdk/tree/master/openstack-client>/
>>>> src<https://github.com/woorea/openstack-java-sdk/tree/master/openstack-client/src>/
>>>> main<https://github.com/woorea/openstack-java-sdk/tree/master/openstack-client/src/main>/
>>>> java<https://github.com/woorea/openstack-java-sdk/tree/master/openstack-client/src/main/java>/
>>>> org<https://github.com/woorea/openstack-java-sdk/tree/master/openstack-client/src/main/java/org>/
>>>> openstack<https://github.com/woorea/openstack-java-sdk/tree/master/openstack-client/src/main/java/org/openstack>/
>>>> *OpenStack.java*
>>>>
>>>> Be sure that you have openstack-client jar in your classpath. Maybe a
>>>> sbt issue .... You can try and force
>>>> that dependency (openstack-client) in your config file
>>>>
>>>> Cheers!
>>>>
>>>>
>>>>
>>>>
>>>> On Mon, Jan 7, 2013 at 3:59 PM, Gui Maluf <guimalufb@xxxxxxxxx> wrote:
>>>>
>>>>> Hey Luis,
>>>>> 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.
>>>>>
>>>>> import org.openstack._
>>>>>
>>>>>         val os_auth_url = "http://150.164.3.236:5000/v2.0";
>>>>>         val os_username = "admin"
>>>>>         val os_tenant   = "admin"
>>>>>         val os_password = "b1gNUv3m."
>>>>>
>>>>>         var k = new keystone.KeystoneClient(os_auth_url)
>>>>>         var auth = keystone.api.Authenticate.withPasswordCredentials(
>>>>> os_username,os_password )
>>>>>         var a = k.execute( auth ) //the problem occurs here.
>>>>>
>>>>>
>>>>> import org.openstack._
>>>>> os_auth_url: java.lang.String = http://150.164.3.236:5000/v2.0
>>>>> os_username: java.lang.String = admin
>>>>> os_tenant: java.lang.String = admin
>>>>> os_password: java.lang.String = b1gNUv3m.
>>>>> k: org.openstack.keystone.KeystoneClient =
>>>>> org.openstack.keystone.KeystoneClient@d3b1099
>>>>> auth: org.openstack.keystone.api.Authenticate =
>>>>> org.openstack.keystone.api.Authenticate@6440ba5
>>>>> java.lang.NoClassDefFoundError: Could not initialize class
>>>>> org.openstack.OpenStack
>>>>>         at
>>>>> org.openstack.keystone.KeystoneClient.execute(KeystoneClient.java:19)
>>>>>         at
>>>>> $$$$3ec621ebf46e4c475aa71182a0c2fcab$$$.<init>(<console>:129)
>>>>>         at $$$$3ec621ebf46e4c475aa71182a0c2fcab$$$.<clinit>(<console>)
>>>>>         at .<init>(<console>:11)
>>>>>         at .<clinit>(<console>)
>>>>>         at $print(<console>)
>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>>>>> Source)
>>>>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.IMain$Request.loadAndRun(IMain.scala:914)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.IMain.loadAndRunReq$1(IMain.scala:546)
>>>>>         at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:577)
>>>>>         at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:543)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:694)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:745)
>>>>>         at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:651)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:542)
>>>>>         at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:550)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.ILoop$$anonfun$interpretAllFrom$1.apply(ILoop.scala:563)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.ILoop$$anonfun$interpretAllFrom$1.apply(ILoop.scala:560)
>>>>>         at
>>>>> scala.tools.nsc.io.Streamable$Chars$class.applyReader(Streamable.scala:99)
>>>>>         at scala.tools.nsc.io.File.applyReader(File.scala:76)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.ILoop.interpretAllFrom(ILoop.scala:560)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.ILoop$$anonfun$loadCommand$1.apply(ILoop.scala:604)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.ILoop$$anonfun$loadCommand$1.apply(ILoop.scala:603)
>>>>>         at scala.tools.nsc.interpreter.ILoop.withFile(ILoop.scala:597)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.ILoop.loadCommand(ILoop.scala:603)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.ILoop$$anonfun$standardCommands$8.apply(ILoop.scala:222)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.ILoop$$anonfun$standardCommands$8.apply(ILoop.scala:222)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.LoopCommands$LineCmd.apply(LoopCommands.scala:80)
>>>>>         at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:646)
>>>>>         at
>>>>> scala.tools.nsc.interpreter.ILoop.processLine$1(ILoop.scala:542)
>>>>>         at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:550)
>>>>>         at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:822)
>>>>>         at scala.tools.nsc.interpreter.ILoop.main(ILoop.scala:851)
>>>>>         at xsbt.ConsoleInterface.run(ConsoleInterface.scala:57)
>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>>>>         at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
>>>>>         at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
>>>>> Source)
>>>>>         at java.lang.reflect.Method.invoke(Unknown Source)
>>>>>         at
>>>>> sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)
>>>>>         at
>>>>> sbt.compiler.AnalyzingCompiler.console(AnalyzingCompiler.scala:64)
>>>>>         at sbt.Console.console0$1(Console.scala:23)
>>>>>         at
>>>>> sbt.Console$$anonfun$apply$2$$anonfun$apply$1.apply$mcV$sp(Console.scala:24)
>>>>>         at sbt.TrapExit$.executeMain$1(TrapExit.scala:33)
>>>>>         at sbt.TrapExit$$anon$1.run(TrapExit.scala:42)
>>>>>
>>>>>
>>>>> Thanks in advance!
>>>>>
>>>>>
>>>>> On Thu, Jan 3, 2013 at 8:44 PM, Luis Gervaso <luis@xxxxxxxxx> wrote:
>>>>>
>>>>>> Gui,
>>>>>>
>>>>>> If you are using scala probably the issues come from java collections
>>>>>> api
>>>>>> (when you use whatever java library)
>>>>>>
>>>>>> Probably you know, look at :
>>>>>> http://www.scala-lang.org/docu/files/collections-api/collections_46.html
>>>>>>
>>>>>> Hope it helps
>>>>>>
>>>>>> Luis
>>>>>>
>>>>>> On Thu, Jan 3, 2013 at 7:40 PM, Gui Maluf <guimalufb@xxxxxxxxx>wrote:
>>>>>>
>>>>>>> Luis,
>>>>>>> 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.
>>>>>>>
>>>>>>> Now I'm resolving depencies and I hope I can make it work!
>>>>>>>
>>>>>>> Thanks and sorry again!
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Jan 3, 2013 at 4:20 PM, Gui Maluf <guimalufb@xxxxxxxxx>wrote:
>>>>>>>
>>>>>>>> Luis,
>>>>>>>> sorry my stupid, but I can't understand this piece of code:
>>>>>>>>
>>>>>>>>  Access access =
>>>>>>>> keystone.execute(Authenticate.withPasswordCredentials(
>>>>>>>> KEYSTONE_USERNAME, KEYSTONE_PASSWORD));
>>>>>>>>  access =
>>>>>>>> keystone.execute(Authenticate.withToken(access.getToken().getId()).withTenantId(tenants.getList().get(0).getId()));
>>>>>>>>
>>>>>>>> What should I include in my project in order to have this
>>>>>>>> Authenticate and Access class?
>>>>>>>>
>>>>>>>> I'm really lost and confused! I would appreciate your help!
>>>>>>>>
>>>>>>>> Lots of Thanks in advance!
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Thu, Jan 3, 2013 at 4:00 AM, Luis Gervaso <luis@xxxxxxxxx>wrote:
>>>>>>>>
>>>>>>>>> Hi Gui!
>>>>>>>>>
>>>>>>>>> I just upgraded the code to work properly with latest Jersey
>>>>>>>>> release
>>>>>>>>>
>>>>>>>>> Below the swift example code (just tested and working with HPCloud)
>>>>>>>>>
>>>>>>>>> Hope it helps you :)
>>>>>>>>>
>>>>>>>>> private static final File TEST_FILE = new File("pom.xml");
>>>>>>>>>
>>>>>>>>>  private static final String KEYSTONE_AUTH_URL = "
>>>>>>>>> https://region-a.geo-1.identity.hpcloudsvc.com:35357/v2.0";;
>>>>>>>>>
>>>>>>>>>  private static final String KEYSTONE_USERNAME = "";
>>>>>>>>>
>>>>>>>>>  private static final String KEYSTONE_PASSWORD = "";
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  /**
>>>>>>>>>
>>>>>>>>>  * @param args
>>>>>>>>>
>>>>>>>>>  */
>>>>>>>>>
>>>>>>>>> public static void main(String[] args) throws Exception {
>>>>>>>>>
>>>>>>>>>  KeystoneClient keystone = new KeystoneClient(KEYSTONE_AUTH_URL);
>>>>>>>>>
>>>>>>>>>  //access with unscoped token
>>>>>>>>>
>>>>>>>>>  Access access =
>>>>>>>>> keystone.execute(Authenticate.withPasswordCredentials(
>>>>>>>>> KEYSTONE_USERNAME, KEYSTONE_PASSWORD));
>>>>>>>>>
>>>>>>>>>   //use the token in the following requests
>>>>>>>>>
>>>>>>>>>  keystone.setToken(access.getToken().getId());
>>>>>>>>>
>>>>>>>>>   Tenants tenants = keystone.execute(new ListTenants());
>>>>>>>>>
>>>>>>>>>   //try to exchange token using the first tenant
>>>>>>>>>
>>>>>>>>>  if(tenants.getList().size() > 0) {
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>    SwiftClient swiftClient = newSwiftClient(KeystoneUtils.findEndpointURL(access.getServiceCatalog(),
>>>>>>>>> "object-store", null, "public"), access.getToken().getId());
>>>>>>>>>
>>>>>>>>>    //swiftClient.execute(new DeleteContainer("navidad2"));
>>>>>>>>>
>>>>>>>>>    swiftClient.execute(new CreateContainer("navidad2"));
>>>>>>>>>
>>>>>>>>>    System.out.println(swiftClient.execute(new ListContainers()));
>>>>>>>>>
>>>>>>>>>    ObjectForUpload upload = new ObjectForUpload();
>>>>>>>>>
>>>>>>>>>  upload.setContainer("navidad2");
>>>>>>>>>
>>>>>>>>>  upload.setName("example2");
>>>>>>>>>
>>>>>>>>>  upload.setInputStream(new FileInputStream(TEST_FILE));
>>>>>>>>>
>>>>>>>>>  swiftClient.execute(new UploadObject(upload));
>>>>>>>>>
>>>>>>>>>    System.out.println(swiftClient.execute(new ListObjects(
>>>>>>>>> "navidad2", new HashMap<String, String>() {{
>>>>>>>>>
>>>>>>>>>   put("path", "");
>>>>>>>>>
>>>>>>>>>  }})).get(0).getContentType());
>>>>>>>>>
>>>>>>>>>    }
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>  }
>>>>>>>>>
>>>>>>>>> On Wed, Jan 2, 2013 at 8:01 PM, Gui Maluf <guimalufb@xxxxxxxxx>wrote:
>>>>>>>>>
>>>>>>>>>> Hey guys,
>>>>>>>>>> I'm trying to extend a software project<https://github.com/VirtualCloudDrive/CloudDrive>to talk with Swift.
>>>>>>>>>>
>>>>>>>>>> This project was developed on Scala, and my issue is: how should
>>>>>>>>>> I access Swift resource? Should I use openstack-java-sdk<https://github.com/woorea/openstack-java-sdk/>,
>>>>>>>>>> jclouds<http://www.jclouds.org/documentation/quickstart/openstack/>or develop my own library to access the REST API?
>>>>>>>>>> I've tried to use openstack-java-sdk but I wasn't able to import
>>>>>>>>>> the libraries exposed at examples.
>>>>>>>>>>
>>>>>>>>>> I'm really confuse about that and I'll appreciate any help, hint,
>>>>>>>>>> advice!
>>>>>>>>>>
>>>>>>>>>> Thanks in advance.!
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> *guilherme* \n
>>>>>>>>>> \t *maluf*
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Mailing list: https://launchpad.net/~openstack
>>>>>>>>>> Post to     : openstack@xxxxxxxxxxxxxxxxxxx
>>>>>>>>>> Unsubscribe : https://launchpad.net/~openstack
>>>>>>>>>> More help   : https://help.launchpad.net/ListHelp
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> -------------------------------------------
>>>>>>>>> Luis Alberto Gervaso Martin
>>>>>>>>> Woorea Solutions, S.L
>>>>>>>>> CEO & CTO
>>>>>>>>> mobile: (+34) 627983344
>>>>>>>>> luis@ <luis.gervaso@xxxxxxxxx>woorea.es
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> *guilherme* \n
>>>>>>>> \t *maluf*
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> *guilherme* \n
>>>>>>> \t *maluf*
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> -------------------------------------------
>>>>>> Luis Alberto Gervaso Martin
>>>>>> Woorea Solutions, S.L
>>>>>> CEO & CTO
>>>>>> mobile: (+34) 627983344
>>>>>> luis@ <luis.gervaso@xxxxxxxxx>woorea.es
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *guilherme* \n
>>>>> \t *maluf*
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> -------------------------------------------
>>>> Luis Alberto Gervaso Martin
>>>> Woorea Solutions, S.L
>>>> CEO & CTO
>>>> mobile: (+34) 627983344
>>>> luis@ <luis.gervaso@xxxxxxxxx>woorea.es
>>>>
>>>
>>>
>>>
>>> --
>>> *guilherme* \n
>>> \t *maluf*
>>>
>>
>>
>>
>> --
>> -------------------------------------------
>> Luis Alberto Gervaso Martin
>> Woorea Solutions, S.L
>> CEO & CTO
>> mobile: (+34) 627983344
>> luis@ <luis.gervaso@xxxxxxxxx>woorea.es
>>
>
>
>
> --
> *guilherme* \n
> \t *maluf*
>



-- 
*guilherme* \n
\t *maluf*

References