Database Reference
In-Depth Information
Service name(s)
Java class (org.exist.xmldb)
Description
RemoteDatabaseInstanceManager
eXist Database Instance
Management Service
extension for XML:DB.
DatabaseInstanceManager
eXist Index Query Service
extension for XML:DB.
IndexQueryService
RemoteIndexQueryService
With the XML:DB API in eXist, you are responsible for cleaning
up after yourself!
That is to say, if you open a collection, you
must close the collection
when you are finished with it; likewise, if you open a resource, you
must free that resource
when you are finished with it.
You can close a collection by calling its
close
method, and you can
free a resource by casting it to an
org.exist.xmldb.EXistRe
source
and calling its
freeResources
method.
Examples.
The source code of four small complete examples of using the XML:DB
Remote API from Java—to store a file, retrieve a file, query the database, and remove
a file—are included in the folder
chapters/integration/xmldb-client
of the
book-code
Git repository (see
“Getting the Source Code” on page 15
).
To compile the examples, enter the
xmldb-client
folder and run
mvn package
.
Store example.
You can then execute the StoreApp example like so:
java -jar xmldb-client-store/target/xmldb-client-store-1.0-example.jar
This shows the available arguments for using the StoreApp.
A complete example of using the application might look like the following, which
would upload the file
/tmp/large.xml
to the collection
/db/my-new-collection
in eXist:
java -jar xmldb-client-store/target/xmldb-client-store-1.0-example.jar
localhost 8080 /tmp/large.xml true /db/my-new-collection admin
The XML:DB StoreApp example takes an extra parameter com‐
pared to the StoreApp examples for other APIs, as the API requires
you to know if you are storing an XML or binary document. You
may use
true
for XML documents, and
false
for binary
documents.
Retrieve example.
You can execute the RetrieveApp example like so:
java -jar xmldb-client-retrieve/target/xmldb-client-retrieve-1.0-example.jar
Search WWH ::
Custom Search