[Bedework-commit] exchgsynch r55 - in trunk: . common/src/org/bedework/exchgsynch common/src/org/bedework/exchgsynch/diff common/src/org/bedework/exchgsynch/wsimpl server/src/org/bedework/exchgsynch/web

svnadmin at bedework.org svnadmin at bedework.org
Wed Mar 2 15:27:26 EST 2011


Author: douglm
Date: 2011-03-02 15:27:25 -0500 (Wed, 02 Mar 2011)
New Revision: 55

Modified:
   trunk/.classpath
   trunk/common/src/org/bedework/exchgsynch/ExchangeSynch.java
   trunk/common/src/org/bedework/exchgsynch/diff/XmlIcalCompare.java
   trunk/common/src/org/bedework/exchgsynch/wsimpl/BwSynchIntfImpl.java
   trunk/server/src/org/bedework/exchgsynch/web/SOAPHandler.java
Log:
Further changes for exchange synch 

Modified: trunk/.classpath
===================================================================
--- trunk/.classpath	2011-02-26 17:16:56 UTC (rev 54)
+++ trunk/.classpath	2011-03-02 20:27:25 UTC (rev 55)
@@ -11,6 +11,6 @@
 	<classpathentry kind="lib" path="lib/rpiaccess-3.7.jar"/>
 	<classpathentry kind="lib" path="lib/rpiutil-3.7.jar"/>
 	<classpathentry kind="lib" path="lib/bw-exsynchwsschema-3.7.jar" sourcepath="/bwxml"/>
-	<classpathentry kind="lib" path="/bwxml/dist/bw-exchangewsschema-3.7.jar"/>
+	<classpathentry kind="lib" path="/bwxml/dist/bw-exchangewsschema-3.7.jar" sourcepath="/bwxml/exchangews/gensrc/src"/>
 	<classpathentry kind="output" path="bin/exchgsynch/eclipse-build/exchgsynch"/>
 </classpath>

Modified: trunk/common/src/org/bedework/exchgsynch/ExchangeSynch.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/ExchangeSynch.java	2011-02-26 17:16:56 UTC (rev 54)
+++ trunk/common/src/org/bedework/exchgsynch/ExchangeSynch.java	2011-03-02 20:27:25 UTC (rev 55)
@@ -313,7 +313,10 @@
             if (stopping) {
               break startup;
             }
-            subscribe(es);
+            if (subscribe(es) != StatusType.OK) {
+              // XXX We need to save this subscription somewhere and retry later.
+              // Alternatively set its state and retrieve all unstarted for retry.
+            }
           }
 
           synchronized (this) {
@@ -683,7 +686,12 @@
         return StatusType.ALREADY_SUBSCRIBED;
       }
 
-      doSubscription(sub);
+      ExsynchSubscribeResponse esr = doSubscription(sub);
+
+      if ((esr == null) | !esr.getValid()) {
+        return StatusType.ERROR;
+      }
+
       subs.put(sub.getCalPath(), sub);
 
       if (synchThis) {
@@ -726,7 +734,7 @@
     return StatusType.OK;
   }
 
