[CalendarServer-changes] [5968] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Mon Aug 2 15:54:56 PDT 2010
Revision: 5968
http://trac.macosforge.org/projects/calendarserver/changeset/5968
Author: sagen at apple.com
Date: 2010-08-02 15:54:55 -0700 (Mon, 02 Aug 2010)
Log Message:
-----------
Collections (calendar+addressbook) have pushkey dav property again. (Still working on homes' push properties).
Modified Paths:
--------------
CalendarServer/trunk/twistedcaldav/resource.py
CalendarServer/trunk/txcaldav/icalendarstore.py
CalendarServer/trunk/txcarddav/iaddressbookstore.py
CalendarServer/trunk/txdav/common/datastore/file.py
CalendarServer/trunk/txdav/idav.py
Modified: CalendarServer/trunk/twistedcaldav/resource.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/resource.py 2010-08-02 20:52:32 UTC (rev 5967)
+++ CalendarServer/trunk/twistedcaldav/resource.py 2010-08-02 22:54:55 UTC (rev 5968)
@@ -399,23 +399,32 @@
isvirt = (yield self.isVirtualShare(request))
if self.isCalendarCollection() or self.isAddressBookCollection():
+
# Push notification DAV property "pushkey"
if qname == customxml.PubSubXMPPPushKeyProperty.qname():
- pubSubConfiguration = getPubSubConfiguration(config)
- if (pubSubConfiguration['enabled'] and
- getattr(self, "clientNotifier", None) is not None):
+
+ # FIXME: is there a better way to get back to the associated
+ # datastore object?
+ dataObject = None
+ for attr in ("_newStoreCalendar", "_newStoreAddressBook"):
+ if hasattr(self, attr):
+ dataObject = getattr(self, attr)
+ if dataObject:
label = "collection" if isvirt else "default"
- id = self.clientNotifier.getID(label=label)
- nodeName = getPubSubPath(id, pubSubConfiguration)
- propVal = customxml.PubSubXMPPPushKeyProperty(nodeName)
- nodeCacher = getNodeCacher()
- (yield nodeCacher.createNode(self.clientNotifier, nodeName))
- returnValue(propVal)
+ notifierID = dataObject.notifierID(label=label)
+ if notifierID is not None:
+ print "XYZZY notifierID", notifierID
- else:
- returnValue(customxml.PubSubXMPPPushKeyProperty())
+ pubSubConfiguration = getPubSubConfiguration(config)
+ nodeName = getPubSubPath(notifierID, pubSubConfiguration)
+ propVal = customxml.PubSubXMPPPushKeyProperty(nodeName)
+ # nodeCacher = getNodeCacher()
+ # (yield nodeCacher.createNode(self.clientNotifier, nodeName))
+ returnValue(propVal)
+ returnValue(customxml.PubSubXMPPPushKeyProperty())
+
if isvirt:
if self.isShadowableProperty(qname):
ownerPrincipal = (yield self.resourceOwnerPrincipal(request))
Modified: CalendarServer/trunk/txcaldav/icalendarstore.py
===================================================================
--- CalendarServer/trunk/txcaldav/icalendarstore.py 2010-08-02 20:52:32 UTC (rev 5967)
+++ CalendarServer/trunk/txcaldav/icalendarstore.py 2010-08-02 22:54:55 UTC (rev 5968)
@@ -21,6 +21,7 @@
"""
from zope.interface import Interface
+from txdav.idav import INotifier
__all__ = [
@@ -63,7 +64,7 @@
# Interfaces
#
-class ICalendarHome(Interface):
+class ICalendarHome(INotifier):
"""
An L{ICalendarHome} is a collection of calendars which belongs to a
specific principal and contains the calendars which that principal has
@@ -140,7 +141,7 @@
"""
-class ICalendar(Interface):
+class ICalendar(INotifier):
"""
Calendar
Modified: CalendarServer/trunk/txcarddav/iaddressbookstore.py
===================================================================
--- CalendarServer/trunk/txcarddav/iaddressbookstore.py 2010-08-02 20:52:32 UTC (rev 5967)
+++ CalendarServer/trunk/txcarddav/iaddressbookstore.py 2010-08-02 22:54:55 UTC (rev 5968)
@@ -20,6 +20,7 @@
from zope.interface import Interface
from txdav.common.icommondatastore import ICommonTransaction
+from txdav.idav import INotifier
__all__ = [
# Classes
@@ -51,7 +52,7 @@
# Interfaces
#
-class IAddressBookHome(Interface):
+class IAddressBookHome(INotifier):
"""
AddressBook home
@@ -114,7 +115,7 @@
"""
-class IAddressBook(Interface):
+class IAddressBook(INotifier):
"""
AddressBook
Modified: CalendarServer/trunk/txdav/common/datastore/file.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/file.py 2010-08-02 20:52:32 UTC (rev 5967)
+++ CalendarServer/trunk/txdav/common/datastore/file.py 2010-08-02 22:54:55 UTC (rev 5968)
@@ -439,6 +439,11 @@
self._transaction.addOperation(props.flush, "flush home properties")
return props
+ def notifierID(self, label="default"):
+ if self._notifier:
+ return self._notifier.getID(label)
+ else:
+ return None
class CommonHomeChild(LoggingMixIn, FancyEqMixin):
"""
@@ -671,7 +676,13 @@
def _doValidate(self, component):
raise NotImplementedError
+ def notifierID(self, label="default"):
+ if self._notifier:
+ return self._notifier.getID(label)
+ else:
+ return None
+
class CommonObjectResource(LoggingMixIn, FancyEqMixin):
"""
@ivar _path: The path of the file on disk
Modified: CalendarServer/trunk/txdav/idav.py
===================================================================
--- CalendarServer/trunk/txdav/idav.py 2010-08-02 20:52:32 UTC (rev 5967)
+++ CalendarServer/trunk/txdav/idav.py 2010-08-02 22:54:55 UTC (rev 5968)
@@ -154,3 +154,30 @@
@param operation: a callable.
"""
+
+class INotifier(Interface):
+ """
+ Push notification interface
+ """
+
+ def notifierID(label):
+ """
+ Return a push notification id.
+
+ Data store objects can have an associated Notifier object which is
+ responsible for the actual communication with the outside world.
+ Clients determine what notification service to subscribe to by
+ querying the server for various DAV properties. These properties
+ include unique IDs from each resource, and the source of truth for
+ these IDs is the data store. This method returns the notification
+ related ID for a given data store object.
+
+ Sharing introduces the need for a data store object to have multiple
+ notifier IDs because a subscriber sees the ID for the particular
+ collection being shared while the sharer sees the ID of the parent
+ home. Therefore there is a label parameter to identify which ID is
+ being requested: "default" (what a sharer sees), or "collection"
+ for the collection itself (what a subscriber sees).
+
+ @return: a string (or None if notifications are disabled)
+ """
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20100802/94d55626/attachment.html>
More information about the calendarserver-changes
mailing list