Wednesday, September 23, 2009

JCR based Content Management

Why JCR is good for Content Management?

JCR standard (Java Content Repository, JSR-170) prescribed several best-practices already existing in content-management. Versioning, locking, content types, observation XML export/import and search - all of them were already implemented and sold to customers. But each one in "a bit" different, proprietary way.

Application developers and custom solution integrators will be able to avoid the costs associated with learning the particular API of each repository vendor. Instead, programmers will be able to develop content-based application logic independently of the underlying repository architecture or physical storage.
Customers will also benefit by being able to exchange their underlying repositories without touching any of the applications built on top of them

Sounds good! It is good actually!

JCR it is a software developers API not a content writers tool. But can be used pretty (and should) to create amazing content-oriented products and concentrate on goals.

In addition to mentioned features (versions, locks etc) JCR gives high-level abstraction on actual data storage. Content developer doesn't care about a content storage location (files, database, S3) and creates features on top of JCR Repositories.
Each Repository consists at least one Workspace. But when you can have several it will be naturally to implement workflow like "draft", "acceptance", "production" and "backup".
Workspaces support Corresponding Nodes (4.10.2), so content branching and update between workspaces are native to JCR. Lot of opportunities with it...

Discussing is One Repository Even an Option? It's interesting to apply JCR features for such question.
The question is wide and a business related but in some sense it can be satisfied for both sides.
JCR Repository can contains several Workspaces with data from very different sources (databases, files and even in-cloud like Amazon S3). Each workspace connects via configuration and actual data location is fully transparent for content users.

JCR implementation can supports many persistent backends actually.
While SQL database connected Workspaces for a production, we on eXo have SimpleDB experimental support also. eXo JCR persistent layer has CRUD API and can be implemented independently on other features.

On other hand JCR specification might seem not complete as it doesn't cover network access to a content. But shouldn't. It's the Java API only.
Here JCR vendors make the game. For example eXo JCR and Jackrabbit have such option as WebDAV access to a Repository. That gives a great opportunity to use JCR hosted content in web-pages without coding.

Real example of JCR based CMS

eXo WCM 1.2. Distro comes with lot of cool options and it runs fully on JCR storage and brings many JCR features to a content users.

eXoPlatform Web Content Management solution is emerging to help webmasters who handle all tasks needed to run a website, including development, deployment, design, content publication and monitoring. WCM facilitates managing website easily. In addition, the Webmasters are no more the only actors in the spotlight. Each member in the community is welcome to collaborate and contribute depending on his/her rights. All these features contribute to make the website management agile and less onerous.

Interesting? Find more in the wiki.

I'll show here how eXo WCM leverages JCR features for Content creation and sharing.

Usecase: one Repository... distributed worldwide.
Our virtual European company will provide information from one of its partners in United States on the company's site Home page.

Download and install eXo WCM on virtual company host. Run it and open Home page http://localhost:8080/portal. (user: root, password:exo)


This is a default eXo WCM Home page. Let's customize company Home page with the partner content. Partner company runs similar WCM instance and both WCMs are configured in multi-db JCR mode.
We configure dedicated workspace "exo-partner1" on both WCMs. This workspace will be connected to a one physical database (e.g. on partner side).


In addition to a JCR's Workspaces the eXo WCM introduces concept of Drive. Drive it is a sub-tree of Nodes or whole Workspace. Drive provides additional logical layer to a content management and allows to create different UI presentations dedicated to tasks.

Connect "exp-partner1" workspace as a new Drive (Groups->Sites Administrator->Content Presentation->Manage Drives->Add Drive) with rights to administrative group (*:/platform/administrators).


Now data can be simple shared between the company and the partner in one Repository. Users can read/write this workspace content, e.g. in WCM SitesExplorer or via WebDAV. And they can don't know where and how actual data is located at all.


Customizing the company Home page. Another cool feature of eXo WCM it's switcher from Live to Edit mode makes this task pretty simple. Switch to Edit mode.


Now we can edit each page part just in few clicks. Let's change the Test part.
Go to Image Properties of the existing image and fix its link to a partner's image. WCM uses "collaboration" workspace for a content. But we have market investigation report in "exo-partner1" workspace. JCR path to the file in the workspace /reports-09-2009/web2.0-techs-fall2009.jpg. And Repository content available via WebDAV. So, we can point the file from the page with the URL http://localhost:18080/rest/private/jcr/repository/exo-partner1/reports-09-2009/web2.0-techs-fall2009.jpg


