The Handle System provides an open source implementation of the Handle System protocol (read the license: 4263537/5024).
I was curious to see and learn from the code. Also I am developing webservices using Axis2 and Spring to wrap the Handles Client API. See also Adam Smith’s Article about Developing Handle System Web Services at Cornell University and the source code Cornell University published just yesterday – handle_services.
For that you need more information then provided by the written documentation. This kind of information you can find by studying the source code directly. Furthermore one also might wish to extend the provided resolution mechanism of the included proxy. So I decided to have the source code in the same workspace in Eclipse as my webservice project. How to set up an independend handle server at localhost to play with dummy handles for testing purposes I described here.
Download the hdl6.2.4.tar.gz file from Handle Software Download. From that archive you will need the src.zip (source code) und handle.jar files. Extract the src.zip file . From the handle.jar you will need to extract a library to compile the handle source:
- run jar to extract the package net.cnri:
jar xvf handle.jar net/cnri - build a new jar from the extracted files and folders:
jar cvf cnriutil.jar net
You will also need the Java Servlet library ( jsdk.jar). Download it from here: SPECIFICATIONS – Download class files 2.3, rename the downloaded zip file to jsdk.jar.
How to import the code into a Eclipse Java project? There are two issues here – getting the libs right and the not eclipse-friendly project structure. This is the way it worked for me with Eclipse 3.2:
- Created a new, empty Project “hs2k” : File -> New Project , check “Use project folder as root for sources and class file”
- Imported the Handle source: Import -> General -> File System -> Browse to the hdl6.2.4/src folder and select all resources there, check “Create selected folders only”
- Configuring Build path: in Source-tab – set “Default Output Folder” to “hs2k/build”
- There were still errors because some libs are missing in the source code distribution.
- Getting the libs:
- Created new folder “lib” under the projects root
- Imported the cnriutil.jar and jsdk.jar into hs2k/lib folder
- Adding the jars in lib to projects build path: Properties -> Java Build Path -> Libraries -> Add JARs
After that I had still some errors due to 6.0 compiler compliance level. Problem were variables called enum. Enum is a reserved Java keyword now. So I renamed the variables to enm.
There are two advices you can find in the build.xml and build.properties files – setting “maintainerMode = true” and override the build.properties by using user.properties. To use user.properties correctly I had to edit the build.xml file:
<!-- include user.properties file for custom config -->
<property file="user.properties">
<property file="build.properties">
The user.properties:
target = 1.6
# maintainerMode = true
I couldn’t use the maintainer Mode cause the appropriate root_info were not available in the source code. Still I could compile the source code by using the appropriate ant tasks in Eclipse and make server and clients run like described in this post.