xlawrence 2004/11/24 11:39:41 CET
Modified files:
src/java/org/jahia/suite/calendar/syncClients SyncClient.java
Log:
Started implementation of a Sync client able to read .ics files stored on the
user's file system
Revision Changes Path
1.2 +35 -3
uwcal_JSR168/src/java/org/jahia/suite/calendar/syncClients/SyncClient.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/uwcal_JSR168/src/java/org/jahia/suite/calendar/syncClients/SyncClient.java.diff?r1=1.1&r2=1.2&f=h
Index: SyncClient.java
===================================================================
RCS file:
/home/cvs/repository/uwcal_JSR168/src/java/org/jahia/suite/calendar/syncClients/SyncClient.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- SyncClient.java 23 Nov 2004 16:44:38 -0000 1.1
+++ SyncClient.java 24 Nov 2004 10:39:40 -0000 1.2
@@ -37,14 +37,46 @@
package org.jahia.suite.calendar.syncClients;
+import java.util.Properties;
+
+import sync4j.syncclient.spdm.SimpleDeviceManager;
+import sync4j.syncclient.spdm.DMException;
+import sync4j.syncclient.spds.SyncManager;
+import sync4j.syncclient.spds.SyncException;
+
+import org.apache.log4j.Logger;
+
/**
*
* @author Xavier Lawrence
*/
public class SyncClient {
- /** Creates a new instance of SyncClient */
- public SyncClient() {
- }
+ // log4j logger
+ static Logger log = Logger.getLogger(SyncClient.class);
+ static void printException(Exception e) {
+ log.error(e);
+ e.printStackTrace();
+ }
+
+ /**
+ * Main method for starting the Sync Client application
+ * @param args the command line arguments
+ */
+ public static void main(String args[]) {
+ try {
+ Properties props = System.getProperties();
+ props.put(SimpleDeviceManager.PROP_DM_DIR_BASE, "config");
+ System.setProperties(props);
+
+ SyncManager syncManager = SyncManager.getSyncManager(".");
+
+ syncManager.sync();
+ } catch (SyncException e) {
+ printException(e);
+ } catch (DMException e) {
+ printException(e);
+ }
+ }
}