Java Calendar Tools

About Java Calendar Tools

k5n Java Calendar Tools is a project to provide Java-based tools and components that will leverage industry standard calendar protocols (iCalendar in particular). There seems to be a lack of open source tools for using these protocols, and it slows adoption of the protocols. For example, the CAP protocol does not seem to be supported by and calendar applications.

Overview of Components

There are currently two main components that comprise the Java Calendar Tools:

  • k5n-ical: This library provides a simple API for parsing/importing and writing iCalendar-formatted data.
  • k5n-CalendarPanel: This library contains a Swing GUI components for displaying a “month-at-a-glance” display of events. You can see an example of this on the k5nCal Screenshots page.

License

All software is licensed under the GNU General Public License.

For more information about this license:

This license means that you are free to use this software in other open source applications. If you are interested in using this software in something that is proprietary (not open source), then please contact us with details of your request. In most cases, we will be happy to provide you with a suitable license.

Plans

  • Currently implemented:
    • Parse iCalendar VEVENT files into objects
    • Export VEVENT objects into iCalendar data
    • Provide JUnit tests to validate parsing/importing and exporting
    • Provide API to query loaded iCalendar objects
    • Add support for VTODO and VJOURNAL
    • Add support for VTIMEZONE (and all the various timezones)
    • Provide parsing of Outlook CSV files so we can create a csv2ical utility (which there is a need for)
    • Add support for VATTACH, allowing inline attachments which are saved either within the iCalendar data or include a URL to an external file.
  • Long-term plans
    • Support forĀ xCal-Basic
    • Support for iTIP (RFC 2446)
    • Support for iMIP (RFC 2447)
    • Support for CAP (RFC 3283)

Tutorial

The Event object holds a single ical event and corresponds to the VEVENT iCalendar object.

Typically, the ICalendarParser object is the container for the ical data. (You can override this by creating your own class that implements the DataStore interface. If not, the ICalendarParser class will handle all storage of iCalendar data.) It includes an API for querying events for specific categories and/or time ranges.

Parsing an iCalendar File

 import java.io.File;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.util.Vector;
 import us.k5n.calendar.ICalendarParser;
 import us.k5n.calendar.Event;
 import us.k5n.calendar.Todo;
 
 // ...
 
   ICalendarParser parser;
   File icalFile = new File ("/tmp/example.ics");
   try {
     BufferedReader r = new BufferedReader(new FileReader (icalFile));
     parser.parse (r);
   } catch (IOException e) {
     // ... report error
   }
   r.close ();
   Vector events = parser.getAllEvents ();
   for (Event e : events) {
     System.out.println ("Event: " + e.getSummary () ;
   }
   TodoList todo = parser.getAllTodo (); // get to-do entries
   for (Todo t : todo) {
     Todo t = (Todo) todo.elementAt ( i );
     System.out.println ("Todo: " + t.getSummary ());
   }
 // ... 

Screenshot

The CalendarPanel class is a Swing UI component that can be used to display the typical month-at-a-glance calendar view within a Swing application.

Download

There is now a 0.5.0 release available.

Download the latest version form:

Github

Developer Resources

Related Links

  • Standards & RFCs
    • RFC 2445: Internet Calendaring and Scheduling Core Object Specification (iCal)
    • iCal Basic: Basic Internet Calendaring and Scheduling Core Object Specification (Draft; expires 26 Dec 2005)
    • xCal-Basic: iCalendar in XML Format (Draft; expired 27 Feb 2006)
    • RFC 2446: iCalendar Transport-Independent Interoperability Protocol (iTIP)
    • RFC 2447: iCalendar Message-Based Interoperability Protocol (iMIP)
    • RFC 3283: Guide to Internet Calendaring (CAP)
    • CalDAV: Calendaring and Scheduling Extensions to WebDAV (DRAFT)
    • RdfCalendar: iCalendar events in RDF.
  • iCalendar .NET Parser: iCalendar parser written in C#.
  • Free Association includes a mature iCalendar library written in C. It also includes a Java interface that uses JNI. The last published release of libical is November 2002, so it appears the project could be orphaned.
  • Reefknot is a Perl implementation of iCal, CAP and iTIP. Last updated in 2001.
  • Sites for iCalendar calendars to download:
  • iCal-compliant applications. (Most do not support 100% of the iCalendar standard.)
    • WebCalendar is a web-based calendar that supports import/export/sync with iCal.
    • Mozilla Calendar is a calendar extension to Mozilla/Firefox.
    • Mozilla Sunbird is the standalone calendar application from Mozilla Foundation.
    • GNOME Evolution is a calendar application for the GNOME desktop.
    • KOrganizer is the calendar application for the KDE Desktop Environment.
    • Apple iCal is Apple’s calendar application for Mac OS X.
    • Remote Calendars: An Outlook 2003 add-on to allow subscriptions to remote iCalendar calendars.