Database Reference
In-Depth Information
cations, you need to make sure the libraries listed in Table 13-6 are available on your
classpath.
Table 13-6. Dependencies for eXist remote XML:DB Java applications
Library
Description
$EXIST_HOME/lib/core/xmldb.jar
XML:DB API library.
$EXIST_HOME/exist.jar
eXist core.
Contains the eXist XML:DB client library implementation.
$EXIST_HOME/lib/core/xmlrpc-client-3.1.3.jar
Apache XML-RPC Client library.
Dependency of eXist's XML:DB client library.
$EXIST_HOME/lib/core/xmlrpc-common-3.1.3.jar
Apache XML-RPC common code.
Dependency of the Apache XML-RPC client library.
$EXIST_HOME/lib/core/commons-io-2.4.jar
Apache Commons I/O library.
Dependency of eXist's XML:DB client library.
There are just four main concepts that you need to understand in the XML:DB API
to make XML:DB requests to eXist:
Driver s
The XML:DB API makes use of drivers so that the same API can be used by dif‐
ferent vendors, and each vendor just needs to provide a driver. eXist provides the
Driver class org.exist.xmldb.DatabaseImpl (see Example 13-12 ).
Example 13-12. Registering eXist's XML:DB driver
final Class < Database > dbClass =
( Class < Database >) Class . forName ( "org.exist.xmldb.DatabaseImpl" );
final Database database = dbClass . newInstance ();
database . setProperty ( "create-database" , "true" );
DatabaseManager . registerDatabase ( database );
Collection s
A Collection in the XML:DB API maps onto a collection in the eXist database.
Collection s are the primary means for interacting with the XML:DB API.
Accessing a Collection requires authentication, after which all subsequent oper‐
ations on that collection and any subresources or subcollections of that Collec
tion use the same credentials. Administrative and query services can also be
retrieved from a Collection . See Example 13-13 .
 
Search WWH ::




Custom Search