«»

JCR Deep Dive

Introduction: Managing Content

A good content management system should be able to manage highly structured content. It does not only need to manage the content and its properties, but also associated metadata, versions, and state (such as locking/unlocking and publication state). The resulting structure is essentially an object graph of various nodes: content, properties, versions, metadata.

Let’s explore this idea by the example of a simple web page. The page contains a headline, left column that contains a teaser and a formatted text field, and a sidebar column that contains two teaser modules.

Sample Wireframe

Sample Wireframe

Applying object-oriented design principles, we can identify the following major classes:

UML Diagram

UML Diagram

Consequently, the sample page above can be depicted using the following object graph:

Sample Object Graph

Sample Object Graph

Naturally, this graph will become more complex once adding version nodes of the individual content and property objects. Modeling an entire web site in this fashion results in an even bigger object graph.

Object-oriented databases have traditionally been excellent at persisting complex hierarchical data. For example, Poet, one of my former companies, had implemented an enterprise content management system on top of their object-oriented database. Most other vendors, however, embraced existing enterprise infrastructures and built their repositories on top of relational databases. The repository, as outlined previously, acts as an abstraction, providing applications access to the content (the above object graph) while insulating the application from the storage implementation details.

Other content management systems that have followed this approach are, amongst many others, CoreMedia, Fatwire, and Day Systems. Day systems pioneered the Java Content Repository standard that specifies a vendor-neutral API to access and store content structures. However, in the author’s experience, object oriented content modeling techniques can be applied to almost any enterprise content management system, even if the support the different frameworks offer for this architecture vary greatly.

The Java Content Repository

The Java Content Repository (JCR) standard, which is based on the Java Specification Requests JSR170 (version 1.0) and JSR 283 (version 2.0), provides a Java-centric object-oriented storage API specifically targeted at content management scenarios. The JCR is not a content management system or a full-fledged content management system API, but rather a content repository API. A content repository provides a common API for all content-driven applications and CMS components, which require access to the content. It provides methods to read, write, and query content. The primary motivation of the JCR standard is to provide a standard and vendor-neutral programmatic interface for content repositories, allowing applications of multiple vendors to interact efficiently.

This chapter will provide an overview of the basic concepts of the JCR, which are a foundation to the subsequent chapters. The chapter will not give you an overview understanding of the JCR specification, but will not fully cover the JCR in-depth, as this would most definitely be beyond the scope of this book. There are numerous excellent resources to consult, first and foremost the JSR 170 and JSR 283 specifications and accompanying API documentation.

This chapter covers concepts found both in JSR 170 and JSR 283 and will point out any features that are limited to JSR 283 as most JCR-compliant implementations currently only implement the JSR170 specification. All sample code in this chapter has been written to work using Apache’s open source implementation of JSR 170, JackRabbit.


«»

Comments

4 Responses to “JCR Deep Dive”

  1. Duncan Reade on January 30th, 2009 8:54 am

    First, thank you for providing this very informative site. And Secondly, just in case it has not been brought to your attention: the URI links to the http://www.jcp.org/ site are out of date (used in section 3. Defining Content).

    Regards
    Duncan Reade

  2. Thomas Einwaller on March 13th, 2009 3:20 am

    Thanks for that great post.

    It seems node type folder is missing?

  3. Yasser on June 12th, 2009 7:06 am

    Really good post.. thanks for the effort

  4. Bruno Dusausoy on October 22nd, 2009 6:50 am

    Hi, great article.
    But as Thomas said previously, it seems you forgot to put the node type “samples:folder” definition. It seems it’s a copy/paste of the “samples:content” definition instead.

Leave a Reply




XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

-->