cocoon-docs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From da...@cocoon.zones.apache.org
Subject [DAISY] Updated: JCRSourceFactory
Date Mon, 18 Aug 2008 14:31:17 GMT
A document has been updated:

http://cocoon.zones.apache.org/daisy/documentation/1507.html

Document ID: 1507
Branch: main
Language: default
Name: JCRSourceFactory (unchanged)
Document Type: Cocoon Document (unchanged)
Updated on: 8/18/08 2:31:10 PM
Updated by: Lukas Lang

A new version has been created, state: draft

Parts
=====

Content
-------
This part has been updated.
Mime type: text/xml (unchanged)
File name:  (unchanged)
Size: 5176 bytes (previous version: 37 bytes)
Content diff:
--- <html><body><p>TODO</p></body></html>
+++ <html>
+++ <body>
+++ 
+++ <h1>Summary</h1>
+++ 
+++ <p>The JCRSourceFactory implements the Excalibur SourceFactory interface on top
+++ of a JCR (aka <a href="http://www.jcp.org/en/jsr/detail?id=170">JSR-170</a>)
+++ repository. It can be used to obtain resources, specified by <em>jcr://
+++ </em>URIs.</p>
+++ 
+++ <h1>Documentation</h1>
+++ 
+++ <p>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.</p>
+++ 
+++ <h3>Example</h3>
+++ 
+++ <p>A SourceFactory can be used within a sitemap generator component:</p>
+++ 
+++ <pre>  &lt;map:match pattern="**"&gt;
+++     &lt;map:generate src="jcr://{1}" /&gt;
+++     &lt;map:serialize /&gt;
+++   &lt;/map:match&gt;</pre>
+++ 
+++ <p>Every request will be forwarded to the JCRSourceFactory. Please have a look
+++ at the configuration section for further details.</p>
+++ 
+++ <h3>Configuration</h3>
+++ 
+++ <p>JCRSourceFactory is configured via Spring and gets a repository injected. A
+++ typical Spring configuration for a naked Jackrabbit repository is as follows:
+++ </p>
+++ 
+++ <pre>   &lt;bean name="org.apache.excalibur.source.SourceFactory/jcr"
+++      class="org.apache.cocoon.jcr.source.JCRSourceFactory"&gt;
+++    &lt;property name="repository" ref="javax.jcr.Repository" /&gt;
+++    &lt;property name="credentials"&gt;
+++      &lt;bean class="javax.jcr.SimpleCredentials"&gt;
+++        ...
+++      &lt;/bean&gt;
+++    &lt;/property&gt;
+++    &lt;property name="typeInfos"&gt;
+++      &lt;util:map map-class="java.util.HashMap"&gt;
+++        &lt;entry key="rep:root"&gt;
+++          &lt;bean class="org.apache.cocoon.jcr.source.JCRSourceFactory$FolderTypeInfo"&gt;
+++            &lt;property name="newFileType" value="nt:file" /&gt;
+++            &lt;property name="newFolderType" value="nt:folder" /&gt;
+++          &lt;/bean&gt;
+++        &lt;/entry&gt;
+++        &lt;entry key="nt:folder"&gt;
+++          &lt;bean class="org.apache.cocoon.jcr.source.JCRSourceFactory$FolderTypeInfo"&gt;
+++            &lt;property name="newFileType" value="nt:file" /&gt;
+++            &lt;property name="newFolderType" value="nt:folder" /&gt;
+++          &lt;/bean&gt;
+++        &lt;/entry&gt;
+++        &lt;entry key="nt:file"&gt;
+++          &lt;bean class="org.apache.cocoon.jcr.source.JCRSourceFactory$FileTypeInfo"&gt;
+++            &lt;property name="contentPath" value="jcr:content" /&gt;
+++            &lt;property name="contentType" value="nt:resource" /&gt;
+++          &lt;/bean&gt;
+++        &lt;/entry&gt;
+++        &lt;entry key="nt:linkedFile"&gt;
+++          &lt;bean class="org.apache.cocoon.jcr.source.JCRSourceFactory$FileTypeInfo"&gt;
+++            &lt;property name="contentPath" value="jcr:content" /&gt;
+++            &lt;property name="contentRef" value="jcr:content" /&gt;
+++          &lt;/bean&gt;
+++        &lt;/entry&gt;
+++        &lt;entry key="nt:resource"&gt;
+++          &lt;bean class="org.apache.cocoon.jcr.source.JCRSourceFactory$ContentTypeInfo"&gt;
+++            &lt;property name="contentProp" value="jcr:data" /&gt;
+++            &lt;property name="lastModifiedProp" value="jcr:lastModified" /&gt;
+++            &lt;property name="mimeTypeProp" value="jcr:mimeType" /&gt;
+++            &lt;property name="validityProp" value="jcr:lastModified" /&gt;
+++          &lt;/bean&gt;
+++        &lt;/entry&gt;
+++      &lt;/util:map&gt;
+++    &lt;/property&gt;
+++  &lt;/bean&gt;
+++  </pre>
+++ 
+++ <p>A FolderTypeInfo defines a node type that is mapped to a non-terminal source
+++ (i.e. that can have children). The newFileType and newFolderType fields
+++ respectively define what node types should be used to create a new terminal and
+++ non-terminal source.</p>
+++ 
+++ <p>A FileTypeInfo defines a note type that is mapped to a terminal source (i.e.
+++ that can have some content). The contentPath field defines the path to the
+++ node's child that actually holds the content, and contentType defines the type
+++ of this content node.</p>
+++ 
+++ <p>The contentRef field 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.</p>
+++ 
+++ <p>A ContentTypeInfo defines a node type that actually holds the content of a
+++ FileTypeInfo. The contentProp field must be present and gives the name of the
+++ node's binary property that will hold the actual content. Other attributes are
+++ optional:</p>
+++ 
+++ <ul>
+++ <li>mimeTypeProp defines a string property holding the content's MIME type,
+++ </li>
+++ <li>lastModifiedProp defines a date property holding the node's last
+++ modification date. It is automatically updated when content is written to the
+++ ContentTypeInfo.</li>
+++ <li>validityProp defines a property that gives the validity of the content, used
+++ by Cocoon's cache. If not specified, lastModifiedProp is used, if present.
+++ Otherwise the source has no validity and won't be cacheable.</li>
+++ </ul>
+++ 
+++ <p>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.</p>
+++ 
+++ <h1>Further reading</h1>
+++ 
+++ <p>Please see the <a href="daisy:1505">sample</a> page for more information.</p>
+++ 
+++ </body>
+++ </html>


Mime
View raw message