jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <jukka.zitt...@gmail.com>
Subject Re: Clojure JCR Bindings Interest Check
Date Thu, 18 Feb 2010 14:10:21 GMT
Hi,

On Thu, Feb 18, 2010 at 2:02 AM, Adam Foltzer <acfoltzer@gmail.com> wrote:
> Since I've only ever submitted one patch to an ASF project, I'll go ahead
> and use GitHub for now. I've been meaning to properly learn Git anyway, so
> that'll be good motivation. Once the shape comes together, it could always
> be moved.

Sounds good.

> As for the actual artifact, the clojure-contrib-sql API seems to be a good
> reference: http://richhickey.github.com/clojure-contrib/sql-api.html

Agreed.

> Interacting with JCR is more involved than using a JDBC connection, of
> course, but I think a lot of the same patterns could be used to access basic
> functionality.

Here's a quick draft of what potential client code could look like:

    (defn print-tree [node]
      (println (node :path))
      (doseq [child (child-nodes node)]
        (print-tree child)))

    (with-repository "http://localhost:8080/"
      (with-session "default" "admin" "admin"
        (print-tree (root-node session)))

> Of course, other nice "big-leap" ideas are very welcome.

It would be interesting to do stuff like generic tree traversal
methods. For example the above code could then be implemented like
this:

    (with-repository "http://localhost:8080/"
      (with-session "default" "admin" "admin"
        (traverse-tree #(println (%1 :path)))))

For other ideas, see the cool Scala stuff that Michael Dürig has been
working on: http://dev.day.com/content/ddc/blog.html?blog=author&author=Michael+Duerig

BR,

Jukka Zitting

Mime
View raw message