With the growing popularity of content management applications, the need for a common, standardized API for content repositories has become apparent. The Content Repository for Java™ Technology API (JSR-170) aims to provide such an interface. In this article, you'll use the open source Apache Jackrabbit implementation of JSR-170 to explore the features offered by this promising framework by designing a simple Wikipedia-like encyclopedia back end.
If you've ever tried to develop a content management application, you're all too aware of the difficulties inherent in implementing content systems. The landscape is fragmented, with numerous vendors offering proprietary repository engines. These difficulties exacerbate the complexity and maintainability of such systems, promote vendor lock-in, and increase the need for long-term legacy support in the enterprise market. With the growing popularity of corporate weblogs and electronic corporate document management, the need for a standardized content repository interface is more apparent than ever.
The Content Repository for Java Technology specification, developed under the Java Community Process as JSR-170, aims to meet these industry needs. The specification provides a unified API under the
javax.jcr namespace that allows you to access any specification-compliant repository implementation in a vendor-neutral manner.
But API standardization is not the only feature that the Java Content Repository (JCR) brings to the table. A major advantage of JSR-170 is that it is not tied to any particular underlying architecture. The back-end data storage for a JSR-170 implementation, for instance, may be a filesystem, a WebDAV repository, an XML-backed system, or even an SQL database. Furthermore, the export and import facilities of JSR-170 allow an integrator to switch seamlessly between content back ends and JCR implementations. Finally, the JCR provides a straightforward interface that can be layered on top of a wide variety of existing content repositories, while simultaneously standardizing complex functionality such as versioning, access control, and searching.