Java Reference
In-Depth Information
the majority of the community interpret as “Not Only SQL”) refers to a range of schema-
less databases that are not based on relational approaches.
15 Other than the rise of dynamic languages on the JVM, of course.
The subject of NoSQL databases is already large and rapidly growing, and it's well beyond
the scope of this topic. But many of the databases have a Java API, and some of them also
have Groovy wrappers that simplify them.
One of the most interesting is MongoDB, [ 16 ] whose Java API is rather awkward but is
dramatically improved through a Groovy wrapper called GMongo. The GMongo project,
whose GitHub repository is located at https://github.com/poiati/gmongo , is the product of
Paulo Poiati and is the subject of this section.
16 See www.mongodb.org/ for downloads and documentation.
MongoDB is a document-oriented database that stores its data in binary JSON (BSON)
format. This makes it perfect for storing data downloaded from RESTful web services,
which often produce JSON data on request.
8.5.1. Populating Groovy vampires
This example came about because I was wandering in a bookstore recently and noticed that
while there was only one bookshelf labeled “Computer,” there were three others labeled
“Teen Paranormal Romance.” Rather than lament the decline of Western Civilization I
chose to take this as evidence that I needed to add Groovy vampires to my book.
Consider the web service provided by the movie review site Rotten Tomatoes, ht-
tp://developer.rottentomatoes.com . If you register for an API key, you can make HTTP
GET requests that search for movies, cast members, and more. The data is returned in
JSON form. The base URL for the API is located at http://api.rottentomatoes.com/api/pub-
lic/v1.0 . All requests start with that URL.
For example, searching for information about the movie Blazing Saddles [ 17 ] is done by
accessing
http://api.rottentomatoes.com/api/public/v1.0/
 
 
Search WWH ::




Custom Search