-  private void doSubscription(final ExchangeSubscription sub) throws SynchException {
+  private ExsynchSubscribeResponse doSubscription(final ExchangeSubscription sub) throws SynchException {
     try {
       /* Send a request for a new subscription to exchange */
       SubscribeRequest s = new SubscribeRequest(sub,
@@ -752,7 +760,7 @@
 
       if (rms.size() != 1) {
         //
-        return;
+        return null;
       }
 
       SubscribeResponseMessageType srm = (SubscribeResponseMessageType)rms.iterator().next().getValue();
@@ -761,6 +769,8 @@
       if (debug) {
         trace(esr.toString());
       }
+
+      return esr;
     } catch (SynchException se) {
       throw se;
     } catch (Throwable t) {

Modified: trunk/common/src/org/bedework/exchgsynch/diff/XmlIcalCompare.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/diff/XmlIcalCompare.java	2011-02-26 17:16:56 UTC (rev 54)
+++ trunk/common/src/org/bedework/exchgsynch/diff/XmlIcalCompare.java	2011-03-02 20:27:25 UTC (rev 55)
@@ -25,6 +25,12 @@
 */
 package org.bedework.exchgsynch.diff;
 
+import org.bedework.exsynch.wsmessages.AddType;
+import org.bedework.exsynch.wsmessages.BaseUpdateType;
+import org.bedework.exsynch.wsmessages.NewValueType;
+import org.bedework.exsynch.wsmessages.RemoveType;
+import org.bedework.exsynch.wsmessages.ReplaceType;
+
 import edu.rpi.sss.util.xml.NsContext;
 import edu.rpi.sss.util.xml.tagdefs.XcalTags;
 
@@ -33,11 +39,6 @@
 import ietf.params.xml.ns.icalendar_2.BaseComponentType;
 import ietf.params.xml.ns.icalendar_2.BaseParameterType;
 import ietf.params.xml.ns.icalendar_2.BasePropertyType;
-import ietf.params.xml.ns.pidf_diff.AddType;
-import ietf.params.xml.ns.pidf_diff.BaseUpdateType;
-import ietf.params.xml.ns.pidf_diff.NewValueType;
-import ietf.params.xml.ns.pidf_diff.RemoveType;
-import ietf.params.xml.ns.pidf_diff.ReplaceType;
 
 import java.util.ArrayList;
 import java.util.List;

Modified: trunk/common/src/org/bedework/exchgsynch/wsimpl/BwSynchIntfImpl.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/wsimpl/BwSynchIntfImpl.java	2011-02-26 17:16:56 UTC (rev 54)
+++ trunk/common/src/org/bedework/exchgsynch/wsimpl/BwSynchIntfImpl.java	2011-03-02 20:27:25 UTC (rev 55)
@@ -33,15 +33,21 @@
 import org.bedework.exchgsynch.intf.SynchException;
 import org.bedework.exsynch.wsmessages.AddItem;
 import org.bedework.exsynch.wsmessages.AddItemResponse;
+import org.bedework.exsynch.wsmessages.AddType;
 import org.bedework.exsynch.wsmessages.ArrayOfNamespaces;
 import org.bedework.exsynch.wsmessages.ArrayOfUpdates;
+import org.bedework.exsynch.wsmessages.BaseUpdateType;
 import org.bedework.exsynch.wsmessages.ExsynchRemoteService;
 import org.bedework.exsynch.wsmessages.ExsynchRemoteServicePortType;
 import org.bedework.exsynch.wsmessages.FetchItem;
 import org.bedework.exsynch.wsmessages.FetchItemResponse;
+import org.bedework.exsynch.wsmessages.GetProperties;
+import org.bedework.exsynch.wsmessages.GetPropertiesResponse;
 import org.bedework.exsynch.wsmessages.GetSycnchInfo;
 import org.bedework.exsynch.wsmessages.NamespaceType;
 import org.bedework.exsynch.wsmessages.ObjectFactory;
+import org.bedework.exsynch.wsmessages.RemoveType;
+import org.bedework.exsynch.wsmessages.ReplaceType;
 import org.bedework.exsynch.wsmessages.StartServiceNotification;
 import org.bedework.exsynch.wsmessages.StartServiceResponse;
 import org.bedework.exsynch.wsmessages.StatusType;
@@ -52,12 +58,9 @@
 import org.bedework.exsynch.wsmessages.SynchInfoResponse.SynchInfoResponses;
 
 import org.apache.log4j.Logger;
+import org.oasis_open.docs.ns.xri.xrd_1.XRD;
 
 import ietf.params.xml.ns.icalendar_2.Icalendar;
-import ietf.params.xml.ns.pidf_diff.AddType;
-import ietf.params.xml.ns.pidf_diff.BaseUpdateType;
-import ietf.params.xml.ns.pidf_diff.RemoveType;
-import ietf.params.xml.ns.pidf_diff.ReplaceType;
 
 import java.net.URL;
 import java.util.ArrayList;
@@ -80,6 +83,8 @@
 
   private String curToken;
 
+  private XRD sysInfo;
+
   /** Constructor
    *
    */
@@ -91,6 +96,18 @@
                                   final String token) throws SynchException {
     conf = val;
 
+    if (sysInfo == null) {
+      // Try to get info first
+      GetProperties gp = new GetProperties();
+
+      gp.setSystem(new GetProperties.System());
+
+      GetPropertiesResponse gpr = getPort().getProperties(gp);
+
+      if (gpr != null) {
+        sysInfo = gpr.getXRD();
+      }
+    }
     StartServiceNotification ssn = new StartServiceNotification();
 
     /* Set up the call back URL for incoming subscriptions */

Modified: trunk/server/src/org/bedework/exchgsynch/web/SOAPHandler.java
===================================================================
--- trunk/server/src/org/bedework/exchgsynch/web/SOAPHandler.java	2011-02-26 17:16:56 UTC (rev 54)
+++ trunk/server/src/org/bedework/exchgsynch/web/SOAPHandler.java	2011-03-02 20:27:25 UTC (rev 55)
@@ -126,7 +126,12 @@
 
       Object o = u.unmarshal(body.getFirstChild());
 
-      return ((JAXBElement)o).getValue();
+      if (o instanceof JAXBElement) {
+        // Some of them get wrapped.
+        o = ((JAXBElement)o).getValue();
+      }
+
+      return o;
     } catch (SynchException se) {
       throw se;
     } catch(Throwable t) {



More information about the Bedework-commit mailing list