4

I am using Apache JackRabbit for storing the images for my application. I have just started to use it and I still have some questions unanswered:

  1. What is the difference between a content repository and a database?

  2. Can you use a content repository for saving all the data of an application instead of a database? (I know you can add all kind of nodes and properties it is more like a question if you actually should save everything in the content repository).

  3. Are content repositories always organized in hierarcies?

I am struggeling with the definition of what makes a content repository.

LuckyLuke
  • 47,771
  • 85
  • 270
  • 434

2 Answers2

3

I am using Apache JackRabbit for storing the images for my application.

Why? If you don't know what it's for? That's not one of the things it is best at. You would be better off storing images in the file system.

What is the difference between a content repository and a database?

A database is for structured data that you want to access in a transactional way. A content repository is basically for documents, where you may need e.g. versioning, hierarchy, ownership, ...

Can you use a content repository for saving all the data of an application instead of a database?

Yes but you shouldn't.

Are content repositories always organized in hierarchies?

How to organize it is up to you but that's the way it's usually done.

As an example, I am presently using four datastores:

  1. The file system, for images and other static resources.
  2. A database, for structured transactional data.
  3. An LDAP server, for user data.
  4. A JCR repository, for documents, versioning, hierarchy, WebDAV access, etc.
user207421
  • 305,947
  • 44
  • 307
  • 483
3

If you allow a shameless plug, my "Java Content Repository - the best of both worlds" article might help understand what a content repository is.

In the JSR 283 spec, the Java Content Repository is defined as

an abstract model and a Java API for data storage and related services commonly used by content-oriented applications.

So you could say it's a storage system that's best suited for content-oriented applications, for example as a back-end for websites. It's more similar to hierarchical and object databases than to relational databases, and we often refer to it as "a file system on steroids" meaning that it's well suited for file storage but does much more. The "related services" in the above definition are quite rich and include versioning, observation, fine-grained access control, structured and full-text search - many things that you need when working with content.

That being said, I disagree with @EJP that using multiple datastores is necessarily better - a major benefit of JCR is that it nicely integrates file storage with database-like operations and unstructured schema-less storage, without requiring the kind of hybrid system that @EJP mentions and that might be much harder to manage. Depending on your needs, more specialized storage systems might be useful, but JCR offers a lot of out-of-the-box functionality that you'd have to reinvent if you create your own hybrid storage system.

pkalinow
  • 1,619
  • 1
  • 17
  • 43
Bertrand Delacretaz
  • 6,100
  • 19
  • 24
  • That may be the case as regards JCR, but unfortunately I am only dealing with the Jckrabbit implementation, which for some reason has imposed a whole new API over the JCR API, and which I have found frankly impossible to integrate as a single source. And I'm certainly not prepared to give up SQL transactions and ACID properties for value transactions in favour of whatever I may find in any content repository. – user207421 Dec 23 '13 at 09:38
  • Which "new API" do you mean? Apache Jackrabbit is the reference implementation for JSR 170 and 283, so it does fully support JCR. – Bertrand Delacretaz Dec 23 '13 at 14:36
  • I mean for example all the extra permissions they added, that don't map cleanly to the JCR ones. NB I didn't claim it doesn't support JCR. – user207421 Dec 23 '13 at 23:47
  • Ok, thanks for clarifying. As far as @LuckyLuke's use case of storing images and other data is concerned, additional permissions might not make a difference. – Bertrand Delacretaz Dec 24 '13 at 07:48