> + val context = ContextBuilder.newBuilder("filesystem")
> + .overrides(properties)
> + .buildView(classOf[BlobStoreContext])
> +
> + try {
> + val blobStore = context.getBlobStore
> + blobStore.createContainerInLocation(null, "test")
> +
> + val blob = blobStore.blobBuilder("test").payload("testdata").build()
> + blobStore.putBlob("test", blob)
> +
> + val filePath = baseDir + System.getProperty("file.separator") + "test"
> + println(s"File ${'"'}test${'"'} stored under,$filePath")
> + } finally {
> + context.close()
> + }
> Does it make sense to introduce one library just for single case?
Well, this is an *example*, but in a real jclouds app you'd likely have many
cases where the ARM code would be applicable. So I personally don't think it
would be a bad idea to demonstrate this pattern to users.
The main reason I suggested this was to demonstrate some more idiomatic Scala
and remove constructs that look very much like Java ported to Scala.
I think most developers that know a bit of Scala would not find it too hard to
port the blobstore-basics demo to Scala line by line, so the benefit of a Scala
example is enhanced, in my view, by focussing also on "good Scala style".
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/4/files#r4567691