8 messages in org.apache.jackrabbit.usersDM Rule #6: Files are Files are Files.
FromSent OnAttachments
David NueschelerJul 7, 2007 4:29 am 
Tako SchotanusJul 10, 2007 4:37 am 
fmandelbaumOct 29, 2007 1:06 pm 
Julian ReschkeOct 30, 2007 12:37 am 
David NueschelerOct 30, 2007 3:13 am 
Julian ReschkeOct 30, 2007 4:10 am 
Felix MeschbergerOct 30, 2007 4:11 am 
Fabián MandelbaumOct 30, 2007 4:30 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:DM Rule #6: Files are Files are Files.Actions...
From:David Nuescheler (davi@gmail.com)
Date:Jul 7, 2007 4:29:38 am
List:org.apache.jackrabbit.users

Explanation: ---

If a content model exposes something that even remotely "smells" like a file or a folder I try to use (or extend from) nt:file, nt:folder and nt:resource.

In my experience a lot of generic applications allow interaction with nt:folder and nt:files implicitly and know how to handle and display those event if they are enriched with additional meta-information. For example a direct interaction with file server implementations like CIFS or Webdav sitting on top of JCR become implicit.

I think as good rule of thumb one could use the following: If you need to store the filename and the mime-type then nt:file/nt:resource is a very good match. If you could have multiple "files" an nt:folder is a good place to store them.

If you need to add meta information for your resource, let's say an "author" or a "description" property, extend nt:resource not the nt:file. I rarely extend nt:file and frequently extend nt:resource.

Example --- Let's assume that someone would like to upload an image to a blog entry

/content/myblog/posts/iphone_shipping

maybe the initial gut reaction would be to add a binary property containing the picture.

While there certainly are good usecases to use just a binary property (let's say the name is irrelevant and the mime-type is implicit) in this case I would recommend the following structure for my blog example.

/content/myblog/posts/iphone_shipping/attachments [nt:folder] /content/myblog/posts/iphone_shipping/attachments/front.jpg [nt:file] /content/myblog/posts/iphone_shipping/attachments/front.jpg/jcr:content [nt:resource]