What's ModeShape?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.
ConnectorsOne 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.
SequencersOne 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");