What's ModeShape?
ModeShape is a Java Content Repository implementation which will support both JSR-170 and JSR-283. It's not trying to be just another isolated content repository, but a repository with a strong focus on content federation. In other words: ModeShape's main goal is to provide a single JCR interface for accessing and searching content coming from different back-end systems. These systems can even be of different sorts. You might think of a ModeShape repository containing information from a relation database, a file system and perhaps even another Java content repository like for instance Hippo CMS 7's content repository. You can configure these sources of information with the help of ModeShapes connector framework.Connectors
One of ModeShape's key concepts is the concept of connectors. A connector will allow you to connect to a certain type of back-end system and transparently expose the information inside the ModeShape repository. In the current 1.0.0 beta release there are already a couple of out of the box connectors available:- In-Memory Connector
- File System Connector
- JPA Connector
- Federation Connector
- Subversion Connector
- JBoss Cache Connector
- Infinispan Connector
- JDBC Metadata Connector
That's already quite a few, but for the upcoming release they also have plans for expanding the set of connectors with for instance a JCR connector, which I find quite interesting myself, because that would allow you to expose other JCR implementations like Hippo CMS 7 (Apache JackRabbit) in combination with other systems through one JCR interface.
There are many other content solutions out there, so if you can't find a connector that suits your need, you can of course write one yourself and perhaps donate it to the ModeShape project.
Sequencers
One of ModeShapes other interesting features is the concept of sequencers. With sequencers you can gather additional information from a certain item inside the repository and store that extracted information in the repository. ModeShape has quite a few sequencers out of the box:- Compact Node Type (CND) Sequencer
- XML Document Sequencer
- ZIP File Sequencer
- Microsoft Office Document Sequencer
- Java Source File Sequencer
- Java Class File Sequencer
- Image Sequencer
- MP3 Sequencer
- DDL File Sequencer
- Text Sequencers
The example below is of the ImageSequencer, which can gather information from certain types of images stored inside the repository. The ImageMetaDataSequencer is used here to extract metadata like size, dimensions and so on from the image if they have one of the specified extensions and the extracted information is stored somewhere else inside the repository.
JcrConfiguration config = ...
config.sequencer("Image Sequencer")
.usingClass("org.modeshape.sequencer.image.ImageMetadataSequencer")
.loadedFromClasspath()
.setDescription("Sequences image files to extract the characteristics of the image")
.sequencingFrom("//(*.(jpg|jpeg|gif|bmp|psd)[*])/jcr:content[@jcr:data]")
.andOutputtingTo("/images/$1");

Nice post man. Interesting technology.
ReplyDeleteDi you forget to add your DZone link ?
Your comment thing still does not work very well (for me)
Jettro
Hi Jettro,
ReplyDeletehmm that's weird. Did you try to do that on safari? I never post it with the DZone link, but I do post it on DZone. Perhaps I should add the icon somewhere.
Just wondering you have example for custom jdbc connector.
ReplyDeleteI'm looking into how to have modeshape talking to our custom database (mysql) schema.
Alex
Hi Alex,
ReplyDeleteI do not have a custom example of a jdbc connector yet.I was planning to try the ModeShape 1.0 release. I'll write a new post once I got some experience with that.
Hi Jeroen
ReplyDeleteI am also looking for a working custom example with mysql jdbc connector.
Please update me if you have any reference for the same.
Hi Jignesh,
DeleteI'm sorry but I do not have an example available.
Jeroen