[Bedework-commit] exchgsynch r26 - in trunk:
common/src/org/bedework/exchgsynch
common/src/org/bedework/exchgsynch/bwimpl
common/src/org/bedework/exchgsynch/intf
common/src/org/bedework/exchgsynch/messages
common/src/org/bedework/exchgsynch/responses
server/src/org/bedework/exchgsynch/web
svnadmin at bedework.org
svnadmin at bedework.org
Tue Oct 26 09:40:37 EDT 2010
Author: douglm
Date: 2010-10-26 09:40:34 -0400 (Tue, 26 Oct 2010)
New Revision: 26
Added:
trunk/common/src/org/bedework/exchgsynch/intf/
trunk/common/src/org/bedework/exchgsynch/intf/Defs.java
trunk/common/src/org/bedework/exchgsynch/intf/ExchangeSubscription.java
trunk/common/src/org/bedework/exchgsynch/intf/ExchangeSynchIntf.java
trunk/common/src/org/bedework/exchgsynch/intf/SynchBadRequest.java
trunk/common/src/org/bedework/exchgsynch/intf/SynchException.java
trunk/common/src/org/bedework/exchgsynch/intf/SynchForbidden.java
Removed:
trunk/common/src/org/bedework/exchgsynch/Defs.java
trunk/common/src/org/bedework/exchgsynch/ExchangeSubscription.java
trunk/common/src/org/bedework/exchgsynch/ExchangeSynchIntf.java
trunk/common/src/org/bedework/exchgsynch/SynchBadRequest.java
trunk/common/src/org/bedework/exchgsynch/SynchException.java
trunk/common/src/org/bedework/exchgsynch/SynchForbidden.java
Modified:
trunk/common/src/org/bedework/exchgsynch/CalendarItem.java
trunk/common/src/org/bedework/exchgsynch/ExchangeCallback.java
trunk/common/src/org/bedework/exchgsynch/ExchangeSynch.java
trunk/common/src/org/bedework/exchgsynch/bwimpl/BwSynchIntfImpl.java
trunk/common/src/org/bedework/exchgsynch/messages/SubscribeRequest.java
trunk/common/src/org/bedework/exchgsynch/responses/ExchangeResponse.java
trunk/common/src/org/bedework/exchgsynch/responses/ExsynchSubscribeResponse.java
trunk/common/src/org/bedework/exchgsynch/responses/FinditemsResponse.java
trunk/common/src/org/bedework/exchgsynch/responses/Notification.java
trunk/common/src/org/bedework/exchgsynch/responses/SyncFolderitemsResponse.java
trunk/server/src/org/bedework/exchgsynch/web/ExsynchServlet.java
trunk/server/src/org/bedework/exchgsynch/web/MethodBase.java
trunk/server/src/org/bedework/exchgsynch/web/PostMethod.java
Log:
Refactor only - create an intf package with all the interface classes
Modified: trunk/common/src/org/bedework/exchgsynch/CalendarItem.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/CalendarItem.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/CalendarItem.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -25,6 +25,9 @@
*/
package org.bedework.exchgsynch;
+import org.bedework.exchgsynch.intf.Defs;
+import org.bedework.exchgsynch.intf.SynchException;
+
import edu.rpi.sss.util.Util;
import net.fortuna.ical4j.model.Component;
Deleted: trunk/common/src/org/bedework/exchgsynch/Defs.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/Defs.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/Defs.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -1,53 +0,0 @@
-/* **********************************************************************
- Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
-
- Redistribution and use of this distribution in source and binary forms,
- with or without modification, are permitted provided that:
- The above copyright notice and this permission notice appear in all
- copies and supporting documentation;
-
- The name, identifiers, and trademarks of Rensselaer Polytechnic
- Institute are not used in advertising or publicity without the
- express prior written permission of Rensselaer Polytechnic Institute;
-
- DISCLAIMER: The software is distributed" AS IS" without any express or
- implied warranty, including but not limited to, any implied warranties
- of merchantability or fitness for a particular purpose or any warrant)'
- of non-infringement of any current or pending patent rights. The authors
- of the software make no representations about the suitability of this
- software for any particular purpose. The entire risk as to the quality
- and performance of the software is with the user. Should the software
- prove defective, the user assumes the cost of all necessary servicing,
- repair or correction. In particular, neither Rensselaer Polytechnic
- Institute, nor the authors of the software are liable for any indirect,
- special, consequential, or incidental damages related to the software,
- to the maximum extent the law permits.
-*/
-
-package org.bedework.exchgsynch;
-
-
-/** Definitions for exchange synch classes
- *
- * @author Mike Douglass douglm rpi.edu
- */
-public interface Defs {
- /* ========================================================================
- * X-properties we generate
- * ======================================================================== */
-
- /* Common prefix */
- public static final String xpMSPrefix = "X-BEDEWORK-EXSYNC-";
-
- /* Exchange tzid */
- public static final String xpMSTzid = xpMSPrefix + "TZID";
-
- /* Exchange start tzid */
- public static final String xpMSStartTzid = xpMSPrefix + "STARTTZID";
-
- /* Exchange end tzid */
- public static final String xpMSEndTzid = xpMSPrefix + "ENDTZID";
-
- /* Exchange end tzid */
- public static final String xpMSLastmod = xpMSPrefix + "LASTMOD";
-}
Modified: trunk/common/src/org/bedework/exchgsynch/ExchangeCallback.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/ExchangeCallback.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/ExchangeCallback.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -26,6 +26,9 @@
package org.bedework.exchgsynch;
+import org.bedework.exchgsynch.intf.ExchangeSubscription;
+import org.bedework.exchgsynch.intf.SynchException;
+
/** Calls from the calendar system to the exchange synch processor.
*
* @author Mike Douglass
Deleted: trunk/common/src/org/bedework/exchgsynch/ExchangeSubscription.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/ExchangeSubscription.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/ExchangeSubscription.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -1,343 +0,0 @@
-/* **********************************************************************
- Copyright 2010 Rensselaer Polytechnic Institute. All worldwide rights reserved.
-
- Redistribution and use of this distribution in source and binary forms,
- with or without modification, are permitted provided that:
- The above copyright notice and this permission notice appear in all
- copies and supporting documentation;
-
- The name, identifiers, and trademarks of Rensselaer Polytechnic
- Institute are not used in advertising or publicity without the
- express prior written permission of Rensselaer Polytechnic Institute;
-
- DISCLAIMER: The software is distributed" AS IS" without any express or
- implied warranty, including but not limited to, any implied warranties
- of merchantability or fitness for a particular purpose or any warrant)'
- of non-infringement of any current or pending patent rights. The authors
- of the software make no representations about the suitability of this
- software for any particular purpose. The entire risk as to the quality
- and performance of the software is with the user. Should the software
- prove defective, the user assumes the cost of all necessary servicing,
- repair or correction. In particular, neither Rensselaer Polytechnic
- Institute, nor the authors of the software are liable for any indirect,
- special, consequential, or incidental damages related to the software,
- to the maximum extent the law permits.
-*/
-
-package org.bedework.exchgsynch;
-
-import edu.rpi.cmt.access.AccessPrincipal;
-
-import java.util.UUID;
-
-/** Represents a current subscription or a subscription request.
- *
- * @author Mike Douglass
- */
-public class ExchangeSubscription implements Comparable<ExchangeSubscription> {
- private String subscriptionId;
-
- private String calpath;
-
- private AccessPrincipal principal;
-
- private String exchangeCalendar;
-
- private String exchangeURI;
-
- private String exchangeSubscriptionId;
-
- private String exchangeWatermark;
-
- private String exchangeError;
-
- private boolean subscribe;
-
- private ExchangeSubscription outstandingSubscription;
-
- /** Constructor
- *
- * @param subscriptionId - null means generate one
- * @param calpath
- * @param principal
- * @param exchangeCalendar
- * @param exchangeURI
- * @param subscribe
- */
- public ExchangeSubscription(final String subscriptionId,
- final String calpath,
- final AccessPrincipal principal,
- final String exchangeCalendar,
- final String exchangeURI,
- final boolean subscribe) {
- if (subscriptionId == null) {
- this.subscriptionId = UUID.randomUUID().toString();
- } else {
- this.subscriptionId = subscriptionId;
- }
-
- this.principal = principal;
- this.calpath = calpath;
- this.exchangeCalendar = exchangeCalendar;
- this.exchangeURI = exchangeURI;
- this.subscribe = subscribe;
- }
-
- /** Our generated subscriptionId.
- *
- * @param val String
- */
- public void setSubscriptionId(final String val) {
- subscriptionId = val;
- }
-
- /** Our generated subscriptionId.
- *
- * @return String
- */
- public String getSubscriptionId() {
- return subscriptionId;
- }
-
- /** Path to this systems calendar collection
- *
- * @param val String
- */
- public void setCalpath(final String val) {
- calpath = val;
- }
-
- /** Path to this systems calendar collection
- *
- * @return String
- */
- public String getCalpath() {
- return calpath;
- }
-
-
- /** Principal requesting synch service
- *
- * @param val AccessPrincipal
- */
- public void setprincipal(final AccessPrincipal val) {
- principal = val;
- }
-
- /** Principal requesting synch service
- *
- * @return AccessPrincipal
- */
- public AccessPrincipal getprincipal() {
- return principal;
- }
- /** Exchange Calendar
- *
- * @param val String
- */
- public void setExchangeCalendar(final String val) {
- exchangeCalendar = val;
- }
-
- /** Exchange Calendar
- *
- * @return String
- */
- public String getExchangeCalendar() {
- return exchangeCalendar;
- }
-
- /** Exchange web service uri
- *
- * @param val String
- */
- public void setExchangeURI(final String val) {
- exchangeURI = val;
- }
-
- /** Exchange web service uri
- *
- * @return String
- */
- public String getExchangeURI() {
- return exchangeURI;
- }
-
- /** Exchange system subscriptionId.
- *
- * @param val String
- */
- public void setExchangeSubscriptionId(final String val) {
- exchangeSubscriptionId = val;
- }
-
- /** Exchange system subscriptionId.
- *
- * @return String
- */
- public String getExchangeSubscriptionId() {
- return exchangeSubscriptionId;
- }
-
- /** Exchange watermark.
- *
- * @param val String
- */
- public void setExchangeWatermark(final String val) {
- exchangeWatermark = val;
- }
-
- /** Exchange watermark.
- *
- * @return String
- */
- public String getExchangeWatermark() {
- return exchangeWatermark;
- }
-
- /** Exchange error code.
- *
- * @param val String
- */
- public void setExchangeError(final String val) {
- exchangeError = val;
- }
-
- /** Exchange error code.
- *
- * @return String
- */
- public String getExchangeError() {
- return exchangeError;
- }
-
- /** (un)subscribe?
- *
- * @param val boolean
- */
- public void setSubscribe(final boolean val) {
- subscribe = val;
- }
-
- /** (un)subscribe?
- *
- * @return boolean
- */
- public boolean getSubscribe() {
- return subscribe;
- }
-
- /** An outstanding request that requires an unsubscribe to complete first
- *
- * @param val ExchangeSubscription
- */
- public void setOutstandingSubscription(final ExchangeSubscription val) {
- outstandingSubscription = val;
- }
-
- /** An outstanding request that requires an unsubscribe to complete first
- *
- * @return ExchangeSubscription
- */
- public ExchangeSubscription getOutstandingSubscription() {
- return outstandingSubscription;
- }
-
- /** equality just checks the path. Look at the rest.
- *
- * @param that
- * @return true if anything changed
- */
- public boolean changed(final ExchangeSubscription that) {
- if (!equals(that)) {
- return true;
- }
-
- if (!getprincipal().equals(that.getprincipal())) {
- return true;
- }
-
- if (!getExchangeCalendar().equals(that.getExchangeCalendar())) {
- return true;
- }
-
- if (!getExchangeURI().equals(that.getExchangeURI())) {
- return true;
- }
-
- if (getSubscribe() != that.getSubscribe()) {
- return true;
- }
-
- return false;
- }
-
- /* ====================================================================
- * Object methods
- * ==================================================================== */
-
- @Override
- public int hashCode() {
- return getCalpath().hashCode();
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("ExchangeSubscription{");
-
- toStringSegment(sb, " ");
-
- if (getOutstandingSubscription() != null) {
- sb.append(", \n OustandingSubscription{");
-
- toStringSegment(sb, " ");
- sb.append(" }");
- }
-
- sb.append("}");
- return sb.toString();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Comparable#compareTo(java.lang.Object)
- */
- public int compareTo(final ExchangeSubscription that) {
- if (this == that) {
- return 0;
- }
-
- return getCalpath().compareTo(that.getCalpath());
- }
-
- @Override
- public boolean equals(final Object o) {
- return compareTo((ExchangeSubscription)o) == 0;
- }
-
- /* ====================================================================
- * Private methods
- * ==================================================================== */
-
- private void toStringSegment(final StringBuilder sb,
- final String indent) {
- sb.append("calpath = ");
- sb.append(getCalpath());
-
- sb.append(",\n");
- sb.append(indent);
- sb.append("principal = ");
- sb.append(getprincipal());
-
- sb.append(",\n");
- sb.append(indent);
- sb.append("exchangeCalendar = ");
- sb.append(getExchangeCalendar());
- sb.append(", exchangeURI = ");
- sb.append(getExchangeURI());
-
- sb.append(",\n");
- sb.append(indent);
- sb.append("subscribe = ");
- sb.append(getSubscribe());
- }
-}
Modified: trunk/common/src/org/bedework/exchgsynch/ExchangeSynch.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/ExchangeSynch.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/ExchangeSynch.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -26,9 +26,13 @@
package org.bedework.exchgsynch;
-import org.bedework.exchgsynch.ExchangeSynchIntf.Credentials;
-import org.bedework.exchgsynch.ExchangeSynchIntf.ItemsInfo;
import org.bedework.exchgsynch.bwimpl.BwSynchIntfImpl;
+import org.bedework.exchgsynch.intf.ExchangeSubscription;
+import org.bedework.exchgsynch.intf.ExchangeSynchIntf;
+import org.bedework.exchgsynch.intf.SynchException;
+import org.bedework.exchgsynch.intf.SynchForbidden;
+import org.bedework.exchgsynch.intf.ExchangeSynchIntf.Credentials;
+import org.bedework.exchgsynch.intf.ExchangeSynchIntf.ItemsInfo;
import org.bedework.exchgsynch.messages.FindItemsRequest;
import org.bedework.exchgsynch.messages.SubscribeRequest;
import org.bedework.exchgsynch.responses.ExsynchSubscribeResponse;
@@ -514,7 +518,7 @@
throw new SynchForbidden("No credentials");
}
- return getExchangeServicePort(creds.id, creds.password);
+ return getExchangeServicePort(creds.getId(), creds.getPassword());
} catch (SynchException se) {
throw se;
} catch (Throwable t) {
Deleted: trunk/common/src/org/bedework/exchgsynch/ExchangeSynchIntf.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/ExchangeSynchIntf.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/ExchangeSynchIntf.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -1,168 +0,0 @@
-/* **********************************************************************
- Copyright 2010 Rensselaer Polytechnic Institute. All worldwide rights reserved.
-
- Redistribution and use of this distribution in source and binary forms,
- with or without modification, are permitted provided that:
- The above copyright notice and this permission notice appear in all
- copies and supporting documentation;
-
- The name, identifiers, and trademarks of Rensselaer Polytechnic
- Institute are not used in advertising or publicity without the
- express prior written permission of Rensselaer Polytechnic Institute;
-
- DISCLAIMER: The software is distributed" AS IS" without any express or
- implied warranty, including but not limited to, any implied warranties
- of merchantability or fitness for a particular purpose or any warrant)'
- of non-infringement of any current or pending patent rights. The authors
- of the software make no representations about the suitability of this
- software for any particular purpose. The entire risk as to the quality
- and performance of the software is with the user. Should the software
- prove defective, the user assumes the cost of all necessary servicing,
- repair or correction. In particular, neither Rensselaer Polytechnic
- Institute, nor the authors of the software are liable for any indirect,
- special, consequential, or incidental damages related to the software,
- to the maximum extent the law permits.
-*/
-
-package org.bedework.exchgsynch;
-
-import net.fortuna.ical4j.model.Calendar;
-
-import java.util.List;
-
-/** Calls from exchange synch processor to the service.
- *
- * @author Mike Douglass
- */
-public interface ExchangeSynchIntf extends Defs {
- /** Called to initialise the exchange synch process. A response of false means
- * no exchange synch. Note that users can synchronize with exchange systems in
- * other domains, so even if your site doesn't run exchange you may want to to
- * run the synch process,
- *
- * @param cb
- * @return false for no synch.
- * @throws WebdavException
- */
- boolean initExchangeSynch(ExchangeCallback cb) throws SynchException;
-
- /** */
- public static class Credentials {
- String id;
- char[] password;
-
- /** Constructor
- *
- * @param id - of form DOMAIN <backslash> user
- * @param password
- */
- public Credentials(final String id,
- final char[] password) {
- this.id = id;
- this.password = password;
- }
- }
-
- /** Get Credentials allowing log in to exchange for the given subscription
- *
- * @param sub
- * @return Credentials object
- * @throws SynchException
- */
- Credentials getCredentials(ExchangeSubscription sub) throws SynchException;
-
- /** Called by the Exchange synch process at startup to get the current list
- * of subscriptions. Will normally not be called again.
- *
- * @return List of current subscriptions - never null
- * @throws SynchException
- */
- List<ExchangeSubscription> getSubscriptions() throws SynchException;
-
- /** The calendar system (e.g. bedework) must generate a unique subscription id
- * for each subscription. This is used as a key for each subscription.
- *
- * @param id - unique id
- * @return a matching subscription or null
- * @throws SynchException
- */
- ExchangeSubscription getSubscription(String id) throws SynchException;
-
- /** Update the persisted state of the subscription.
- *
- * @param sub
- * @throws SynchException
- */
- void updateSubscription(ExchangeSubscription sub) throws SynchException;
-
- /** Information used to synch remote with Exchange
- * This information is only valid in the context of a given subscription.
- */
- public static class ItemsInfo {
- public String uid;
-
- public String lastMod;
-
- public boolean seen;
-
- public ItemsInfo(final String uid,
- final String lastMod) {
- this.uid = uid;
- this.lastMod = lastMod;
- }
-
- @Override
- public String toString() {
- StringBuilder sb = new StringBuilder("SynchInfo{");
-
- sb.append("uid=");
- sb.append(uid);
-
- sb.append(",\n lastMod=");
- sb.append(lastMod);
-
- sb.append("}");
-
- return sb.toString();
- }
- }
-
- /** Get information about items in the subscribed calendar. Used for initial
- * synch.
- *
- * @param sub
- * @return List of items - never null, maybe empty.
- * @throws SynchException
- */
- List<ItemsInfo> getItemsInfo(ExchangeSubscription sub) throws SynchException;
-
- /** Fetch a calendar component.
- *
- * @param sub
- * @param uid
- * @param recurrenceId
- * @return a component or components corresponding to the parameters
- * @throws SynchException
- */
- Calendar findItem(ExchangeSubscription sub,
- String uid,
- String recurrenceId) throws SynchException;
-
- /** Add a calendar component
- *
- * @param sub
- * @param val
- * @throws SynchException
- */
- void addItem(ExchangeSubscription sub,
- Calendar val) throws SynchException;
-
- /** Update a calendar component
- *
- * @param sub
- * @param val
- * @throws SynchException
- */
- void updateItem(ExchangeSubscription sub,
- Calendar val) throws SynchException;
-}
Deleted: trunk/common/src/org/bedework/exchgsynch/SynchBadRequest.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/SynchBadRequest.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/SynchBadRequest.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -1,67 +0,0 @@
-/* **********************************************************************
- Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
-
- Redistribution and use of this distribution in source and binary forms,
- with or without modification, are permitted provided that:
- The above copyright notice and this permission notice appear in all
- copies and supporting documentation;
-
- The name, identifiers, and trademarks of Rensselaer Polytechnic
- Institute are not used in advertising or publicity without the
- express prior written permission of Rensselaer Polytechnic Institute;
-
- DISCLAIMER: The software is distributed" AS IS" without any express or
- implied warranty, including but not limited to, any implied warranties
- of merchantability or fitness for a particular purpose or any warrant)'
- of non-infringement of any current or pending patent rights. The authors
- of the software make no representations about the suitability of this
- software for any particular purpose. The entire risk as to the quality
- and performance of the software is with the user. Should the software
- prove defective, the user assumes the cost of all necessary servicing,
- repair or correction. In particular, neither Rensselaer Polytechnic
- Institute, nor the authors of the software are liable for any indirect,
- special, consequential, or incidental damages related to the software,
- to the maximum extent the law permits.
-*/
-
-package org.bedework.exchgsynch;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-
-/** Base exception thrown by synch classes
- *
- * @author Mike Douglass douglm rpi.edu
- */
-public class SynchBadRequest extends SynchException {
- /** Constructor
- */
- public SynchBadRequest() {
- super(HttpServletResponse.SC_BAD_REQUEST);
- }
-
- /** Constructor
- *
- * @param msg
- */
- public SynchBadRequest(final String msg) {
- super(HttpServletResponse.SC_BAD_REQUEST, msg);
- }
-
- /** Constructor
- *
- * @param errorTag
- */
- public SynchBadRequest(final QName errorTag) {
- super(HttpServletResponse.SC_BAD_REQUEST, errorTag);
- }
-
- /** Constructor
- *
- * @param errorTag
- * @param msg
- */
- public SynchBadRequest(final QName errorTag, final String msg) {
- super(HttpServletResponse.SC_BAD_REQUEST, errorTag, msg);
- }
-}
Deleted: trunk/common/src/org/bedework/exchgsynch/SynchException.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/SynchException.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/SynchException.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -1,140 +0,0 @@
-/* **********************************************************************
- Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
-
- Redistribution and use of this distribution in source and binary forms,
- with or without modification, are permitted provided that:
- The above copyright notice and this permission notice appear in all
- copies and supporting documentation;
-
- The name, identifiers, and trademarks of Rensselaer Polytechnic
- Institute are not used in advertising or publicity without the
- express prior written permission of Rensselaer Polytechnic Institute;
-
- DISCLAIMER: The software is distributed" AS IS" without any express or
- implied warranty, including but not limited to, any implied warranties
- of merchantability or fitness for a particular purpose or any warrant)'
- of non-infringement of any current or pending patent rights. The authors
- of the software make no representations about the suitability of this
- software for any particular purpose. The entire risk as to the quality
- and performance of the software is with the user. Should the software
- prove defective, the user assumes the cost of all necessary servicing,
- repair or correction. In particular, neither Rensselaer Polytechnic
- Institute, nor the authors of the software are liable for any indirect,
- special, consequential, or incidental damages related to the software,
- to the maximum extent the law permits.
-*/
-
-package org.bedework.exchgsynch;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-
-/** Base exception thrown by exchange synch classes
- *
- * @author Mike Douglass douglm at rpi.edu
- */
-public class SynchException extends Throwable {
- /** > 0 if set
- */
- int statusCode = -1;
- QName errorTag;
-
- public static String namespace = "http://bedework.org/exsynch/errors";
-
- public static QName unknownCalendarItemType = new QName(namespace,
- "unknown-calendar-item-type");
-
- /** Constructor
- *
- * @param s
- */
- public SynchException(final String s) {
- super(s);
- if (statusCode < 0) {
- statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
- }
- }
-
- /** Constructor
- *
- * @param t
- */
- public SynchException(final Throwable t) {
- super(t);
- if (statusCode < 0) {
- statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
- }
- }
-
- /** Constructor
- *
- * @param st
- */
- public SynchException(final int st) {
- statusCode = st;
- }
-
- /** Constructor
- *
- * @param st
- * @param msg
- */
- public SynchException(final int st, final String msg) {
- super(msg);
- statusCode = st;
- }
-
- /** Constructor
- *
- * @param errorTag
- */
- public SynchException(final QName errorTag) {
- statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
- this.errorTag = errorTag;
- }
-
- /** Constructor
- *
- * @param st
- * @param errorTag
- */
- public SynchException(final int st, final QName errorTag) {
- statusCode = st;
- this.errorTag = errorTag;
- }
-
- /** Constructor
- *
- * @param st
- * @param errorTag
- * @param msg
- */
- public SynchException(final int st, final QName errorTag, final String msg) {
- super(msg);
- statusCode = st;
- this.errorTag = errorTag;
- }
-
- /** Set the status
- * @param val int status
- */
- public void setStatusCode(final int val) {
- statusCode = val;
- }
-
- /** Get the status
- *
- * @return int status
- */
- public int getStatusCode() {
- return statusCode;
- }
-
- /** Get the errorTag
- *
- * @return QName
- */
- public QName getErrorTag() {
- return errorTag;
- }
-}
Deleted: trunk/common/src/org/bedework/exchgsynch/SynchForbidden.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/SynchForbidden.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/SynchForbidden.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -1,94 +0,0 @@
-/*
- Copyright (c) 2000-2005 University of Washington. All rights reserved.
-
- Redistribution and use of this distribution in source and binary forms,
- with or without modification, are permitted provided that:
-
- The above copyright notice and this permission notice appear in
- all copies and supporting documentation;
-
- The name, identifiers, and trademarks of the University of Washington
- are not used in advertising or publicity without the express prior
- written permission of the University of Washington;
-
- Recipients acknowledge that this distribution is made available as a
- research courtesy, "as is", potentially with defects, without
- any obligation on the part of the University of Washington to
- provide support, services, or repair;
-
- THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR
- IMPLIED, WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION
- ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
- PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
- WASHINGTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
- DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
- PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT (INCLUDING
- NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION WITH
- THE USE OR PERFORMANCE OF THIS SOFTWARE.
- */
-/* **********************************************************************
- Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
-
- Redistribution and use of this distribution in source and binary forms,
- with or without modification, are permitted provided that:
- The above copyright notice and this permission notice appear in all
- copies and supporting documentation;
-
- The name, identifiers, and trademarks of Rensselaer Polytechnic
- Institute are not used in advertising or publicity without the
- express prior written permission of Rensselaer Polytechnic Institute;
-
- DISCLAIMER: The software is distributed" AS IS" without any express or
- implied warranty, including but not limited to, any implied warranties
- of merchantability or fitness for a particular purpose or any warrant)'
- of non-infringement of any current or pending patent rights. The authors
- of the software make no representations about the suitability of this
- software for any particular purpose. The entire risk as to the quality
- and performance of the software is with the user. Should the software
- prove defective, the user assumes the cost of all necessary servicing,
- repair or correction. In particular, neither Rensselaer Polytechnic
- Institute, nor the authors of the software are liable for any indirect,
- special, consequential, or incidental damages related to the software,
- to the maximum extent the law permits.
-*/
-
-package org.bedework.exchgsynch;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.xml.namespace.QName;
-
-/** Forbidden exception thrown by synch classes
- *
- * @author Mike Douglass douglm at rpi.edu
- */
-public class SynchForbidden extends SynchException {
- /** Constructor
- */
- public SynchForbidden() {
- super(HttpServletResponse.SC_FORBIDDEN);
- }
-
- /** Constructor
- * @param msg
- */
- public SynchForbidden(final String msg) {
- super(HttpServletResponse.SC_FORBIDDEN, msg);
- }
-
- /** Constructor
- *
- * @param errorTag
- */
- public SynchForbidden(final QName errorTag) {
- super(HttpServletResponse.SC_FORBIDDEN, errorTag);
- }
-
- /** Constructor
- *
- * @param errorTag
- * @param msg
- */
- public SynchForbidden(final QName errorTag, final String msg) {
- super(HttpServletResponse.SC_FORBIDDEN, errorTag, msg);
- }
-}
Modified: trunk/common/src/org/bedework/exchgsynch/bwimpl/BwSynchIntfImpl.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/bwimpl/BwSynchIntfImpl.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/bwimpl/BwSynchIntfImpl.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -38,9 +38,9 @@
import org.bedework.calsvci.CalSvcI;
import org.bedework.calsvci.CalSvcIPars;
import org.bedework.exchgsynch.ExchangeCallback;
-import org.bedework.exchgsynch.ExchangeSubscription;
-import org.bedework.exchgsynch.ExchangeSynchIntf;
-import org.bedework.exchgsynch.SynchException;
+import org.bedework.exchgsynch.intf.ExchangeSubscription;
+import org.bedework.exchgsynch.intf.ExchangeSynchIntf;
+import org.bedework.exchgsynch.intf.SynchException;
import net.fortuna.ical4j.model.Calendar;
import net.fortuna.ical4j.model.Property;
Copied: trunk/common/src/org/bedework/exchgsynch/intf/Defs.java (from rev 25, trunk/common/src/org/bedework/exchgsynch/Defs.java)
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/intf/Defs.java (rev 0)
+++ trunk/common/src/org/bedework/exchgsynch/intf/Defs.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -0,0 +1,53 @@
+/* **********************************************************************
+ Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+ The above copyright notice and this permission notice appear in all
+ copies and supporting documentation;
+
+ The name, identifiers, and trademarks of Rensselaer Polytechnic
+ Institute are not used in advertising or publicity without the
+ express prior written permission of Rensselaer Polytechnic Institute;
+
+ DISCLAIMER: The software is distributed" AS IS" without any express or
+ implied warranty, including but not limited to, any implied warranties
+ of merchantability or fitness for a particular purpose or any warrant)'
+ of non-infringement of any current or pending patent rights. The authors
+ of the software make no representations about the suitability of this
+ software for any particular purpose. The entire risk as to the quality
+ and performance of the software is with the user. Should the software
+ prove defective, the user assumes the cost of all necessary servicing,
+ repair or correction. In particular, neither Rensselaer Polytechnic
+ Institute, nor the authors of the software are liable for any indirect,
+ special, consequential, or incidental damages related to the software,
+ to the maximum extent the law permits.
+*/
+
+package org.bedework.exchgsynch.intf;
+
+
+/** Definitions for exchange synch classes
+ *
+ * @author Mike Douglass douglm rpi.edu
+ */
+public interface Defs {
+ /* ========================================================================
+ * X-properties we generate
+ * ======================================================================== */
+
+ /* Common prefix */
+ public static final String xpMSPrefix = "X-BEDEWORK-EXSYNC-";
+
+ /* Exchange tzid */
+ public static final String xpMSTzid = xpMSPrefix + "TZID";
+
+ /* Exchange start tzid */
+ public static final String xpMSStartTzid = xpMSPrefix + "STARTTZID";
+
+ /* Exchange end tzid */
+ public static final String xpMSEndTzid = xpMSPrefix + "ENDTZID";
+
+ /* Exchange end tzid */
+ public static final String xpMSLastmod = xpMSPrefix + "LASTMOD";
+}
Copied: trunk/common/src/org/bedework/exchgsynch/intf/ExchangeSubscription.java (from rev 21, trunk/common/src/org/bedework/exchgsynch/ExchangeSubscription.java)
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/intf/ExchangeSubscription.java (rev 0)
+++ trunk/common/src/org/bedework/exchgsynch/intf/ExchangeSubscription.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -0,0 +1,343 @@
+/* **********************************************************************
+ Copyright 2010 Rensselaer Polytechnic Institute. All worldwide rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+ The above copyright notice and this permission notice appear in all
+ copies and supporting documentation;
+
+ The name, identifiers, and trademarks of Rensselaer Polytechnic
+ Institute are not used in advertising or publicity without the
+ express prior written permission of Rensselaer Polytechnic Institute;
+
+ DISCLAIMER: The software is distributed" AS IS" without any express or
+ implied warranty, including but not limited to, any implied warranties
+ of merchantability or fitness for a particular purpose or any warrant)'
+ of non-infringement of any current or pending patent rights. The authors
+ of the software make no representations about the suitability of this
+ software for any particular purpose. The entire risk as to the quality
+ and performance of the software is with the user. Should the software
+ prove defective, the user assumes the cost of all necessary servicing,
+ repair or correction. In particular, neither Rensselaer Polytechnic
+ Institute, nor the authors of the software are liable for any indirect,
+ special, consequential, or incidental damages related to the software,
+ to the maximum extent the law permits.
+*/
+
+package org.bedework.exchgsynch.intf;
+
+import edu.rpi.cmt.access.AccessPrincipal;
+
+import java.util.UUID;
+
+/** Represents a current subscription or a subscription request.
+ *
+ * @author Mike Douglass
+ */
+public class ExchangeSubscription implements Comparable<ExchangeSubscription> {
+ private String subscriptionId;
+
+ private String calpath;
+
+ private AccessPrincipal principal;
+
+ private String exchangeCalendar;
+
+ private String exchangeURI;
+
+ private String exchangeSubscriptionId;
+
+ private String exchangeWatermark;
+
+ private String exchangeError;
+
+ private boolean subscribe;
+
+ private ExchangeSubscription outstandingSubscription;
+
+ /** Constructor
+ *
+ * @param subscriptionId - null means generate one
+ * @param calpath
+ * @param principal
+ * @param exchangeCalendar
+ * @param exchangeURI
+ * @param subscribe
+ */
+ public ExchangeSubscription(final String subscriptionId,
+ final String calpath,
+ final AccessPrincipal principal,
+ final String exchangeCalendar,
+ final String exchangeURI,
+ final boolean subscribe) {
+ if (subscriptionId == null) {
+ this.subscriptionId = UUID.randomUUID().toString();
+ } else {
+ this.subscriptionId = subscriptionId;
+ }
+
+ this.principal = principal;
+ this.calpath = calpath;
+ this.exchangeCalendar = exchangeCalendar;
+ this.exchangeURI = exchangeURI;
+ this.subscribe = subscribe;
+ }
+
+ /** Our generated subscriptionId.
+ *
+ * @param val String
+ */
+ public void setSubscriptionId(final String val) {
+ subscriptionId = val;
+ }
+
+ /** Our generated subscriptionId.
+ *
+ * @return String
+ */
+ public String getSubscriptionId() {
+ return subscriptionId;
+ }
+
+ /** Path to this systems calendar collection
+ *
+ * @param val String
+ */
+ public void setCalpath(final String val) {
+ calpath = val;
+ }
+
+ /** Path to this systems calendar collection
+ *
+ * @return String
+ */
+ public String getCalpath() {
+ return calpath;
+ }
+
+
+ /** Principal requesting synch service
+ *
+ * @param val AccessPrincipal
+ */
+ public void setprincipal(final AccessPrincipal val) {
+ principal = val;
+ }
+
+ /** Principal requesting synch service
+ *
+ * @return AccessPrincipal
+ */
+ public AccessPrincipal getprincipal() {
+ return principal;
+ }
+ /** Exchange Calendar
+ *
+ * @param val String
+ */
+ public void setExchangeCalendar(final String val) {
+ exchangeCalendar = val;
+ }
+
+ /** Exchange Calendar
+ *
+ * @return String
+ */
+ public String getExchangeCalendar() {
+ return exchangeCalendar;
+ }
+
+ /** Exchange web service uri
+ *
+ * @param val String
+ */
+ public void setExchangeURI(final String val) {
+ exchangeURI = val;
+ }
+
+ /** Exchange web service uri
+ *
+ * @return String
+ */
+ public String getExchangeURI() {
+ return exchangeURI;
+ }
+
+ /** Exchange system subscriptionId.
+ *
+ * @param val String
+ */
+ public void setExchangeSubscriptionId(final String val) {
+ exchangeSubscriptionId = val;
+ }
+
+ /** Exchange system subscriptionId.
+ *
+ * @return String
+ */
+ public String getExchangeSubscriptionId() {
+ return exchangeSubscriptionId;
+ }
+
+ /** Exchange watermark.
+ *
+ * @param val String
+ */
+ public void setExchangeWatermark(final String val) {
+ exchangeWatermark = val;
+ }
+
+ /** Exchange watermark.
+ *
+ * @return String
+ */
+ public String getExchangeWatermark() {
+ return exchangeWatermark;
+ }
+
+ /** Exchange error code.
+ *
+ * @param val String
+ */
+ public void setExchangeError(final String val) {
+ exchangeError = val;
+ }
+
+ /** Exchange error code.
+ *
+ * @return String
+ */
+ public String getExchangeError() {
+ return exchangeError;
+ }
+
+ /** (un)subscribe?
+ *
+ * @param val boolean
+ */
+ public void setSubscribe(final boolean val) {
+ subscribe = val;
+ }
+
+ /** (un)subscribe?
+ *
+ * @return boolean
+ */
+ public boolean getSubscribe() {
+ return subscribe;
+ }
+
+ /** An outstanding request that requires an unsubscribe to complete first
+ *
+ * @param val ExchangeSubscription
+ */
+ public void setOutstandingSubscription(final ExchangeSubscription val) {
+ outstandingSubscription = val;
+ }
+
+ /** An outstanding request that requires an unsubscribe to complete first
+ *
+ * @return ExchangeSubscription
+ */
+ public ExchangeSubscription getOutstandingSubscription() {
+ return outstandingSubscription;
+ }
+
+ /** equality just checks the path. Look at the rest.
+ *
+ * @param that
+ * @return true if anything changed
+ */
+ public boolean changed(final ExchangeSubscription that) {
+ if (!equals(that)) {
+ return true;
+ }
+
+ if (!getprincipal().equals(that.getprincipal())) {
+ return true;
+ }
+
+ if (!getExchangeCalendar().equals(that.getExchangeCalendar())) {
+ return true;
+ }
+
+ if (!getExchangeURI().equals(that.getExchangeURI())) {
+ return true;
+ }
+
+ if (getSubscribe() != that.getSubscribe()) {
+ return true;
+ }
+
+ return false;
+ }
+
+ /* ====================================================================
+ * Object methods
+ * ==================================================================== */
+
+ @Override
+ public int hashCode() {
+ return getCalpath().hashCode();
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("ExchangeSubscription{");
+
+ toStringSegment(sb, " ");
+
+ if (getOutstandingSubscription() != null) {
+ sb.append(", \n OustandingSubscription{");
+
+ toStringSegment(sb, " ");
+ sb.append(" }");
+ }
+
+ sb.append("}");
+ return sb.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(final ExchangeSubscription that) {
+ if (this == that) {
+ return 0;
+ }
+
+ return getCalpath().compareTo(that.getCalpath());
+ }
+
+ @Override
+ public boolean equals(final Object o) {
+ return compareTo((ExchangeSubscription)o) == 0;
+ }
+
+ /* ====================================================================
+ * Private methods
+ * ==================================================================== */
+
+ private void toStringSegment(final StringBuilder sb,
+ final String indent) {
+ sb.append("calpath = ");
+ sb.append(getCalpath());
+
+ sb.append(",\n");
+ sb.append(indent);
+ sb.append("principal = ");
+ sb.append(getprincipal());
+
+ sb.append(",\n");
+ sb.append(indent);
+ sb.append("exchangeCalendar = ");
+ sb.append(getExchangeCalendar());
+ sb.append(", exchangeURI = ");
+ sb.append(getExchangeURI());
+
+ sb.append(",\n");
+ sb.append(indent);
+ sb.append("subscribe = ");
+ sb.append(getSubscribe());
+ }
+}
Copied: trunk/common/src/org/bedework/exchgsynch/intf/ExchangeSynchIntf.java (from rev 25, trunk/common/src/org/bedework/exchgsynch/ExchangeSynchIntf.java)
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/intf/ExchangeSynchIntf.java (rev 0)
+++ trunk/common/src/org/bedework/exchgsynch/intf/ExchangeSynchIntf.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -0,0 +1,184 @@
+/* **********************************************************************
+ Copyright 2010 Rensselaer Polytechnic Institute. All worldwide rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+ The above copyright notice and this permission notice appear in all
+ copies and supporting documentation;
+
+ The name, identifiers, and trademarks of Rensselaer Polytechnic
+ Institute are not used in advertising or publicity without the
+ express prior written permission of Rensselaer Polytechnic Institute;
+
+ DISCLAIMER: The software is distributed" AS IS" without any express or
+ implied warranty, including but not limited to, any implied warranties
+ of merchantability or fitness for a particular purpose or any warrant)'
+ of non-infringement of any current or pending patent rights. The authors
+ of the software make no representations about the suitability of this
+ software for any particular purpose. The entire risk as to the quality
+ and performance of the software is with the user. Should the software
+ prove defective, the user assumes the cost of all necessary servicing,
+ repair or correction. In particular, neither Rensselaer Polytechnic
+ Institute, nor the authors of the software are liable for any indirect,
+ special, consequential, or incidental damages related to the software,
+ to the maximum extent the law permits.
+*/
+
+package org.bedework.exchgsynch.intf;
+
+import org.bedework.exchgsynch.ExchangeCallback;
+
+import net.fortuna.ical4j.model.Calendar;
+
+import java.util.List;
+
+/** Calls from exchange synch processor to the service.
+ *
+ * @author Mike Douglass
+ */
+public interface ExchangeSynchIntf extends Defs {
+ /** Called to initialise the exchange synch process. A response of false means
+ * no exchange synch. Note that users can synchronize with exchange systems in
+ * other domains, so even if your site doesn't run exchange you may want to to
+ * run the synch process,
+ *
+ * @param cb
+ * @return false for no synch.
+ * @throws WebdavException
+ */
+ boolean initExchangeSynch(ExchangeCallback cb) throws SynchException;
+
+ /** */
+ public static class Credentials {
+ private String id;
+ private char[] password;
+
+ /** Constructor
+ *
+ * @param id - of form DOMAIN <backslash> user
+ * @param password
+ */
+ public Credentials(final String id,
+ final char[] password) {
+ this.id = id;
+ this.password = password;
+ }
+
+ /**
+ * @return id
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * @return password characters
+ */
+ public char[] getPassword() {
+ return password;
+ }
+ }
+
+ /** Get Credentials allowing log in to exchange for the given subscription
+ *
+ * @param sub
+ * @return Credentials object
+ * @throws SynchException
+ */
+ Credentials getCredentials(ExchangeSubscription sub) throws SynchException;
+
+ /** Called by the Exchange synch process at startup to get the current list
+ * of subscriptions. Will normally not be called again.
+ *
+ * @return List of current subscriptions - never null
+ * @throws SynchException
+ */
+ List<ExchangeSubscription> getSubscriptions() throws SynchException;
+
+ /** The calendar system (e.g. bedework) must generate a unique subscription id
+ * for each subscription. This is used as a key for each subscription.
+ *
+ * @param id - unique id
+ * @return a matching subscription or null
+ * @throws SynchException
+ */
+ ExchangeSubscription getSubscription(String id) throws SynchException;
+
+ /** Update the persisted state of the subscription.
+ *
+ * @param sub
+ * @throws SynchException
+ */
+ void updateSubscription(ExchangeSubscription sub) throws SynchException;
+
+ /** Information used to synch remote with Exchange
+ * This information is only valid in the context of a given subscription.
+ */
+ public static class ItemsInfo {
+ public String uid;
+
+ public String lastMod;
+
+ public boolean seen;
+
+ public ItemsInfo(final String uid,
+ final String lastMod) {
+ this.uid = uid;
+ this.lastMod = lastMod;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder("SynchInfo{");
+
+ sb.append("uid=");
+ sb.append(uid);
+
+ sb.append(",\n lastMod=");
+ sb.append(lastMod);
+
+ sb.append("}");
+
+ return sb.toString();
+ }
+ }
+
+ /** Get information about items in the subscribed calendar. Used for initial
+ * synch.
+ *
+ * @param sub
+ * @return List of items - never null, maybe empty.
+ * @throws SynchException
+ */
+ List<ItemsInfo> getItemsInfo(ExchangeSubscription sub) throws SynchException;
+
+ /** Fetch a calendar component.
+ *
+ * @param sub
+ * @param uid
+ * @param recurrenceId
+ * @return a component or components corresponding to the parameters
+ * @throws SynchException
+ */
+ Calendar findItem(ExchangeSubscription sub,
+ String uid,
+ String recurrenceId) throws SynchException;
+
+ /** Add a calendar component
+ *
+ * @param sub
+ * @param val
+ * @throws SynchException
+ */
+ void addItem(ExchangeSubscription sub,
+ Calendar val) throws SynchException;
+
+ /** Update a calendar component
+ *
+ * @param sub
+ * @param val
+ * @throws SynchException
+ */
+ void updateItem(ExchangeSubscription sub,
+ Calendar val) throws SynchException;
+}
Copied: trunk/common/src/org/bedework/exchgsynch/intf/SynchBadRequest.java (from rev 15, trunk/common/src/org/bedework/exchgsynch/SynchBadRequest.java)
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/intf/SynchBadRequest.java (rev 0)
+++ trunk/common/src/org/bedework/exchgsynch/intf/SynchBadRequest.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -0,0 +1,67 @@
+/* **********************************************************************
+ Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+ The above copyright notice and this permission notice appear in all
+ copies and supporting documentation;
+
+ The name, identifiers, and trademarks of Rensselaer Polytechnic
+ Institute are not used in advertising or publicity without the
+ express prior written permission of Rensselaer Polytechnic Institute;
+
+ DISCLAIMER: The software is distributed" AS IS" without any express or
+ implied warranty, including but not limited to, any implied warranties
+ of merchantability or fitness for a particular purpose or any warrant)'
+ of non-infringement of any current or pending patent rights. The authors
+ of the software make no representations about the suitability of this
+ software for any particular purpose. The entire risk as to the quality
+ and performance of the software is with the user. Should the software
+ prove defective, the user assumes the cost of all necessary servicing,
+ repair or correction. In particular, neither Rensselaer Polytechnic
+ Institute, nor the authors of the software are liable for any indirect,
+ special, consequential, or incidental damages related to the software,
+ to the maximum extent the law permits.
+*/
+
+package org.bedework.exchgsynch.intf;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+
+/** Base exception thrown by synch classes
+ *
+ * @author Mike Douglass douglm rpi.edu
+ */
+public class SynchBadRequest extends SynchException {
+ /** Constructor
+ */
+ public SynchBadRequest() {
+ super(HttpServletResponse.SC_BAD_REQUEST);
+ }
+
+ /** Constructor
+ *
+ * @param msg
+ */
+ public SynchBadRequest(final String msg) {
+ super(HttpServletResponse.SC_BAD_REQUEST, msg);
+ }
+
+ /** Constructor
+ *
+ * @param errorTag
+ */
+ public SynchBadRequest(final QName errorTag) {
+ super(HttpServletResponse.SC_BAD_REQUEST, errorTag);
+ }
+
+ /** Constructor
+ *
+ * @param errorTag
+ * @param msg
+ */
+ public SynchBadRequest(final QName errorTag, final String msg) {
+ super(HttpServletResponse.SC_BAD_REQUEST, errorTag, msg);
+ }
+}
Copied: trunk/common/src/org/bedework/exchgsynch/intf/SynchException.java (from rev 23, trunk/common/src/org/bedework/exchgsynch/SynchException.java)
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/intf/SynchException.java (rev 0)
+++ trunk/common/src/org/bedework/exchgsynch/intf/SynchException.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -0,0 +1,140 @@
+/* **********************************************************************
+ Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+ The above copyright notice and this permission notice appear in all
+ copies and supporting documentation;
+
+ The name, identifiers, and trademarks of Rensselaer Polytechnic
+ Institute are not used in advertising or publicity without the
+ express prior written permission of Rensselaer Polytechnic Institute;
+
+ DISCLAIMER: The software is distributed" AS IS" without any express or
+ implied warranty, including but not limited to, any implied warranties
+ of merchantability or fitness for a particular purpose or any warrant)'
+ of non-infringement of any current or pending patent rights. The authors
+ of the software make no representations about the suitability of this
+ software for any particular purpose. The entire risk as to the quality
+ and performance of the software is with the user. Should the software
+ prove defective, the user assumes the cost of all necessary servicing,
+ repair or correction. In particular, neither Rensselaer Polytechnic
+ Institute, nor the authors of the software are liable for any indirect,
+ special, consequential, or incidental damages related to the software,
+ to the maximum extent the law permits.
+*/
+
+package org.bedework.exchgsynch.intf;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+
+/** Base exception thrown by exchange synch classes
+ *
+ * @author Mike Douglass douglm at rpi.edu
+ */
+public class SynchException extends Throwable {
+ /** > 0 if set
+ */
+ int statusCode = -1;
+ QName errorTag;
+
+ public static String namespace = "http://bedework.org/exsynch/errors";
+
+ public static QName unknownCalendarItemType = new QName(namespace,
+ "unknown-calendar-item-type");
+
+ /** Constructor
+ *
+ * @param s
+ */
+ public SynchException(final String s) {
+ super(s);
+ if (statusCode < 0) {
+ statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
+ }
+ }
+
+ /** Constructor
+ *
+ * @param t
+ */
+ public SynchException(final Throwable t) {
+ super(t);
+ if (statusCode < 0) {
+ statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
+ }
+ }
+
+ /** Constructor
+ *
+ * @param st
+ */
+ public SynchException(final int st) {
+ statusCode = st;
+ }
+
+ /** Constructor
+ *
+ * @param st
+ * @param msg
+ */
+ public SynchException(final int st, final String msg) {
+ super(msg);
+ statusCode = st;
+ }
+
+ /** Constructor
+ *
+ * @param errorTag
+ */
+ public SynchException(final QName errorTag) {
+ statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
+ this.errorTag = errorTag;
+ }
+
+ /** Constructor
+ *
+ * @param st
+ * @param errorTag
+ */
+ public SynchException(final int st, final QName errorTag) {
+ statusCode = st;
+ this.errorTag = errorTag;
+ }
+
+ /** Constructor
+ *
+ * @param st
+ * @param errorTag
+ * @param msg
+ */
+ public SynchException(final int st, final QName errorTag, final String msg) {
+ super(msg);
+ statusCode = st;
+ this.errorTag = errorTag;
+ }
+
+ /** Set the status
+ * @param val int status
+ */
+ public void setStatusCode(final int val) {
+ statusCode = val;
+ }
+
+ /** Get the status
+ *
+ * @return int status
+ */
+ public int getStatusCode() {
+ return statusCode;
+ }
+
+ /** Get the errorTag
+ *
+ * @return QName
+ */
+ public QName getErrorTag() {
+ return errorTag;
+ }
+}
Copied: trunk/common/src/org/bedework/exchgsynch/intf/SynchForbidden.java (from rev 18, trunk/common/src/org/bedework/exchgsynch/SynchForbidden.java)
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/intf/SynchForbidden.java (rev 0)
+++ trunk/common/src/org/bedework/exchgsynch/intf/SynchForbidden.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -0,0 +1,94 @@
+/*
+ Copyright (c) 2000-2005 University of Washington. All rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+
+ The above copyright notice and this permission notice appear in
+ all copies and supporting documentation;
+
+ The name, identifiers, and trademarks of the University of Washington
+ are not used in advertising or publicity without the express prior
+ written permission of the University of Washington;
+
+ Recipients acknowledge that this distribution is made available as a
+ research courtesy, "as is", potentially with defects, without
+ any obligation on the part of the University of Washington to
+ provide support, services, or repair;
+
+ THE UNIVERSITY OF WASHINGTON DISCLAIMS ALL WARRANTIES, EXPRESS OR
+ IMPLIED, WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT LIMITATION
+ ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF
+ WASHINGTON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
+ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ PROFITS, WHETHER IN AN ACTION OF CONTRACT, TORT (INCLUDING
+ NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF OR IN CONNECTION WITH
+ THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+/* **********************************************************************
+ Copyright 2005 Rensselaer Polytechnic Institute. All worldwide rights reserved.
+
+ Redistribution and use of this distribution in source and binary forms,
+ with or without modification, are permitted provided that:
+ The above copyright notice and this permission notice appear in all
+ copies and supporting documentation;
+
+ The name, identifiers, and trademarks of Rensselaer Polytechnic
+ Institute are not used in advertising or publicity without the
+ express prior written permission of Rensselaer Polytechnic Institute;
+
+ DISCLAIMER: The software is distributed" AS IS" without any express or
+ implied warranty, including but not limited to, any implied warranties
+ of merchantability or fitness for a particular purpose or any warrant)'
+ of non-infringement of any current or pending patent rights. The authors
+ of the software make no representations about the suitability of this
+ software for any particular purpose. The entire risk as to the quality
+ and performance of the software is with the user. Should the software
+ prove defective, the user assumes the cost of all necessary servicing,
+ repair or correction. In particular, neither Rensselaer Polytechnic
+ Institute, nor the authors of the software are liable for any indirect,
+ special, consequential, or incidental damages related to the software,
+ to the maximum extent the law permits.
+*/
+
+package org.bedework.exchgsynch.intf;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.namespace.QName;
+
+/** Forbidden exception thrown by synch classes
+ *
+ * @author Mike Douglass douglm at rpi.edu
+ */
+public class SynchForbidden extends SynchException {
+ /** Constructor
+ */
+ public SynchForbidden() {
+ super(HttpServletResponse.SC_FORBIDDEN);
+ }
+
+ /** Constructor
+ * @param msg
+ */
+ public SynchForbidden(final String msg) {
+ super(HttpServletResponse.SC_FORBIDDEN, msg);
+ }
+
+ /** Constructor
+ *
+ * @param errorTag
+ */
+ public SynchForbidden(final QName errorTag) {
+ super(HttpServletResponse.SC_FORBIDDEN, errorTag);
+ }
+
+ /** Constructor
+ *
+ * @param errorTag
+ * @param msg
+ */
+ public SynchForbidden(final QName errorTag, final String msg) {
+ super(HttpServletResponse.SC_FORBIDDEN, errorTag, msg);
+ }
+}
Modified: trunk/common/src/org/bedework/exchgsynch/messages/SubscribeRequest.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/messages/SubscribeRequest.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/messages/SubscribeRequest.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -26,8 +26,8 @@
package org.bedework.exchgsynch.messages;
-import org.bedework.exchgsynch.ExchangeSubscription;
import org.bedework.exchgsynch.ExsynchConfig;
+import org.bedework.exchgsynch.intf.ExchangeSubscription;
import com.microsoft.schemas.exchange.services._2006.messages.SubscribeType;
import com.microsoft.schemas.exchange.services._2006.types.DistinguishedFolderIdNameType;
Modified: trunk/common/src/org/bedework/exchgsynch/responses/ExchangeResponse.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/responses/ExchangeResponse.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/responses/ExchangeResponse.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -25,7 +25,7 @@
*/
package org.bedework.exchgsynch.responses;
-import org.bedework.exchgsynch.SynchException;
+import org.bedework.exchgsynch.intf.SynchException;
import org.apache.log4j.Logger;
Modified: trunk/common/src/org/bedework/exchgsynch/responses/ExsynchSubscribeResponse.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/responses/ExsynchSubscribeResponse.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/responses/ExsynchSubscribeResponse.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -25,7 +25,7 @@
*/
package org.bedework.exchgsynch.responses;
-import org.bedework.exchgsynch.SynchException;
+import org.bedework.exchgsynch.intf.SynchException;
import com.microsoft.schemas.exchange.services._2006.messages.SubscribeResponseMessageType;
Modified: trunk/common/src/org/bedework/exchgsynch/responses/FinditemsResponse.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/responses/FinditemsResponse.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/responses/FinditemsResponse.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -27,7 +27,7 @@
import org.bedework.exchgsynch.CalendarItem;
import org.bedework.exchgsynch.ExchangeSynch;
-import org.bedework.exchgsynch.SynchException;
+import org.bedework.exchgsynch.intf.SynchException;
import net.fortuna.ical4j.model.component.CalendarComponent;
Modified: trunk/common/src/org/bedework/exchgsynch/responses/Notification.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/responses/Notification.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/responses/Notification.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -25,7 +25,7 @@
*/
package org.bedework.exchgsynch.responses;
-import org.bedework.exchgsynch.SynchException;
+import org.bedework.exchgsynch.intf.SynchException;
import java.util.ArrayList;
import java.util.List;
Modified: trunk/common/src/org/bedework/exchgsynch/responses/SyncFolderitemsResponse.java
===================================================================
--- trunk/common/src/org/bedework/exchgsynch/responses/SyncFolderitemsResponse.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/common/src/org/bedework/exchgsynch/responses/SyncFolderitemsResponse.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -26,7 +26,7 @@
package org.bedework.exchgsynch.responses;
import org.bedework.exchgsynch.CalendarItem;
-import org.bedework.exchgsynch.SynchException;
+import org.bedework.exchgsynch.intf.SynchException;
import net.fortuna.ical4j.model.component.CalendarComponent;
Modified: trunk/server/src/org/bedework/exchgsynch/web/ExsynchServlet.java
===================================================================
--- trunk/server/src/org/bedework/exchgsynch/web/ExsynchServlet.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/server/src/org/bedework/exchgsynch/web/ExsynchServlet.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -27,7 +27,7 @@
package org.bedework.exchgsynch.web;
import org.bedework.exchgsynch.ExchangeSynch;
-import org.bedework.exchgsynch.SynchException;
+import org.bedework.exchgsynch.intf.SynchException;
import org.bedework.exchgsynch.web.MethodBase.MethodInfo;
import edu.rpi.sss.util.servlets.io.CharArrayWrappedResponse;
Modified: trunk/server/src/org/bedework/exchgsynch/web/MethodBase.java
===================================================================
--- trunk/server/src/org/bedework/exchgsynch/web/MethodBase.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/server/src/org/bedework/exchgsynch/web/MethodBase.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -27,7 +27,7 @@
package org.bedework.exchgsynch.web;
import org.bedework.exchgsynch.ExchangeSynch;
-import org.bedework.exchgsynch.SynchException;
+import org.bedework.exchgsynch.intf.SynchException;
import org.apache.log4j.Logger;
import org.w3c.dom.Document;
Modified: trunk/server/src/org/bedework/exchgsynch/web/PostMethod.java
===================================================================
--- trunk/server/src/org/bedework/exchgsynch/web/PostMethod.java 2010-10-26 13:36:32 UTC (rev 25)
+++ trunk/server/src/org/bedework/exchgsynch/web/PostMethod.java 2010-10-26 13:40:34 UTC (rev 26)
@@ -26,8 +26,8 @@
package org.bedework.exchgsynch.web;
-import org.bedework.exchgsynch.ExchangeSubscription;
-import org.bedework.exchgsynch.SynchException;
+import org.bedework.exchgsynch.intf.ExchangeSubscription;
+import org.bedework.exchgsynch.intf.SynchException;
import org.bedework.exchgsynch.responses.Notification;
import org.w3c.dom.Document;
More information about the Bedework-commit
mailing list