Using Lenya with JCR (2.0 only)
Note: The JCR support for Lenya is in an early stage and should be considered experimental at this point in time. It should probably not be used for any productive purposes at this point in time.
The currently implemented approach
Currently the integration of Lenya with JCR is based upon the writetable and traversable JCRSource provided by Cocoon. At an earlier stage in Lenya history, the developers have introduced the lenya:-Protocol as the contract between the sitemap and retrieving and storing content. This investment has been leveraged now by providing a mapping of the lenya: to the jcr: protocol in order to integrate with JCR.
Practical Setup
- Install Lenya as you would usually do.
- Set the JCRNodeFactory as default node factory in
java/org/apache/lenya/lenya.roles. You need to search for the existing
entry and change it.
<role name="org.apache.lenya.cms.repository.NodeFactory" shorthand="node-factory" default-class="org.apache.lenya.cms.jcr.JCRNodeFactory"/>
- Start Jetty.
- Call the "Import into JCR" usecase to migrate the content:
(select your publication and click OK)http://localhost:8888/index.html?lenya.usecase=jcr.import
- Delete the content directory of your publication ($LENYA_HOME/lenya/pubs/<yourpub>/content). You don't need it anymore.
You can log into Lenya again and you should be able to work with the application exactly as before. Just your content comes from and will be stored in the JCR repository.
What you should know
As Lenya leverages the Cocoon JCRSource implementation, any configuration of the repository itself has to be done exactly as you would to this in Cocoon. Search cocoon.xconf (in Lenya) for the component (not: component-instance) configuration for the component with the role javax.jcr.Repository. There you will find information such as
- the physical location of the repository
- the location of the repository.xml and jaas.config files (this is Jackrabbit stuff, please look there)
More on the Cocoon JCRSource can be found here:
http://wiki.apache.org/cocoon/JcrSource
What's missing (at least)
Note once again: This is experimental!
- Lenya AAA is not yet mapped to the repository (currently the root id is "michi")
- JCR transaction handling is not yet used