Fix background color of CSS in Advanced tab and the customization is done. Click save and see the Home page.
Cool! How simple we can do such work with eXo WCM and JCR.


In the example I have used eXo WCM features out of the box.
But the product is open for extensions and many custom needs can be added simple. E.g. the example can be improved with JCR Corresponding Nodes (4.10.2) feature. Then content from "exo-partner1" workspace will be cloned to "business" workspace with enabled versioning; additional operations on the content also can be implemented via Observation (8.3) or Action Extensions.

Conclusion

JCR spec designed as Java API but when it is used deeply in a CMS tool, all those features becomes available to users making a content development better. It is open specification and there are several open-source implementations of it. That gives a freedom of choose of CM product to a content providers. At other hand developers can create content-oriented applications independently on Repository implementation and work on features but not on storages. Useful!

Next version of JCR comes (JSR-283) , it was approved and it's time of implementation now.
On other side there are several projects of JCR integration/implementation in non-Java environments, e.g. Typo3 CR or Jackalope.

JCR standard is useful for CMS, that is about it actually.

8 comments:

Dmitri Tcherevik said...
This comment has been removed by the author.
Dmitri Tcherevik said...

I agree with this stuff entirely. JCR is an ideal mechanism for building content driven apps in Java. But what about Ruby? What about .NET?

Apps are now mostly "assembled" from web-based services, and a new protocol/standard is needed to facilitate such assembly. One must be able to use a content repository from any language or framework regardless of how this repository is implemented or where it is deployed.

This new standard does not make JCR unnecessary. JCR may very well be used when building a web-based service in Java.

Anonymous said...

Agree but not convinced for performances. Encounter many problems with JCR & eXo DMS for example, especially when XPATH queries are used.
And as ECM repository grows generally with time , when new types of documents are regularly dematerialized in a company, i'm not very confident for the future.
For WCM i still haven't tested as we couldn't import massively all our existing documents in eXo DMS for the moment.

Peter Nedonosko said...

@Dmitri Tcherevik, yes JCR it is a Java Content Repository. But there are several tries to implement or integrate the spec implementation on PHP at least. Seems Typo3 and Drupal do this well.

Other players can build integrations via WebDAV or even custom RESTful services.
In fact many parts of eXo Portal and WCM made in this way.

eXoJCR comes with cool REST framework (http://wiki.exoplatform.com/xwiki/bin/view/WS/). eXo WebDAV is based on it and forthcoming Repository manager UI (GWT). But everybody can use eXo RESTful framework for custom services.
The framework is JSR-311 compliant since JCR 1.11 and will be available as part of GateIn portal (http://www.gatein.org).

Guys from Jackrabbit do this way also. WebDAV access and Apache Sling project it is about web-servicing of JCR.

Peter Nedonosko said...

@Laurent, performance question is very important point, but it's should be understanding clearly. Most of questions compares JCR with a SQL database. But JCR has much more features and it is still not eventually-consistent; will never be I hope :)

According eXo DMS, it is very complex and rich on extra features CM application. It is like JCR adds more features to a database. eXo DMS adds more features to the JCR. Plus it is RIA!

eXo WCM do the step into performance also. We're glad to see how it becomes better in features and performance.
GateIn based version of eXo WCM will be a next eXo revolution :)

Try it and ask us more. Migration of an existing data into JCR it's really interesting case, we had some experience with it.

Michael Marth said...

@Dmitri

Comparing JCR and, say, CMIS does not make sense. One is a protocol, the other a repository API. What you say is like "RDBMS is obsolete, because there is ATOM".

@Peter

Nice post. Keep 'em coming.

ukdavo said...

I think you're splitting hairs re the comparison between CMIS & JCR (protocol v API). You're technically right of course but, given the choice of writing JCR integration code and CMIS integration code, who in their right mind is going to opt for the former?

Unknown said...

If you are interested in comparsion between JCR and WCM (web content management systems like drupal) please read my post: http://my-java-planet.blogspot.com/2012/02/content-repository-vs-web-content_06.html