JCRSourceFactory is an implementation of
ModifiableTraversableSource on top of a JCR (aka JSR-170) repository.
Since JCR allows a repository to define its own node types, it is necessary
to configure this source factory with a description of what node types map to
"files" and "folders" and the properties used to store source-related data.
A typical configuration for a naked Jackrabbit repository is as follows:
<source-factories>
<component-instance class="org.apache.cocoon.jcr.source.JCRSourceFactory" name="jcr">
<folder-node type="rep:root" new-file="nt:file" new-folder="nt:folder"/>
<folder-node type="nt:folder" new-file="nt:file"/>
<file-node type="nt:file" content-path="jcr:content" content-type="nt:resource"/>
<file-node type="nt:linkedFile" content-ref="jcr:content"/>
<content-node type="nt:resource"
content-prop="jcr:data"
mimetype-prop="jcr:mimeType"
lastmodified-prop="jcr:lastModified"
validity-prop="jcr:lastModified"/>
</component-instance>
</source-factories>
A <folder-node> defines a node type that is mapped to a
non-terminal source (i.e. that can have children). The new-file
and new-folder attributes respectively define what node types
should be used to create a new terminal and non-terminal source.
A <file-node> defines a note type that is mapped to a
terminal source (i.e. that can have some content). The
content-path attribute defines the path to the node's child
that actually holds the content, and content-type defines the
type of this content node.
The content-ref attribute is used to comply with JCR's
nt:linkedFile definition where the content node is not a
direct child of the file node, but is referenced by a property of this file
node. Such node types are read-only as there's no way to indicate where the
referenced content node should be created.
A <content-node> defines a node type that actually holds
the content of a file-node . The content-prop
attribute must be present and gives the name of the node's binary property
that will hold the actual content. Other attributes are optional:
mimetype-prop defines a string property holding the
content's MIME type,
lastmodified-prop defines a date property holding the
node's last modification date. It is automatically updated when content is
written to the content-node .
validity-prop defines a property that gives the validity
of the content, used by Cocoon's cache. If not specified,
lastmodified-prop is used, if present. Otherwise the source
has no validity and won't be cacheable.
The format of URIs for this source is a path in the repository, and it is
therefore currently limited to repository traversal. Further work will add
the ability to specify query strings.
version: $Id: JCRSourceFactory.java 449153 2006-09-23 04:27:50Z crossley $ |