**Putting JCR into action – Sling and µJAX **
During last couple of years the enterprise content management community has been noticing a steady rise in the popularity of JCR aka JSR170. A lot of CMS vendors and application server vendors have pledged support to this initiative. For those who are not familiar with JCR, it is the Content Repository API for Java Technology - a Java standard advocated by Day software. JCR provides a “JDBC” equivalent access to content so that the application code does not have to know the details of the underlying vendor implementation. JCR aims at providing an elegant solution to some of the content management challenges faced by organizations dealing with a profusion of content repositories and CMS products. JCR promises “best of both worlds” by providing a single API to access and modify content stored in a DB or in a file system.
I have been tracking the evolution of products based on JCR implementation for a while and was quite disappointed initially to see that other than Day (the proponent of JCR) none of the major ECM vendors provided any real support to JCR based repositories. However recently the situation is getting much better with Alfresco offering a JCR-170 compliant repository and Day supporting the Apache Sling initiative that exposes the JCR APIs via REST.
Exposing the JCR API via a set of RESTful services is a wonderful idea and Sling is one of the first RESTful open source web application frameworks built on top of JCR. Sling uses Apache JackRabbit as the JCR repository. JCR is a tree structured or hierarchical content store. So naturally it makes sense to map tree-structured URLs directly to the tree structure of JCR so that the nodes can be accessed just like a file system with static files.
The biggest plus I see with sling is that it handles the normal GET and PUT methods out of the box and translates them into corresponding JCR actions to retrieve and post content into the repository. The blogging tool is a very simple form of CMS, but it can be extended easily by writing servlet code. Although I used ESP to render the page, Sling supports other scripting languages supported by the Java Scripting framework (JSR-223).