A very basic example of how to query the Hippo repository (or any other WebDAV compliant server) from a plain java class.
Abstract
Since the Hippo repository is a WebDAV compliant server (see architecture documentation) it can be approached using standard libraries like the slide WebDAV client library and HttpClient. This page presents a simple java class for querying the repository using just these standard libraries.
The code
Search is a simple java class which connects to the Hippo repository and executes a DASL query.
SearchMain is an example of how this class can be used, it implements a commandline interface on it for use as a standalone application.
Demonstration
Attached to this page (see below) you will find a zip file containing a simple Maven 1.x project which can be used for evaluating this approach. It creates a standalone java application using these classes.
Step 1:
Install and start the hippo repository, see Installing Hippo Repository Binary
Step 2:
Install Maven 1.x
Step 3:
Download and unzip the attached zipfile to any directory on your hard disk.
Step 4:
Start a command shell, go to this directory and type the following commands:
$ maven
This will take a while and needs to be done only once. When finished a subdirectory 'target' will have been created with (among other files) a file called 'hippo-webdav-search-1.00.00-uber.jar'. This file is a so-called uberjar and acts like a standalone java application.
Step 5:
Run
$ java -jar target/hippo-webdav-search-1.00.00-uber.jar
This will execute the application and if you are running a default Hippo repository the results of the executed query will be printed on the console.
Step 6:
Run
$ java -jar target/hippo-webdav-search-1.00.00-uber.jar --help
for help on the available commandline options. Look at and experiment with the files in the etc directory: search.properties and dasl.xml
Future directions
The Search class is a very simple utility class and makes no assumptions about how it is invoked, the supplied SearchMain class is meant as an example of how it can be used. It can easily be used in another context, it can be part of a larger application, or an ant task, a jsp tag, a junit testdecorator etc.
| Name | Size | Creator (Last Modifier) | Creation Date | Last Mod Date | Comment | ||
|---|---|---|---|---|---|---|---|
| 8 kB | Wander Grevink | May 23, 2006 | May 23, 2006 |