Summary
The Java Content Repository (JCR) API is currently in its second iteration as a JCP standard. A recent InfoQ article describes how to use JCR, and its open-source Jackrabbit implementation, with the Spring framework.
Advertisement
The Java Content Repository (JCR) API aims to provide a unified interface to document-centric content repositories. Among other features, the JCR API defines how content in a repository can be accessed, queried, and modified through a transaction.
The JCR API was developed in the context of the JCP, and became an official Java standard with the final approval of JSR 170. (See the Artima tutorial, Catch Jackrabbit and the Java Content Repository API.) The JCR expert group then moved on to a second iteration of the standard in JSR 283.
The JSR 170 expert group broke new grounds in the JCP—led by Day Software, JSR 170 was the first JSR with a reference implementation developed entirely as an open-source project. As Apache Jackrabbit, the JSR reference implementation recently graduated from Apache incubator status, and is currently in its 1.2.3 production release.
The JSR 170 spec writers took great pains to ensure that Java Content Repository implementations fit into a larger Java enterprise universe. One example of that integration is that a JCR implementation can be enrolled as a transactional resource in a J2EE application server.
Part of Spring Modules, JCR module's main objective is to simplify development with the JSR-170 API in a similar manner to that of the ORM package from the main Spring distribution. Features include:
JcrTemplate which allows execution of JcrCallback and exception handling (transforming checked JCR exceptions into unchecked Spring DAO exceptions).
RepositoryFactoryBean which configures, starts and stops the repository instances... The support contains predefined FactoryBeans for Jackrabbit and Jeceira [Editor's note: another JCR implementation], and an abstract base class which can easily support other repositories.
SessionFactory which ... allows automatic registration of listeners and custom namespaces.
Spring declarative transactional support for repositories that implement the (optional) transactional feature.
OpenSessionInView interceptor and filter which allow the usage of the same session per thread across different components. Along with JcrTemplate, the retrieval, closure and management of the JCR session is externalized and totally transparent to the caller.
What do you think of Jackrabbit as a tool for content management systems and Web applications?