Beruflich Dokumente
Kultur Dokumente
Revision 1.
Written by Mathew McBride – matt@mcbridematt.dhs.org
Abstract
JGroupDAV is a Java package which handles communication with GroupDAV-compatible
'groupware' servers. It includes both a basic GroupDAV protocol client and a system for managing
the retrieval and storage of GroupDAV data.
Its main production application is the Funambol GroupDAV Connector.
Package overview
● net.bionicmessage.objects – Main JGroupDAV package
○ MultipleSourceICalendarObjectStore – manages the retrieval, storage and search
functions for calendar and task data
○ MultipleSourceVCardObjectStore – as above, but for address book data
○ MultipleSourceObjectTracking – the database management layer for the above classes
● net.bionicmessage.groupdav – GroupDAV protocol client
● groupDAV – (Badly written!) GroupDAV protocol client – manages WebDAV
operations such as creation, deletion, updating, listing and retrieving objects
● GroupDAVObject.java – a wrapper for HTTP WebDAV queries, used by the above
class
● net.bionicmessage.utils – Utility methods
○ HTMLFormatter – used by net.bionicmessage.objects to produce HTML-formatted log
files
Classes not in active use are not shown
Building JGroupDAV
If you need to modify JGroupDAV and build a new jar file, run:
store.location = /tmp/multipleicalobjectstore
store.server = http://comalies.citadel.org:2000
store.user = testuser
store.password = testpassword
store.source.default = /groupdav/Calendar
store.source.two = /groupdav/Calendar2
and save it to $HOME/.multiplesource_icalobject_test_props or
.multiplesource_icaltodo_test_props . Read the test source files themselves for more information.
<dependency>
<groupId>bmessage</groupId>
<artifactId>jgroupdav</artifactId>
<version>1.2</version>
<scope>compile</scope>
</dependency>
options)
storedir is a location on the filesystem where JGroupDAV will place its database and logging
information. It doesn't have to exist at runtime (that includes the entire path to create it), but the user
needs write permissions to it.
options is an integer controlling the initial setup of the sink. Current options are:
● MultipleSourceICalendarObjectStore.OPTION_SSL: Enables the use of SSL http
connections. You will need to add your certificates to the Java certificate store to do this.
You may find using HTTP or decrypting the stream using stunnel first easier.
● MultipleSourceICalendarObjectStore.OPTION_PURGE: Purges the sink database, all data
will be pulled from the server again
● MultipleSourceICalendarObjectStore.OPTION_SINGLELOG: Sets up single log file mode,
recommended for end-user deployments. By default, the sink will create a new log file for
each session
During development, please keep watch on your terminal. Any exceptions thrown by the
constructor will appear there!
Next, you need to tell the sink about your server, where the events/todos are on it. Create a
java.util.Properties dictionary with the following attributes:
● store.server – Server host and port in the format of “http://server:port/”
● store.user – Username (you don't need to specify this here, read on)
● store.password – Password (as above)
● store.source.default – The first location you will be pulling/pushing data from, i.e
“/groupdav/Calendar/”, “/zidestore/dav/matt/public/Calendar/”
● store.source.xxx – As above, specify as many as you need, name does not matter
Note that you don't necessarily have to set these options in a single instance, they can be done
programmatically, see the javadocs.
Set the sink properties by setProperties(Properties p); and then tell it to load the data sources from
them: loadSourcesFromProps()
Once setup is done, you can start the sync process with startSync():
/** Starts the synchronisation process. Pulls new and updated
* data from the server and deletes any objects as needed
* @throws java.lang.Exception
*/
Retrieving changes
MultipleSourceICalendarObjectStore has several methods that report changes to the database in the
last sync cycle:
● ArrayList getAddedToStoreUIDS()
● ArrayList getDeletedFromStoreUIDS()
● ArrayList getUpdatedInStoreUIDS()
Rather confusingly, these methods have been named to/from/in “store” rather than “server”. Store
refers to operations done to the database, while “server” refers to operations done to the server. The
equivalent server functions are used mainly for logging.
Internally, objects are identified in the local database by the iCalendar “UID” property. The arrays
above contain String references to the UID properties.
Retrieving objects
To retrieve objects that have been stored locally, use getObjectFromStore:
public net.fortuna.ical4j.model.Calendar
java.lang.Exception
As you can see, to retrieve objects use the UID reference (i.e from the arrays above), which will
return an ical4j VCALENDAR object.
*/
Updating objects
Updating is similar to adding method wise:
Deleting objects
To delete an object from the server use the UID of the object you want to delete
throws Exception
Finishing up
Once you are done operating on the local database and server, close the database session and logger: