PHP talking to Magnolia CMS
Since we started working on Jackalope, we always claimed it would also provide an integration point with other enterprise systems. Last week, we set out to proof this idea. GrAİgory Joseph of the Java based Magnolia CMS came to help us on the Magnolia side of things. Magnolia is using the JCR reference implementation Jackrabbit for storing its content. After an interesting exchange on their design decisions and our ideas, we started to hack.
Trying to import an XML export from Magnolia in the JCR standard format showed that the Jackalope importer is not yet perfect. In the end Greg was faster in building a Magnolia module that exposes the Jackrabbit Davex binding that Jackalope uses to communicate with the server.
After that, things really started flowing. We managed to not only read data, but also write using the frontend editing feature of the CMF. Additionally, we managed to configure PHPCR-ODM to determine document classes based on the MetaData child every Magnolia page node has. And all of that using several parallel connections to the repositories, so that the normal pages and navigation can still be loaded from our standalone jackrabbit backend (you could just as well use another PHPCR implementation like jackalope-doctrine).
All in all a very successful hackday. We integrated the demos into the cmf-sandbox (branch magnolia_integration). See the MagnoliaController in src/Sandbox/MagnoliaBundle/Controller.
Screencapture showing the edit functionality
Installing the Sandbox with Magnolia
If you want to try things out for yourself, you need to:
- Download Magnolia Community Edition
- unpack it into a folder
- Download the Magnolia Jackrabbit-Davex Module and drop all .jar files from this archive into apache-tomcat-6.0.32/webapps/magnoliaAuthor/WEB-INF/lib/
- edit apache-tomcat-6.0.32/conf/server.xml to change the port from the default 8080 to 8888, so it looks something like ...
- remove open file limitations. in bash, this will be ulimit -n 5000
- launch magnolia with something like this: apache-tomcat-6.0.32/bin/magnolia_control.sh start tail -f apache-tomcat-6.0.32/logs/catalina.out
- visit localhost:8888 and follow the Magnolia installation (login with superuser/superuser)
If you followed the above steps, you should be able to access Magnolia data with Jackalope-Jackrabbit at http://localhost:8888/magnoliaAuthor/.davex/ (Note that there is no web browser access, as the servlet does not issue a basic auth challenge but just expect the credentials to be set from the beginning).
Now try the urls /magnolia_edit, /magnolia/about/subsection-articles/article and /magnolia_odm and read the code to see what we do.