{{ !articles[0].partner.isSponsoringArticle ? "Platinum" : "Portal" }} Partner

Jclouds Gets Friendly With Clojure

jclouds 1.0 beta 5 is out now with various new features including support for Clojure.  Along with some new features for cloud provisioning, the fifth beta also includes a polished ComputeService API, location compatibility across ComputeService and BlobStore, and more supported services.  jclouds currently has complete support for 9 out of the 18 supported services listed on their google code page.  jclouds is an open source framework that lets developers use their Java and Clojure development skills along with portable abstractions or cloud-specific features on a large number of cloud services.

Clojure Power!
The jclouds team has ambitions of making their multi-cloud framework "the" Clojure cloud library.  The fifth beta, which is the first version to feature Clojure support, is a major step toward this goal.  jclouds is now compatible with Clojure versions 1.1 and 1.2.  Here's an example of what Clojure can now do in jclouds:
(use 'org.jclouds.compute)
(use 'org.jclouds.aws.ebs)

(def compute
(compute-service "ec2" "access" "secret" :ssh))

;; create a node authorized to your current id_rsa and attach a 250G EBS volume to it
(with-compute-service [compute]
(def node (run-node "couchdb"))
(create-volume :node node :size 250 :device "/dev/sdj"))

(use 'org.jclouds.blobstore)
(use 'clojure.contrib.pprint)

(with-blobstore ["s3" "access" "secret"]
(pprint (locations))
(pprint (containers))
(pprint (list-container "my-bucket" :in-directory "dir")))
Visit the pallet project to explore more Clojure features automating, controlling, and provisioning cloud server instances.

ComputeService API Improvments
The Compute API now provides jclouds with a more predictable method for determining the user that is selected for logging on to a compute node.  Exception handling has also been improved so that using the ComputeService or BlobStore ContextFactory can throw an AuthorizationException if your credentials are incorrect.  There is also a new feature for launching scripts on existing nodes.  

There's another exception that can repair instances that had errors during boot-up:
     try {
Set newNodes = client.runNodesWithTag(tag, 2, template);
} catch (RunNodesException e) {
Map runningButBrokeNodes = e.getNodeErrors();
Set okNodes = e.getSuccessfulNodes();

Standardized Locations Across Compute and BlobStore
jcloud users can now collect resources using the new standardized location information.  The new functionality lets users track the path of an object all the way back to the service that created it - from availability zone, to region, to the service provider (EC2 for example):
 // where can I create containers?
Set containerLocations = blobstore.listAssignableLocations();

// where's my node
Location closestLocation = node.getLocation();

// find the closest place to create a new container
while (!containerLocations.contains(closestLocation) && closestLocation.getParent() != null)
closestLocation = closestLocation.getParent();

// create a container in this closest location, or choose null to have
// the service choose a location for you.
if (containerLocations.contains(closestLocation))
blobstore.createContainerInLocation(closestLocation, "my-chef-repository");
blobstore.createContainerInLocation(null, "my-chef-repository");

jclouds now has complete support for GoGrid along with experimental support for BlueLock and vCloud. The developers also added and the SouthEast Asian regions of Amazon EC2.  The next version will support portable volume management, across EBS and vCloud at least.  To vote on more features, go here.
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks