Connecting to Hippo Repository in Clojure

By vijay on June 1, 2011 — 1 min read

The first thing or the most important thing I wanted to learn in Clojure is the Java-Interop stuff. Since this would give me instant productive feeling aligning with my current line of work. Hippo Repository is built on top of Apache Jackrabbit and java clients can connect to the repository over RMI. I wanted to create a simple clojure program to connect to the running Hippo Repository instance and bask in the glow of REPL. So without much further ado here are the steps.

Step 0.
Install Emacs (this should be a no-brainer)

Step 1.
Install Leiningen.

Step 2. Create a new lein project

Step 3. Open project.clj and edit it to look like following:

We are using to enable the RMI Class loading security stuff.

Step 4. Hack the .java.policy to grant all the permissions. This file should be kept in your home directory.
WARNING!! Don’t do this on production system.

Step 5. Open a terminal and change to the hippo-clojuredirectory and download the dependencies using the following command:

Step 6. Open a new terminal and switch to a directory where you have your Hippo CMS project. Take a look at Hippo Trail on how to create new project. In the Hippo CMS project directory run the following command. You may wan to do it in a new terminal process.

Step 7. Go back to the terminal where you have opened the hippo-clojure directory, and run the following command:

Step 8. Finally, connect to Hippo Repository in REPL using Clojure/Java interop

Make sure you change the node name and property name to something that reflects your repository structure.

BTW, the methods which return an iterator (e.g. Item#getProperties) can be converted to a seq using iterator-seq function and treated like a regular seq in clojure. So start up and hack away!

Posted in: Programming

Leave a comment

Leave a Reply