Berkely DB Contact Service

ICS 414 Persistency

For the past two assignments, I have been writing a Contact service using the REST architecture to simulate PUT and GET to store and retrieve contacts. But those contacts were held inside of memory rather than in a persistent data source. For this assignment, the contact service implements the Berkley DB to store all contact information so that a Wicket based web interface can interact with this database.

First of all, Berkley DB is a non-relational database based upon the key-value model. This fit the criteria for our contact service well as a contact will be given a unique ID number. Thus, this ID number would act as our primary key for the contact table. Although there are three implementations of Berkley DB, this assignment uses the Berkeley DB Java Edition.

For kata 1, I had to implement a way to get a contact by a time stamp and get contacts by a time range. To do so, I had to add a time stamp attribute to the Contact class then update the ContactDAO class to handle a secondary index key. Through adding time stamp and time range functionality to the ContactDAO object, I could interact with the use the ContactDAO class inside the Wicket web interface in order to act with the Berkley DB. This portion of the assignment was easily finished within the class room period.

But I had a difficult time implementing kata 2. Although I have worked with Wicket in the past, I still have a difficult time with Wicket’s property model where the form’s values are persistent through the Serializable Java class. I ended up extending the org.apache.wicket.IClusterable class in order to store all my the form values. After I figured out how the form worked, I was able to easily implement the concepts in the ContactClient to the Wicket web interface.

Since I ran out of time, I was not able to JUnit test my wicket application. There was also one problem with my Wicket application not being able to see the edu.hawaii.contactdb.ContactDAO class. It seems like Eclipse had a linking error because I fixed this by simply renaming the packages to a new name, then renaming them back to the original name.