24% 39% 61% 88% 100%
24% 39% 61% 88% 100%
Hacking the Kontact / OGo Connector

As everyone knows no efficient hack-o-ton can be done without sufficient amounts of premium German Czech beer.

So when the OGo hackers and the Kontact geeks decided to join forces to develop an awesome groupware connector, SKYRIX was so kind to sponsor sufficient amounts of beer to configure the developers for top-notch performance.

ZNeK was pleased to act as a progress indicator professional. Just drag your mouse pointer over the golden S bar at the top of the page to review the progress demonstrated by his bass proven fingers.

The Mission™

KDE Community Icon Connect Kontact's KAddressbook and KOrganizer with the OpenGroupware.org server by writing a new K resource.
Thats it.

To elaborate, KDE has a storage abstraction called a Resource which implements the connectivity to arbitary groupware servers. Indeed, Kontact already supports a set of groupware backends, including lovely Microsoft Exchange, stone age Novell Groupwise - and now, the awesome OpenGroupware.org.

On the other side, OGo supports a variety of methods to access the services offered by the software. This includes the native client integration server called ZideStore as well as OGo specific protocols like XML-RPC or the PalmOS Network Hotsync Protocol, as outlined by the high level OGo architecture diagram.

[next]

Saturday Morning, Progress: 24%

As you can see ZNeK looks a bit, well, tired and is hardly able to stand on his own feet. Unlike the KDE wizards, ZNeK already arrived on Friday to prepare stuff and that (as always) turned out to be a 'till 4:00 AM session discussing each and every feature of the latest MacOSX 10.4 seed.
Mix in some South Park episodes and some levels of Quake 3 and you know why getting up at 10:00 AM to fetch Cornelius at 11:00 from the train station was really hard.

The Team™ was complete after we collected Till from the main station and Frank from home.

Getting some Icecream

icecream cluster Prior getting in touch with KDE-PIM we at OGo used to think that Objective-C compilation with GCC is quite slow. Fact is, compared to g++, cc1obj is blindingly fast.
To resolve this 'issue', Frank was so kind to setup SuSE 9.2 vserver images on three machines and a compile cluster software called Icecream which makes g++ compilation bearable.

Since the cluster increased productivity by about 300%, we can rightfully claim a completion of 24% even though no line of code was written ;-) During the setup, ZNeK and Helge started to condition the KDE wiz to use a WebDAV based approach for the client / server interaction.

[next]

Saturday Evening, Progress: 39%

design view After getting some coffee, Till started the design phase by opening the first bottle of beer in the afternoon.
Some excellent rosé paper was used for the design diagram to give the whole process an exotic touch.

The discussion focused on two connected things: a) which protocol to use and b) which existing Kontact Resource to use as a basis. Various options were considered, including SOAP, XML-RPC and the Exchange WebDAV protocol.

Since OGo already worked to some extend with the Exchange protocol, this was initially the suggested way to go. This approach was dropped in favor of a very clean and pure WebDAV based protocol to avoid all the E2k hacks (like having some things only available using binary MAPI tags).

Because the protocol being used was going to rely on iCalendar and vCard as the transport format, Cornelius and Till had the clever idea to streamline their Resources into a single KIO slave which acts as an iCalendar store. Due to this, they decided to create a new resource from scratch and adopt all the others later on to use the new way of connecting data.

[next]

Sunday, Progress: 61%

design view Saturday produced a good initial basis to start the actual work on Sunday, the infrastructure was setup and ready to get filled with the actual protocol implementation.

While Till implemented the Resource to retrieve the individual iCalendar entities from a WebDAV folder (and discovered some issue with KIO which currently does not allow nested KIO slaves), Cornelius worked on the user interface to create new OGo Resources in Kontact.
OGo staff had little to do since - coincidence - ZideStore already supported iCalendar over WebDAV ;-) The free time was spent on implementing a simple WebDAV debugger for MacOSX which proved to be useful later on.

The design decision was made that a Kontact Resource can represent an aggregation of the contents of multiple folders. This way you can create arbitary views which can be enabled/disabled with a single checkbox. Subresources were avoided since they seem to provide no significant additional advantages but require a lot of additional code in the implementation.

At about 2:00PM (when ZNeK finally finished his nap ;-) we went out for American breakfast at Lara's which is now called Bonnie's Diner ...

The afternoon produced a first working version of the Resource. It allowed reliable online retrieval of events from ZideStore.

[next]

Sunday Night, Progress: 88%

Kartoffelhaus After finishing the read only Resource people got hungry and certainly deserved some quality food. Since no one was able to name preferences, we selected the nearby Kartoffelhaus (potato house). Potatos are a somewhat local specialty given that the Magdeburger Börde has quality ground which exceeds the scale used to measure ground quality in Germany.

Back at the desk, the support for editing operations was started and implemented. Fortunately HTTP 1.1 already has awesome support to ensure consistent updates and cheap synchronisation. While Till implemented support for PUT and DELETE of iCalendar entities in the Resource, Helge added support for HTTP etags and if-match headers in ZideStore.
Those headers allow updates/deletes without the requirement to place a pessimistic lock on a resource. Read up on the spec, it pays!

To quote Cornelius: "This is the first protocol which makes sense. We have already implemented almost any available protocol in a Kontact resource and this one is the first which really makes sense.", Till added "Yup, this really open my eyes on how cool HTTP actually is" and ZNeK contemplated "It roxx.".

We are going to write an RFC for the protocol. Basically it is pure HTTP for managing a calendar resource and it is standard WebDAV with some special resource types for doing calendar discovery.
We directly use iCalendar and vCard for the content and do not require support for WebDAV properties nor for pessimistic locking in the server.

[next]

Monday Morning, Progress: 100%

Done, hooray!

Cornelius relaxing Minor fixes and final cleanups in the morning, checkin. All the development went surprisingly fast and well, which can only be attributed to the magic powers of Staropramen (or maybe to the broad experience of both, KDE and OGo developers with groupware protocols and how to properly deal with that problem domain).

After just 1 1/2 day we not only produced a working Kontact connector which even features offline synchronisation capabilities, we were also able to write a TODO file, according to Cornelius a sure sign that everything is up and running ;-)

So odds are good that the KDE 3.4 release will feature an awesome OpenGroupware.org Resource, and that, together with the upcoming OGo 1.0 release, we are soon going to see an excellent, pure Linux, groupware solution which is not restricted to a web client.

Pending: Calculate SLOC per litre beer.

Finally, thanks Cornelius and Till! This was a great and productive sprint and I hope we will meet again in a not too distant future :-)

... mixed up by Helge Heß