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: Introduction
Date Mon, 18 Aug 2008 12:28:55 GMT
A document has been updated:

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

Document ID: 1505
Branch: main
Language: default
Name: Introduction (unchanged)
Document Type: Cocoon Document (unchanged)
Updated on: 8/18/08 12:28:54 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: 5072 bytes (previous version: 37 bytes)
Content diff:
--- <html><body><p>TODO</p></body></html>
+++ <html>
+++ <body>
+++ 
+++ <h1>Summary</h1>
+++ 
+++ <p>This sample makes use  of Cocoon components, built on top of Jackrabbit's
+++ <a href="http://www.jcp.org/en/jsr/detail?id=170">JSR-170</a> (better known
as
+++ JCR - Java Content Repository) implementation. It shows, how to query, access
+++ and write content.</p>
+++ 
+++ <p>The Cocoon JCR (Java Content Repository) sample makes use of the
+++ implementation independent abstraction layer, provided by the JCR block.</p>
+++ 
+++ <h1>Documentation</h1>
+++ 
+++ <p>The provided example allows three ways of accessing a content repository:</p>
+++ 
+++ <ul>
+++ <li>styled repository browsing</li>
+++ <li>native repository access</li>
+++ <li>XPath query</li>
+++ </ul>
+++ 
+++ <p>Furthermore, a basic write operation can be used.</p>
+++ 
+++ <p>We will use the following components:</p>
+++ 
+++ <ul>
+++ <li>a TraversableGenerator for browsing</li>
+++ <li>a SourceFactory for accessing the content repository</li>
+++ <li>a JCRQueryTransformer for placing XPATH queries</li>
+++ </ul>
+++ 
+++ <p>Assuming, that our sample runs the following sitemap:</p>
+++ 
+++ <pre>&lt;map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"&gt;
+++   &lt;map:pipelines&gt;
+++     &lt;map:pipeline&gt;
+++ 
+++       &lt;map:match pattern="populate"&gt;
+++         &lt;map:generate src="populate.xml" /&gt;
+++         &lt;map:transform type="cinclude" /&gt;
+++         &lt;map:transform type="write-source" /&gt;
+++         &lt;map:serialize&gt; ... &lt;/map:serialize&gt;
+++       &lt;/map:match&gt;
+++ 
+++       &lt;map:match pattern="browse/"&gt;
+++         &lt;map:generate type="traversable" src="jcr://" /&gt;
+++         &lt;map:transform src="dir2samples.xsl" /&gt;
+++         &lt;map:serialize&gt; ... &lt;/map:serialize&gt;
+++       &lt;/map:match&gt;
+++       &lt;map:match pattern="browse/**/"&gt;
+++         &lt;map:generate type="traversable" src="jcr://{1}/" /&gt;
+++         &lt;map:transform src="dir2samples.xsl" /&gt;
+++         &lt;map:serialize&gt; ... &lt;/map:serialize&gt;
+++       &lt;/map:match&gt;
+++       &lt;map:match pattern="browse/**"&gt;
+++         &lt;map:generate src="jcr://{1}" /&gt;
+++         &lt;map:transform src="dir2samples.xsl" /&gt;
+++         &lt;map:serialize&gt; ... &lt;/map:serialize&gt;
+++       &lt;/map:match&gt;
+++ 
+++       &lt;map:match pattern="repository/"&gt;
+++         &lt;map:generate type="traversable" src="jcr://" /&gt;
+++         &lt;map:serialize type="xml" /&gt;
+++       &lt;/map:match&gt;
+++       &lt;map:match pattern="repository/**/"&gt;
+++         &lt;map:generate type="traversable" src="jcr://{1}/" /&gt;
+++         &lt;map:serialize type="xml" /&gt;
+++       &lt;/map:match&gt;
+++       &lt;map:match pattern="repository/**"&gt;
+++         &lt;map:generate src="jcr://{1}" /&gt;
+++         &lt;map:serialize type="xml" /&gt;
+++       &lt;/map:match&gt;
+++ 
+++     &lt;/map:pipeline&gt;
+++   &lt;/map:pipelines&gt;
+++ &lt;/sitemap&gt;
+++ </pre>
+++ 
+++ <p>The first section, matching the <em>populate </em>pattern, does what
the name
+++ says: It writes sample content to the repository, which is then available
+++ internally for browsing <em>jcr://</em> URIs.</p>
+++ 
+++ <p>After pointing your browser to</p>
+++ 
+++ <pre>http://localhost:8080/cocoon-jcr-sample/populate</pre>
+++ 
+++ <p>and each of the response messages tell success, you can now access content.
+++ To receive the repository root, point your browser to</p>
+++ 
+++ <pre>http://localhost:8080/cocoon-jcr-sample/browse/</pre>
+++ 
+++ <p>The <em>browse </em>section will be explained in detail. Let's first
have a
+++ look at parts of the Spring configuration file:</p>
+++ 
+++ <pre>  &lt;bean name="org.apache.cocoon.generation.Generator/traversable"
+++     class="org.apache.cocoon.generation.TraversableGenerator"&gt;
+++   &lt;/bean&gt;
+++ </pre>
+++ 
+++ <p>The generator is used to generate content, read from a source, which allows
+++ traversable operations. By this, locations and paths are represented as trees.
+++ For more information about sources, see
+++ <a href="http://excalibur.apache.org/apidocs/">Apache Excalibur JavaDoc</a>.
+++ </p>
+++ 
+++ <p>Next, we define a SourceFactory for <em>jcr://</em> URIs. This factory
+++ represents the connector between a specified URI and the JCR repository, in this
+++ case Jackrabbit. For more details on configuration, please see
+++ <a href="daisy:1507">JCRSourceFactory</a>.</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;/property&gt;
+++     &lt;property name="typeInfos"&gt; ... &lt;/property&gt;
+++   &lt;/bean&gt;
+++ </pre>
+++ 
+++ <p>As you now know, how resources are resolved, we understand, why we can
+++ forward requests to the predefined generator.</p>
+++ 
+++ <pre>      &lt;map:match pattern="browse/**"&gt;
+++         &lt;map:generate src="jcr://{1}" /&gt;
+++         &lt;map:transform src="dir2samples.xsl" /&gt;
+++         &lt;map:serialize&gt; ... &lt;/map:serialize&gt;
+++       &lt;/map:match&gt;
+++ </pre>
+++ 
+++ <p>Pointing your browser at</p>
+++ 
+++ <pre>http://localhost:8888/cocoon-jcr-sample/browse/cocoon/sitemap</pre>
+++ 
+++ <p>the generator will resolve the JCR path <em>jcr://cocoon/sitemap</em>,
using
+++ the referenced JCRSourceFactory.</p>
+++ 
+++ <h1>Configuration</h1>
+++ 
+++ <h1>Further reading</h1>
+++ 
+++ </body>
+++ </html>


Mime
View raw message