...
Downloaded required JARs (Unmanaged third party JARs) and created In-Project repository into vacds-order-service/order-service-engine-ri/repo/ and added repository in vacds-order-service/order-service-engine-ri/pom.xml
Code Block theme Eclipse language xml title In Project Repo <repositories> <!-- In-Project RepostiryRepository --> <repository> <id>in-project</id> <name>In Project Repo</name> <url>file://${project.basedir}\repo</url> </repository> </repositories>
Included following dependencies into vacds-order-service/order-service-engine-ri/pom.xml
Code Block theme Eclipse language xml title Exist DB Dependencies <!-- Exist DB Dependencies --> <dependency> <groupId>exist</groupId> <artifactId>exist</artifactId> <version>1.1.1</version> </dependency> <dependency> <groupId>exist</groupId> <artifactId>exist-xmldb</artifactId> <version>1.0</version> </dependency> <dependency> <groupId>org.apache.ws.xmlrpc</groupId> <artifactId>xmlrpc</artifactId> <version>2.0.1</version> <exclusions> <exclusion> <groupId>commons-logging</groupId> <artifactId>commons-logging</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.apache.xmlrpc</groupId> <artifactId>xmlrpc-client</artifactId> <version>3.1.3</version> </dependency>
- Created ExistDatabaseManager class in package org.socraticgrid.hl7.services.orders.functional of vacds-order-service/order-service-engine-ri/ project which will be used to initialize the database connection and returns org.xmldb.api.base.Collection. Any class in which Exist DB Query or Update functionality is required this class can be autowired to that class and can be used for performing Exist DB operation.
A property file named as exist-db.properties is created under src/main/resources of vacds-order-service/order-service-engine-ri/ project which contains following important properties and used by ExistDatabaseManager class to create database connection.
Code Block theme Eclipse language text title exist-db.properties url=xmldb:exist://192.168.1.180:8081/exist/xmlrpc collection=/db/apps/HeD/modules/data/ username=admin password=cdsreflab
The property collection contains absolute path of the folder which contains our XML Instance data files. As of now for data we created /db/apps/HeD/modules/data/ collection.
Examples
Example 1 : RetrieveExample
This example simply retrieves the content of provided data instance file. It takes 2 run time arguments as shown below :
args[0] Should be the name of the collection to access
args[1] Should be the name of the resource to read from the collection
Example : java RetrieveExample /db/apps/HeD/modules/data/ books.xml
Example 2 : XPathExample
This example compiles the provided XPath and retrieves the content from the provided collection. It takes 2 run time arguments as shown below :
args[0] Should be the name of the collection to access
args[1] Should be the XPath expression to execute
Example : java XPathExample /db/apps/HeD/modules/data/ /bookstore/book[price>30.00]
Example 3 : XQueryExample
This example compiles the provided XQuery and retrieves the content from the provided collection. It takes 2 run time arguments as shown below :
args[0] Should be the name of the collection to access
args[1] Should be the XQuery to execute
Example : java XQueryExample /db/apps/HeD/modules/data/ doc(\"books.xml\")/bookstore/book[price>30.00]