[cosmo-dev] Data importation into the Derby database from text files

Randy Letness randy at osafoundation.org
Wed Jan 30 09:44:33 PST 2008


If you want to use caldav, the first thing you need to do is transform 
the data in the text files into the icalendar format (see 
http://rfc.net/rfc2445.html). This means converting the data to VEVENTs 
if you want to create events, or VJOURNAL if you want to create notes. 
If you are using java, then you can use the ical4j library 
(http://ical4j.sourceforge.net/), or you can construct the icalendar 
yourself.  Once you convert the data from the text files into icalendar 
format, you can use caldav to add them to a collection.  One way to do 
this would be to use the caldav4j 
library(http://caldav4j.googlecode.com).  You can find examples of how 
to add data in the test cases for caldav4j (for example 
http://caldav4j.googlecode.com/svn/trunk/src/test/java/org/osaf/caldav4j/BaseTestCase.java).    
The path to the collection can be found in the webui under the 
collection details, and it should look something like:

http://localhost:8080/chandler/dav/collection/1234-abcd-1234-abcd

Another option would be to use a command line tool like curl.  After 
parsing the data into icalendar files (one file per item) you can add 
them to a collection with a command like:

curl -u user:pass -H 'Content-Type: text/calendar' -T 
path/to/icalendarfile.ics 
http://localhost:8080/chandler/dav/collection/123-abcd-123-abcd/icalendarfile.ics

You would issue one command per item.

-Randy

Christine Lu wrote:
> Hi Randy,
>
> Actually, I'm a bit lost. I'd like to add data to an existing collection
> but I don't know where to begin. I read the pages about caldav and atom
> and I tried to do as you advised me but it's hard to understand how these
> protocols work. I think that writing an external program is a good idea.
> Do you have an example of program using caldav or atom?
>
> Thank you a lot,
>
> Christine
>   



More information about the cosmo-dev mailing list