Hi Christian,
I want to be able to use the existing commands (ADD for instance) regardless of whether the module is being accessed from the command line or as a part of a client/server architecture.
In one case (that I've already written), I'm reading in an unsupported "binary" format and converting it into XML FDoc(s)/FElem(s) that can be returned from my module and used with the database module to write documents to the database. But, in the other case, I also want to be able to read my binary format and write XML directly to the database directly from my Java module (and then users of my module could use the BaseX database module to do further things with it from there).
I see how to do ADDs from the command line and how to do it from the client/server API. I guess I'm just not sure how a module is supposed to go about this though (since it will be running from an XQuery that could be running from the command line or a client/server setup). Does it check to see the context in which it's running and then use one or the other method? I wouldn't want someone using my module in the client/server mode to have to input username/password again; I'd just want the permissions from the existing context to be used.
Perhaps I'm interested in the streaming? What I'm doing, to be more specific, is reading in MARC (machine readable cataloging) records and converting them to MARCXML. Since some MARC records files will contain a large number of records, I was wanting to write them directly, one by one, to the database (where they could then be used by the db module). Is there a streaming interface that I should be looking at instead that would avoid having everything in memory at once?
If it helps explain it any better, here is how I did it in exist-db. I'm just looking to do the same thing in the BaseX way now.
Thanks for any pointers,
Kevin