Database Reference
In-Depth Information
java -jar xmldb-embedded-example/target/xmldb-embedded-example-1.0-example.jar
/db/my-new-collection /tmp/test.xml "//thing" admin
Given the preceding arguments, the example application would perform the follow‐
ing steps:
1. Start up the embedded eXist database.
2. Get a reference to the collection /db/my-new-collection in eXist (the collection
will be created if it does not already exist).
3. Upload the file /tmp/test.xml to the collection /db/my-new-collection in eXist
(again, the collection will be created if it does not already exist).
4. Execute the query //thing against the /db/my-new-collection collection, and
print the results.
5. Remove the /db/my-new-collection/test.xml file.
6. Shut down the eXist database.
Fluent API
The Fluent API was developed by PiotrKaminski and contributed to the eXist project
in 2007. The Fluent API has the goal of making it much simpler to use eXist from
within your own Java applications as an embedded database. It follows the design
principle of a Fluent interface , which should make Java code interacting with eXist
more readable. The current best source of Fluent API documentation is within the
Fluent API JavaDocs .
The Fluent API, just like the XML:DB Local API, talks directly to eXist's internal Java
API through function calls within the same JVM process.
In addition to the runtime dependencies set out in Table 13-8 , you will also need the
one listed in Table 13-10 .
Table 13-10. Additional dependency for using the Fluent API
Library
Description
Scope
$EXIST_HOME/lib/extensions/exist-fluent.jar
Fluent API Library
Compile
There are just four main concepts that you need to understand in the Fluent API to
interact with eXist:
Database s
The Fluent API makes use of Database to represent a distinct connection by a
user to an embedded eXist instance. Connecting to a database requires authenti‐
cation, after which all subsequent operations on that database and its folders or
 
Search WWH ::




Custom Search