2
votes

i was thinking about, how to organize "normal" text content (i.e a String, HTML Code ...) in Jackrabbit. Are there any recommended structures for plain text content (like for files)?

Should i store each text content as a binary (like i do with files) Node(nt:folder)--> Node(nt:file) --> Node(jcr:content with a jcr:data property which holds the binary)

Or is it better to have something like Node(nt:folder)--> Node(nt:unstructured with a jcr:message property which holds the string)

My third idea was to create a separate name space for text content Node(nt:folder)--> Node(my:text with a jcr:message property which holds the string) Node(nt:folder)--> Node(my:html with a jcr:message property which holds the string) ...

What do you thing is the best solution? It would be great to discuss this.

2

2 Answers

1
votes

I would store regular text in a string property, unless it's a large (multi-kilobyte) text. This is similar to VARCHAR in a relational database.

For really large texts that are not 'files', I would use a binary property (a stream). Such properties are stored in the DataStore, which is slower to write and access than a string property, but will not load the whole item in memory, and will only store the same data once. This is similar to BLOB / CLOB in a relational database.

For files, I would use nt:folder / nt:file. This is similar to a file in a file system.

1
votes

Storing text and html content as nt:file structures makes it visible via WebDAV and other tools that understand those structures. That can be useful depending on your application.

If you don't need this, you can just store your textual content as properties. In this case, using standard property names: jcr:title, jcr:description etc. as defined in the Standard Application Node Types section of the JSR-283 spec helps make things consistent.

See also http://wiki.apache.org/jackrabbit/DavidsModel which has some related recommendations.