In the past weeks the blog received some comments about the old caldav introduction series. If you remember this series consists of two entries, the first one introduces caldav and presents some http/webdav methods and the second post shows some real caldav requests. At that time I decided to not attach the complete project but linking every java file when it goes into stage. I thought this way would result in a better understanding but, obviously, I was wrong. For this reason I finally changed my mind and I am going to present the whole project and a real PoC example.
For some months I have been thinking in improving my little whitepages portlet (shown in both VoIP entries, Skype internet solution and Pidgin/OpenFire custom intranet project). It would be great if the whitepages, besides VoIP presence and interaction capabilities, could show the events or free/busy information for a specified company mate. This way any colleague can see what events has any other mate arranged for today and act accordingly.
It is quite clear that CalDAV is perfect for accessing the company calendar solution. In this case I have not installed any Calendar software (like I did with open sourced Calendar Server in the CalDAV entries) and the whitepages portlet will work against internet google and Yahoo! calendars. Finally I configured Yahoo! as the default calendar cos google does not support free-busy-query in its CalDAV implementation.
Before implementing the whitepages extension I worked with the old CalDAV project. Some jackrabbit libraries have been upgraded to new 2.2.0 version and another report has been implemented: free-busy-query. This report queries for the free/busy information of a user in a specified time. Its response only shows when the user has some events arranged, is busy, and when is free, but not specifying any detail of any event. If you check the libraries, jackrabbit-webdav depends on the old Commons HttpClient 3.1 which was superseded long time ago by a new HttpClient in the HttpComponents project (actual GA version 4.0.3). But its API has been deeply changed and jackrabbit needs some time to upgrade (see bug JCR-2406 for more details). This is an important issue to consider before choosing jackrabbit-webdav and I did not comment it before. As I promised here it is the complete CalDAV NetBeans project (libraries are missing because of space).
As I commented in previous VoIP entries the whitepages is a JSF 2.0 portlet application which uses OpenLDAP as the user repository. Every user entry has several attributes, and some of them are simply displayed (name, telephone,...) and others are treated specially. For example the jpegPhoto attribute is fetched and transformed into an image tag, the mail one is converted into a common email href link and skype/pidgin attribute is interpreted to show the presence and interaction links (start chat, add to my contacts,...).
For calendar integration a new attribute is used. This attribute is going to have the complete URI for the CalDAV Event collection of the user, in case of Yahoo! the attribute will be https://caldav.calendar.yahoo.com/dav/<yahoo-email>/Calendar/<calendar-name>/. But like the other special attributes, the calendar one will not be just presented, the URI will be used to access and query for the today user events. These events will be retrieved and presented to the end user. In order to fetch the events of a user calendar it must be shared with whitepages internal user or be totally public (i.e. any other google or Yahoo! user can see our events). In Yahoo! the calendar accessibility is set in Options → Share Calendar → Other Ways to Share → Public Link and in google in Settings → Calendar settings → Calendars → Click the calendar you want to share → Share this Calendar → Make this calendar public. In both sites there is an option to only share free/busy information and not make the calendar absolutely public (details are hidden and only availability is shown) but, also in both, this option does not work. Google does not support free-busy-query (CalDAV cannot access free/busy information) and in Yahoo! this option is disabled (with a beautiful coming soon message). In a custom calendar solution the whitepages could also be configured to use a superuser with special grants to access any other user calendar. But, as I commented, finally I set Yahoo! URI in the LDAP attribute of my entry and therefore my calendar must be public. The portlet tries first to obtain all the events arranged for today using calendar-query report (this needs all events to be public) and, if this first option does not work, it tries a second free-busy-query report to only show when the person is occupied (only free/busy access is needed).
Here it is a new video. My hypothetic boss wants to see the whitepages improvements before the department meeting at the afternoon and he searches for me in the intranet portal. After checking I have one hour free in the morning and I am online in Skype he decides to chat with me and arrange a meeting. I accept the offer and update my Yahoo! calendar. The update is immediately shown in the portlet.
I hope CalDAV entries were clearer now. This entry has attached the complete caldav project (see above for the link) and shows whitepages as a real example (very simple but a real one). I like the way my little whitepages application is being improved.
I read your post and found very helpful.
I'm trying to write a sync layer for an application I'm working on and my problem is how to find modified events.
Using the property getctag I can know if something changed on the server but not what.
I tried doing a query report with a filter on a dates rage of the LAST-MODIFIED property, but the server (Google in my tests) always return all events ignoring the filter.
Do you have any suggestions?
Comments