...
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 Repository --> <repository> <id>in-project</id> <name>In Project Repo</name> <url>file://${project.basedir}\repo</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.
...
Example : java XQueryExample /db/apps/HeD/modules/data/ doc(\"books.xml\")/bookstore/book[price>30.00]
Example 4 : CreateUpdateExample
This example reads the input data instance file and write into the provided collection into Exist DB. If the provided collection does not exist it will create one. 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 file to read and store in the collection
Example : java CreateUpdateExample /db/apps/HeD/modules/data/ D://StoreData.xml