Sylvain Wallez wrote:
Hi all,

I just committed a new JCR block. This block provides two features: a Repository component, and a "jcr:" protocol.

Awesome news!

The Repository component is nothing more than the standard javax.jcr.Repository interface, but provides a way to centrally define how to access the repository (Jackrabbit conf file, JNDI, etc) and how to obtain credentials to log into the repository. There's currently only one concrete implementation that uses Jackrabbit.

That's very cool... I needed something like this for Linotype.

The JCR source factory is more interesting, as it provides a traversable and modifiable source that hides away the details of the repository structure and node types. To achieve this, we need to configure it by defining a mapping from node types to "files" and "folders" that will be visible through the "jcr:" protocol.

The result is that we can now use a JCR repository in Cocoon just like we use the regular filesystem.

As an example, here's how this source factory is configured for the standard filesystem-like node types defined by JCR:
<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>

how do you expand the prefixes in the attribute values?

More detailed information about this configuration is given in o.a.c.jcr.source.JCRSourceFactory's javadoc.

This source factory is still a bit primitive regarding all features provided by JCR. Future enhancements include querying the repository, handling workspaces, node properties, versions, etc.

Your feedback and opinions about this initial implementation and its future evolutions are more than welcome!

In linotype, what I needed was a way to store new items in the repository and then query the repository for the last n in reversed chronological order (LIFO).


There are many ways we can glue query capabilities to JCR in cocoon, I would like to discuss with you people what is best way to do that and what are the requirements.

--
Stefano.



Reply via email to