Yes, Clojure has very good Java interop. I lean towards embedding too as it gives much more control over BaseX and I want it to become an integral part of the webapp.
On Tue, Jan 19, 2016 at 10:49 AM, Dirk Kirsten <d...@basex.org> wrote: > Hello Marc, > > I have no idea how Clojure works (but would be very interested, but time > is a scarce resource...), but according to > https://clojuredocs.org/clojure.core/import you should be able to simply > import Java classes/libraries. If this is possible it should be a simple > process: Put the BaseX.jar into the library path and import the > necessary classes (you can take a look at our Java examples in the wiki, > should work the same). > > Well, if your pirgamm is not client/server oriented I would definitely > try to embed BaseX. The main benefit of the BaseX Client/Server version > is that you can access it with multiple processes at the same time. Of > course, the client version is theoretically slower (it has to send stuff > over sockets, It has to create/parse TCP packets and it might be a > significant overhead to use TCP if you have a rather small query or > result set. But this overhead could also be insignificant, if you don't > have this and your client/server have a fast connection (i.e. on the > same server or the same network). > > Cheers > Dirk > > On 01/18/2016 11:49 PM, Marc van Grootel wrote: >> Hi, >> >> I'm considering to write a web layer for BaseX based in Clojure. It >> may be a somewhat longer term project but I would like to bring XML >> and BaseX closer to Clojure programming. Clojure web apps usually are >> able to run under various servers/containers (Jetty/Netty etc.) and I >> would like to be able to use Clojure libraries to handle things like >> request routing, security and authentication outside of BaseX/XQuery. >> >> Some questions that I have while I'm orienting myself. Some of it >> touches on integration areas that are quite new to me so I am happy to >> get some general pointers that I can use to dig further. >> >> For Clojure I found only one BaseX client library [1] which wraps the >> standard Java TCP client and it seems to work fine. >> >> But I have some broader questions such as >> >> - Choosing between using the client or much more intimately embedding >> BaseX as a library. The latter is probably much more complex but I'm >> figuring this is the only way to get a good integration as the TCP >> client is rather limited in functionality. But where to start? What >> layers of the existing servlet integration to peel off, which ones to >> keep. Is BaseXServer.java a good starting point? >> >> - Is the TCP client generally slower than via the Java API? A couple >> of queries via clj-basex didn't impress me much qua speed (compared to >> same query via the GUI). >> >> Any starting points or general considerations that could help me prune >> the (re)search tree are very much appreciated. >> >> >> --Marc >> >> [1] https://github.com/kouphax/clj-basex > > -- > Dirk Kirsten, BaseX GmbH, http://basexgmbh.de > |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > `-- Phone: 0049 7531 91 68 276, Fax: 0049 7531 20 05 22 > -- --Marc