David Dossot has just released the JCR transport for Mule. For the uninitiated: Mule is an open source Enterprise Service Bus. The JCR transport allows users to attach a JCR to Mule so that content is routed between the JCR and other sources of information. I think this is a great piece of software that will be useful in many enterprise projects where systems integration plays a big role. I was happy that I could ask David a couple of questions about JCR development:
Q: David, congratulations to the release of the JCR transport. I looked at the list of transports on MuleForge and saw that your JCR transport is one of only two projects that has reached production level - you were fast. Did you find JCR to be a good fit to Mule?
Thank you! The JCR Transport was one of the first projects to be hosted on MuleForge, so it had a little more time for maturing than the other ones. In fact, the very first version of the transport went out at the end of July 2007. This new version, with full support for reading and writing from JCR, took seven months and a couple of milestone releases to be finalized.
JCR has proven to be an incredible good fit for Mule. I was initially not convinced that it would make sense to go further than an simple Observations-based event listener, but comments on The Server Side and Mule's users mailing list decided me to go for a full fledged transport. Indeed, it was proven to be a good idea: the capacity to read and write to JCR from an ESB opens up new possibilities of content-oriented integration scenarios, thanks to the solid and comprehensive architecture of Mule combined with the huge amount of both officially and community supported transports.
Even if the current version of the transport does not support transactions, users can already enjoy advanced functionalities that leverage diverse JCR features like: multi-syntax queries, content streaming and custom node types.
Q: I believe the JCR transport for Mule relies a lot on JCR observations. Would you like to share some of your experiences on working with the Observations API with us?
The Observations mechanism is a simple yet powerful way to monitor changes in a JCR. It was very straightforward to create a Mule message receiver that leverages Observations for creating messages the ESB can then propagate to whatever component or endpoint that needs to receive it.
There are several aspects of the Event object that are somewhat challenging for the ESB, the main one being that it is a "connected" object (bound to the current Session) which can be problematic if you send it over to an asynchronous or distant consumer. This is why I had to create an optional transformer that "detaches" an Event, making it a fully resolved serializable object better apt to be used outside of the JCR context.
Finally, if I had one comment on Observations for the upcoming JSR-283, I would ask for the possibility to listen to only one sub-level below a node path, as currently it is either the whole sub-tree or a single node that can be observed.
Q: What tools did you use for your JCR-related development?
My main Java development environment is Eclipse Europa on Kubuntu Gutsy Gibbons, complemented with the usual plug-ins: FindBugs, CheckStyle, EclEmma, Subclipse... I use JackRabbit's TransientRepository for all the integration tests and the transport examples: it is really convenient as you have full control on the initial state of the repository before running each test.
I am also using Maven for my builds, which is made easy thanks to Mule's modularization in a wealth of specialized Maven artifacts. It is to be noted that Sun's opposition to have javax binaries distributed in the central repository could have complicated the build but, thanks to Day and their legacy Maven repository that contains the JCR archive, anyone can access the required dependency without first installing it by hand!
On the server side, I have been leveraging the great tools offered by MuleSource to the community via its MuleForge platform, which has proven to be a successful place for fostering Mule related extensions. These tools comprise Subversion, the Atlassian full suite (Bamboo, Jira, Confluence, Fisheye), forums and mailing lists.
Q: For the benefit of the JCR community let me ask you about your general experiences with JCR. What did you learn about JCR architecture or technology? What did you miss? What took you by surprise?
I started first to explore JCR in 2006 when helping a client I was contracting for to investigate alternatives to their proprietary and expensive document management system. Since this time, it seems that I can not escape this technology, as I am now working with Communique/CRX!
From the beginning I have been impressed by the clarity of the JCR API, something that is alas rare enough to be mentioned. But JCR is a twofold specification as it not only specifies an API, but also mandates pre-defined mixin and primary node types. I initially thought that, for the sake of cross-vendor portability, JCR should go further in normalizing content models (maybe by deprecating nt:unstructured and by forcing users to stick to a limited set of mixins and node types), but I realized it was as naive as willing to normalize, say, standard database models in the JDBC specification!
I must add that "David's Model", from JackRabbit's Wiki, has been a great source of inspiration for the way the Mule JCR transport handles custom node types.
Q: Coming back to Mule: did you get some user feedback on the JCR transport? Are you aware of any real-world use cases you can share?
As with all open source projects, users tend to only manifest themselves when they face an issue or need a feature. So far, none of this has happened so I do not know who, out there, is using or experimenting with the transport. As JCR got listed by Carlos E. Perez as one of the top 5 Java technologies to learn in 2008, I am pretty sure this transport will get more traction in the coming months!