Public Calendar | Calendar Admin

UW Calendar and Eclipse HOWTO

Satish Sekharan
Memorial University of Newfoundland
Dec 16th, 2004

Contents


Introduction

This document is intended to help a new user set up a development environment for UW Calendar using Eclipse, an open source, Java based development tool. This article serves as a HOWTO and it gives you step by step instructions to achieve this goal. The instructions in this HOWTO apply primarily to windows but it can be easily adapted for other operating systems.

Since this article concentrates mainly on getting a development environment setup, it doesn't serve well as an introduction to using Eclipse. So, If you don't have prior experience using Eclipse, i would suggest that you read this article >> Getting started with the Eclipse Platform.

Prerequisites

JDK 1.4.2 is installed with JAVA_HOME environmental variable set.

Note: It is possible to compile UW Calendar using JDK 1.5 but it is not thoroughly tested.

Getting the quick start distribution

So let's get started. First we need to get the quick start distribution for UW Calendar. You can download the latest version (UW Calendar is 2.2) from this website.

We choose the quickstart distribution because it helps us get started relatively easily without having to setup tomcat or a database server. The quickstart version has the tomcat servlet container already configured to work with the included hsqldb database.

After downloading the .quickstart.zip., copy the file to a desired location on your hard drive and extract the files there. You will find several folders and files inside the quickstart directory.


 [quickstart dir]
          +--apache-ant-1.5.4       (Ant Java-based build tool)
          +--calendar2              (Source code for the UW Calendar project)
          +--hsqldb_v.1.61          (Database engine which offers both in memory and disk based tables) 
          +--jakarta-tomcat-5.0.16  (Tomcat servlet container)
    

Open up a console window, navigate to the quickstart directory and type:

ant hsqldb

Open another console window as we did previously and type:

ant tomcatstart

Launch your web browser and go to >> http://localhost:8080/cal/
You should see this page in the web browser.

 

Installing Eclipse

Now that we have the quickstart version setup, the next step is to install Eclipse. Installing Eclipse is not very complicated. All you need to do is to download the latest release for your platform from here. After downloading the archive, extract it and launch Eclipse.

Note: The Eclipse package does not include a Java runtime environment (JRE). So you will need JDK 1.4.1 or higher installed on your machine.

The first time Eclipse start's up, it will ask you to select a default workspace. At this time, you have the option to choose a desired location and create a new directory to store all your java projects or choose the default.


Installing sysdeo tomcat plugin

The next step is to install sysdeo eclipse tomcat plug-in to help us debug the UW Calendar application. You can download the sysdeo tomcat plug-in from here.

This plug-in will help us launch Tomcat from within Eclipse. This is very essential because it will register the Tomcat processes with the Eclipse debugger and help you debug the UW Calendar application. This plug-in will allow you to set breakpoints, evaluate expressions and step through the code. I personally find this plug-in to be very useful and I recommend installing it.

After downloading the plug-in, extract the archive. Copy the .com.sysdeo.eclipse.tomcat_3.x.x. folder into the .Eclipse\plugin. folder. Start Eclipse and go to Window>Preferences>Tomcat

Choose the appropriate version of Tomcat. As we are using the Tomcat provided with UW Calendar quick start, we choose the Version 5.x and set the Tomcat home to .[Install path]\quickstart\jakarta-tomcat-5.0.16..

Click OK and restart Eclipse. We are done configuring the Tomcat plug-in. Now you can use the tomcat buttons on the main tool bar to Start, Stop and Restart tomcat.

 

Configuring Eclipse

Now we setup the CVS repository for UW Calendar. This repository location is a description of where the CVS repository is located. After configuring this, we can download the latest code base for the UW Calendar project

Go to Window>Open Perspective>CVS Repository Exploring

This opens a CVS Repository Exploring perspective. Now on the left hand tab, click the add CVS Repository icon.

This opens a window which lets you add a new CVS repository.
Add these values:

    Host:             webiso-cvs.cac.washington.edu  
    Repository path:  /usr/local/cvsroot
    User:             anonymous	
    Password:         anonymous
    Connection type:  pserver (use default port)

Click finish when done.

Expand the CVS repository tree and navigate to the .calendar2. branch. Right click on the .calendar2. branch and select the Check Out As option.

Note: Don't change the default option here.
(Check out as a project configured using the New Project Wizard)

Click next and select the HEAD tag and click Finish.

 

Project wizard

Now the new project wizard starts up, which will help us setup a new project for UW Calendar. This new project acts as a model of its contents and a container for the packages. This model includes information about the type hierarchy, references and declarations of Java elements. This information is constantly updated as the user changes the Java source code. So choose the new Java Project and click next.

Type a new name for the project and click Finish. (Leave all other options as default)

Note: We click finish here because we want to configure the project setting only after downloading the source code from the CVS repository.

Project Configuration

Project configuration is an important step to help us match our project settings to the existing layout of the UW Calendar source code. Here we configure the source folders and build classpaths. The build classpath is the path used to find classes that are referenced by the source code for this project.

To configure the project, Click Window>Open Perspective>Java

On the left hand tab you have the Package Explorer. Inside Package Explorer right click the .Calendar2. Project and select Properties.

This brings up the Project Properties window. Here select the Java Build Path and click Add Folder button in the Source tab.

In the source folder selection window, select the source folders from:

Select the Libraries tab and click Add External JARS button.

Choose all these JAR files from [Install path]\quickstart\calendar2\lib

and choose two more jar files from [Install path]\quickstart\calendar2\lib\struts

Click OK when done.

Project properties

Now we need to configure our local.build.properties. Double click this file in Package Explorer and edit it so that it points to the tomcat directory and hsqldb supplied with the quickstart version.

   
   #where the application server lives
   appserver.dir=[Install path]/quickstart/jakarta-tomcat-5.0.16  
   #where the default db is
   hsqldb.dir= [Install path]/quickstart/hsqldb_v.1.61
       

Note: Forward slashes are used instead of backslash separator to define the path in the property files

Ant Build properties

The Ant view provides a place to view and configure Ant buildfiles. This tool makes it easy for us to execute a buildfile with a selected target . You can also add files to the view and expand buildfiles to reveal the targets defined within them.

We use this view to edit the calendar buildfile, select appropriate targets, and configure the launch configuration used when executing the UW Calendar project.

Click on Ant build icon and select External Tools

In the Configurations tab on the left, select Ant Build and click the New button We call our build configuration "calBuild"

Buildfile:
Click on the Browse Workspace button and select build.xml from the Calendar2 project.

Base Directory:
Click on the Browse Workspace button and select the Calendar2 project.

Click on the Targets tab and select the "deploy" or "deploy.debug" option from the targets.

The "deploy" target copies the compiled classes into the locations required by our servlet container, and picks up any external dependencies along the way. "deploy.debug" target does the same but also prints additional helpful debugging information in the tomcat logs.

Click on the Apply button to save all the configuration changes. Now click Run when you are ready to compile the UW Calendar source. The Ant tool will compile all the required classes and automatically create WAR files for you. These WAR files are then automatically deployed into your tomcat directory after compilation.

Conclusion

This article should get you started with Eclipse and a minimal set of plugins needed for your UW Calendar development efforts. Eclipse is very powerful and extensible development tool. A large number of open source plugins for Eclipse can be found here.

This release of UW Calendar includes preliminary work to make the calendar work with SyncML standard, lots of Unit tests, and a Database dump/restore facility. On a later date, I plan on updating this HOWTO to include detailed documentation on setting up the Sync4j server (SyncML java implementation) and the synchronization framework required for synching with client applications.

Resources
References