Hi, Cyrus Daboo wrote: > Another question: is it reasonable to bypass XPath and SQL entirely and > build a query directly by creating QueryNode's? The reason I ask, is > that the CalDAV query I am trying to support is coming in in the form of > CalDAV's own XML syntax. Right now I am converting that to XPath and > then Jackrabbit converts that to the QueryNode tree. It may be more > efficient for me to bypass XPath and go direct to QueryNode's. I would > be interested in knowing if there are any pitfalls in doing that.
A clear drawback of this approach is that working with QueryNode's will make your application intimately linked with Jackrabbit, so switching to another JCR implementation will then be quite difficult. If you can live with that, then here's a few thoughts to start with: I believe you should be able to do this by implementing the o.a.j.query.QueryTreeBuilder interface and registering it using the ServiceRegistry mechanism used by o.a.j.query.QueryTreeBuilderRegistry. Then just pass the XML query string to QueryManager.createQuery() with the CalDAV query language name. See the o.a.j.query.xpath and o.a.j.query.sql implementations for details. I'm not sure if anyone has done this before except for the default XPath and SQL query languages, so you might run into some trouble along the way. At least the o.a.j.query.QueryManagerImpl class seems to have a hardcoded list of XPath and SQL as the supported query languages. If you decide take this path, then please let us know of any problems or successes you have! BR, Jukka Zitting