1
votes

I'm using Modeshape 2.6.0...I have two types of content (content is about cars). 1)metadata : name of the car, when it was manufactured, etc...(I want store this into a database) AND 2) binary : picture of the car (I want to use a filesystem)

My question is : is it possible to have a single repository (i.e 1 mode:repository in modeshape-config.xml) with two mode-sources one of them (mode:classname="org.modeshape.connector.store.jpa.JpaSource" and the other mode:classname="org.modeshape.connector.filesystem.FileSystemSource") ?

OR

do I need to have two separate repositories (i.e. two mode:repository) each of them using it's own mode-source? ... I'm not sure,but from what I've read seems like the first option is not possible...?

1

1 Answers

2
votes

Yes, it's possible to have a single JCR repository be backed by multiple connectors. As you mention, in the ModeShape configuration file each "mode:repository" can reference a single "mode:source" element (which describes a source and the connector used to talk to that source). So the way to do this is to define a "mode:source" that uses the federating connector, configured to use use two (or more) other sources.

See Chapter 14 of our Reference Guide for more detail about the federation connector, how it works, and how to configure it. Chapter 6 of our Getting Started Guide also walks through an example of simple application that uses federation, and shows how to download, build, and run the application. The configuration file is included in the downloadable source, but is also in the source code repository for ModeShape here.

The sample application uses a single JCR repository to store information about all kinds of vehicles. But federation is used to store automobile information in-memory, aircraft information in a JDBC database, and UFO information on the file system.