5.1 A File System-backed Content Repository

An obvious implementation of a content repository is as a layer on top of a conventional file system.

Consider, for example, a file system with the following layout:

content/

newpaintings/

bigredstripe.gif

bigredstripe.desc

oldpaintings/

sistinechapel.gif

sistinechapel.desc


Here is a possible mapping of this file structure to the content repository:

Node

Property = "..."

content/

/

newpaintings/

├─newpaintings

bigredstripe.gif

│ ├─bigredstripe.gif

(creation date of the file)

│ │ ├─jcr:created = "2001-01-01T00:00:00.000Z"

<binary data>


│ │ └─jcr:content
│ │ └─myapp:data = <binary data>

bigredstripe.desc

│ └─bigredstripe.desc

(creation date of the file)

│ ├─jcr:created = "2001-01-02T00:00:00.000Z"

"An excellent example..."


│ └─jcr:content
│ └─myapp:data = "An excellent..."

oldpaintings/

└─oldpaintings

sistinechapel.gif

├─sistinechapel.gif

(creation date of the file)

│ ├─jcr:created = "2001-01-03T00:00:00.000Z"

<binary data>


│ └─jcr:content
│ └─myapp:data = <binary data>

sistinechapel.desc

└─sistinechapel.desc

(creation date of the file)

├─jcr:created = "2001-01-04T00:00:00.000Z"

"Not bad."


└─jcr:content
└─myapp:data = "Not bad."


In this example, both directories and files are mapped to nodes. Nodes that represent files have a jcr:created property and a jcr:content node. The jcr:content node in turn has a single myapp:data property that holds the actual contents of the corresponding file (note that the nodes representing the files bigredstripe.gif and so forth, are of node type nt:file; see 6.7.22.6 nt:file).

A variation on the above arrangement is to reflect the directory structure directly but combine the file pairs (the picture and the description text) into a single node:

Node/

Property = "..."

content/

/

newpaintings/

├─newpaintings

bigredstripe.gif

│ └─bigredstripe


(creation date of .gif or .desc
whichever was first)

│ ├─jcr:created = "2001-05-03T00:00:00.000Z"
│ │

<binary data>


│ └─jcr:content
│ ├─myapp:image = <binary data>

bigredstripe.desc
"An excellent example
of stripeism."

│ └─myapp:desc = "An excellent example
of stripeism."

oldpaintings/

└─oldpaintings

sistinechapel.gif

└─sistinechapel


(creation date of .gif or .desc
whichever was first)

├─jcr:created = "2001-06-04T00:00:00.000Z"

<binary data>


└─jcr:content
├─myapp:image = <binary data>

sistinechapel.desc
"Not bad."

└─myapp:desc = "Not bad."


In this example, there is no longer a one-to-one correspondence between file and hierarchy node (though as above, nodes of type nt:file combined with application-specific content node types are used).