> + 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()
> + }
See the
[Scaladoc](http://www.scala-lang.org/api/current/index.html#scala.util.Try) or
the "For comprehensions" section of this post:
http://danielwestheide.com/blog/2012/12/26/the-neophytes-guide-to-scala-part-6-error-handling-with-try.html
But seeing as the context is a closable resource, using [Scala
ARM](https://github.com/jsuereth/scala-arm/blob/master/notes/about.markdown)
would probably make even more sense here.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/4/files#r4560039