Marco de Krijger PHPCR repository admin using jackrabbitexplorer
PHPCR repository admin
Ever wanted a PHPCR repository admin that is free and enables you to browse, edit, move, remove and create PHPCR nodes in Jackrabbit? I checked out jackrabbit explorer, fixed some stuff and have a nice working admin which enables me to create/remove/edit nodes, and even allows me to drag en drop entire trees. This article is howto set up jackrabbitexplorer that talks to repositories that are created with PHPCR.
I used PhpcrBrowser (https://github.com/symfony-cmf/phpcrbrowser) for some time to have a kind of admin for my jackrabbit repositories which are accessed using PHPCR. For just viewing it suffices, but I was still missing some kind of editing. I added a feature to phpcrbrowser which enabled the removal of nodes, which was a quick fix to have at least some control over the repository. But it still lacks the real editing of nodes.
So I went searching for a better admin. There are some commercial packages available which can do this job, but no. We are mostly working in open source land! So I first checked the available open source and free packages. This way I stumbled upon Jackrabbit explorer (http://code.google.com/p/jackrabbitexplorer). It promised to be very feature rich:
- Drag and dropping of nodes with subnodes
- Removing nodes
- Editing properties
But this project isn’t really active for like 2 years, so chances it was working well were small. I still gave it go since there weren’t any other/better packages in my first selection.
After some research, patching/hacking and testing I finally got it working, with surprisingly satisfiable results, which I would like to share for those who are interested in having a fine admin.
Basically what I have done is that I downloaded the source from jackrabbit explorer, patched it based on this patch (http://code.google.com/p/jackrabbitexplorer/issues/detail?id=32), and added an extra try catch block within the property listing. Also added apache common lang 2.6 lib to WEB-INF directory. And compiled it using Ant.
Prerequisites for setting up
Jackrabbit explorer is built as a war file which must be run in a java-enabled-webapp-server, like tomcat, jboss, etc. In this scenario we use Tomcat6.
We have recently moved jackrabbit from standalone server to a web-app within tomcat6 (https://github.com/jackalope/jackalope/wiki/Running-jackrabbit-in-tomcat-with-mysql). This is better for performance since we were also running solr within tomcat6. This way we just need one java-enabled-webapp-server, which saves us memory.
I won’t go into detail how to setup tomcat6, I assume you know how to this, and there are many manuals which will explain how to do so.
You will need a running jackrabbit server. It doesnt matter if it runs under tomcat6 or as standalone server. Jackrabbit explorer will run on both.
Setting it up
- Download the Jackrabbit explorer prepped war file and copy it to your webapps directory (e.g. /var/lib/tomcat6/webapps on CentOS)
- (only needed when you are using standalone jackrabbit server) Setup JCR lib in tomcat 6. Download JCR specification (http://download.oracle.com/otndocs/jcp/content_repository-2.0-fr-oth-JSpec) and move jcr-2.0.jar to tomcat6 lib directory (/usr/share/tomcat6/lib on CentOS/Ubuntu)
- Restart tomcat6
If all went well, you can find the app by navigating to your tomcat webserver e.g. http://localhost:8081/jackrabbitexplorer
Here you need to fill in your connection params to your jackrabbit server. I have only tested the RMI connection
Some connection string examples:
When running jackrabbit as WAR (tomcat is on 8081)
RMI URL: http://localhost:8081/jackrabbit/rmi
When running jackrabbit standalone on 8080
RMI URL: http://localhost:8080/rmi