Ignore:
Timestamp:
Oct 4, 2007, 9:47:22 AM (14 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Convert:
svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@13
Message:

Support services on a JID.

Author: ralphm
Fixes #2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/iwokkel.py

    r4 r6  
    105105    """
    106106
    107     def getDiscoInfo(target, requestor, nodeIdentifier=None):
     107    def getDiscoInfo(requestor, target, nodeIdentifier=None):
    108108        """
    109109        Get identity and features from this entity, node.
     
    111111        @param requestor: The entity the request originated from.
    112112        @type requestor: L{jid.JID}
     113        @param target: The target entity to which the request is made.
     114        @type target: L{jid.JID}
    113115        @param nodeIdentifier: The optional identifier of the node at this
    114116                               entity to retrieve the identify and features of.
     
    117119        """
    118120
    119     def getDiscoItems(target, requestor, nodeIdentifier=None):
     121    def getDiscoItems(requestor, target, nodeIdentifier=None):
    120122        """
    121123        Get contained items for this entity, node.
     
    123125        @param requestor: The entity the request originated from.
    124126        @type requestor: L{jid.JID}
     127        @param target: The target entity to which the request is made.
     128        @type target: L{jid.JID}
    125129        @param nodeIdentifier: The optional identifier of the node at this
    126130                               entity to retrieve the identify and features of.
     
    132136class IPubSubClient(Interface):
    133137
    134     def itemsReceived(notifier, node, items):
     138    def itemsReceived(recipient, service, nodeIdentifier, items):
    135139        """
    136140        Called when items have been received from a node.
    137141
    138         @param notifier: the entity from which the notification was received.
    139         @type notifier: L{jid.JID}
    140         @param node: identifier of the node the items belong to.
    141         @type node: C{unicode}
    142         @param items: list of received items as domish elements.
     142        @param recipient: The entity to which the notification was sent.
     143        @type recipient: L{jid.JID}
     144        @param service: The entity from which the notification was received.
     145        @type service: L{jid.JID}
     146        @param nodeIdentifier: Identifier of the node the items belong to.
     147        @type nodeIdentifier: C{unicode}
     148        @param items: List of received items as domish elements.
    143149        @type items: C{list} of L{domish.Element}
    144150        """
    145151
    146     def createNode(node=None):
     152    def createNode(service, nodeIdentifier=None):
    147153        """
    148154        Create a new publish subscribe node.
    149155
    150         @param node: optional suggestion for the new node's identifier. If
    151                      omitted, the creation of an instant node will be
    152                      attempted.
    153         @type node: L{unicode}
     156        @param service: The publish-subscribe service entity.
     157        @type service: L{jid.JID}
     158        @param nodeIdentifier: Optional suggestion for the new node's
     159                               identifier. If omitted, the creation of an
     160                               instant node will be attempted.
     161        @type nodeIdentifier: L{unicode}
    154162        @return: a deferred that fires with the identifier of the newly created
    155163                 node. Note that this can differ from the suggested identifier
     
    159167        """
    160168
    161     def deleteNode(node):
     169    def deleteNode(service, nodeIdentifier):
    162170        """
    163171        Delete a node.
    164172
    165         @param node: identifier of the node to be deleted.
    166         @type node: L{unicode}
    167         @rtype: L{defer.Deferred}
    168         """
    169 
    170     def subscribe(node, subscriber):
     173        @param service: The publish-subscribe service entity.
     174        @type service: L{jid.JID}
     175        @param nodeIdentifier: Identifier of the node to be deleted.
     176        @type nodeIdentifier: L{unicode}
     177        @rtype: L{defer.Deferred}
     178        """
     179
     180    def subscribe(service, nodeIdentifier, subscriber):
    171181        """
    172182        Subscribe to a node with a given JID.
    173183
    174         @param node: identifier of the node to subscribe to.
    175         @type node: L{unicode}
     184        @param service: The publish-subscribe service entity.
     185        @type service: L{jid.JID}
     186        @param nodeIdentifier: Identifier of the node to subscribe to.
     187        @type nodeIdentifier: L{unicode}
    176188        @param subscriber: JID to subscribe to the node.
    177189        @type subscriber: L{jid.JID}
     
    179191        """
    180192
    181     def publish(requestor, node, items=[]):
     193    def publish(service, nodeIdentifier, items=[]):
    182194        """
    183195        Publish to a node.
     
    187199        actions only signify a change in some resource.
    188200
    189         @param node: identifier of the node to publish to.
    190         @type node: L{unicode}
    191         @param items: list of item elements.
     201        @param service: The publish-subscribe service entity.
     202        @type service: L{jid.JID}
     203        @param nodeIdentifier: Identifier of the node to publish to.
     204        @type nodeIdentifier: L{unicode}
     205        @param items: List of item elements.
    192206        @type items: L{list} of L{Item}
    193207        @rtype: L{defer.Deferred}
     
    205219    """
    206220
    207     def notifyPublish(entity, nodeIdentifier, notifications):
     221    def notifyPublish(service, nodeIdentifier, notifications):
    208222        """
    209223        Send out notifications for a publish event.
    210224
    211         @param entity: The entity the notifications will originate from.
    212         @type entity: L{jid.JID}
     225        @param service: The entity the notifications will originate from.
     226        @type service: L{jid.JID}
    213227        @param nodeIdentifier: The identifier of the node that was published
    214228                               to.
     
    220234        """
    221235
    222     def publish(requestor, nodeIdentifier, items):
     236    def publish(requestor, service, nodeIdentifier, items):
    223237        """
    224238        Called when a publish request has been received.
     
    226240        @param requestor: The entity the request originated from.
    227241        @type requestor: L{jid.JID}
     242        @param service: The entity the request was addressed to.
     243        @type service: L{jid.JID}
    228244        @param nodeIdentifier: The identifier of the node to publish to.
    229245        @type nodeIdentifier: C{unicode}
     
    234250        """
    235251
    236     def subscribe(requestor, nodeIdentifier, subscriber):
     252    def subscribe(requestor, service, nodeIdentifier, subscriber):
    237253        """
    238254        Called when a subscribe request has been received.
     
    240256        @param requestor: The entity the request originated from.
    241257        @type requestor: L{jid.JID}
     258        @param service: The entity the request was addressed to.
     259        @type service: L{jid.JID}
    242260        @param nodeIdentifier: The identifier of the node to subscribe to.
    243261        @type nodeIdentifier: C{unicode}
     
    249267        """
    250268
    251     def unsubscribe(requestor, nodeIdentifier, subscriber):
     269    def unsubscribe(requestor, service, nodeIdentifier, subscriber):
    252270        """
    253271        Called when a subscribe request has been received.
     
    255273        @param requestor: The entity the request originated from.
    256274        @type requestor: L{jid.JID}
     275        @param service: The entity the request was addressed to.
     276        @type service: L{jid.JID}
    257277        @param nodeIdentifier: The identifier of the node to unsubscribe from.
    258278        @type nodeIdentifier: C{unicode}
     
    264284        """
    265285
    266     def subscriptions(requestor):
     286    def subscriptions(requestor, service):
    267287        """
    268288        Called when a subscriptions retrieval request has been received.
     
    270290        @param requestor: The entity the request originated from.
    271291        @type requestor: L{jid.JID}
     292        @param service: The entity the request was addressed to.
     293        @type service: L{jid.JID}
    272294        @return: A deferred that fires with a C{list} of suscriptions as
    273295                 C{tuple}s of (node identifier as C{unicode}, subscriber as
     
    277299        """
    278300
    279     def affiliations(requestor):
     301    def affiliations(requestor, service):
    280302        """
    281303        Called when a affiliations retrieval request has been received.
     
    283305        @param requestor: The entity the request originated from.
    284306        @type requestor: L{jid.JID}
     307        @param service: The entity the request was addressed to.
     308        @type service: L{jid.JID}
    285309        @return: A deferred that fires with a C{list} of affiliations as
    286310                 C{tuple}s of (node identifier as C{unicode}, affiliation state
     
    290314        """
    291315
    292     def create(requestor, nodeIdentifier):
     316    def create(requestor, service, nodeIdentifier):
    293317        """
    294318        Called when a node creation request has been received.
     
    296320        @param requestor: The entity the request originated from.
    297321        @type requestor: L{jid.JID}
     322        @param service: The entity the request was addressed to.
     323        @type service: L{jid.JID}
    298324        @param nodeIdentifier: The suggestion for the identifier of the node to
    299325                               be created. If the request did not include a
     
    306332        """
    307333
    308     def getDefaultConfiguration(requestor):
     334    def getDefaultConfiguration(requestor, service):
    309335        """
    310336        Called when a default node configuration request has been received.
     
    312338        @param requestor: The entity the request originated from.
    313339        @type requestor: L{jid.JID}
     340        @param service: The entity the request was addressed to.
     341        @type service: L{jid.JID}
    314342        @return: A deferred that fires with a C{dict} representing the default
    315343                 node configuration. Keys are C{str}s that represent the
     
    319347        """
    320348
    321     def getConfiguration(requestor, nodeIdentifier):
     349    def getConfiguration(requestor, service, nodeIdentifier):
    322350        """
    323351        Called when a node configuration retrieval request has been received.
     
    325353        @param requestor: The entity the request originated from.
    326354        @type requestor: L{jid.JID}
     355        @param service: The entity the request was addressed to.
     356        @type service: L{jid.JID}
    327357        @param nodeIdentifier: The identifier of the node to retrieve the
    328358                               configuration from.
     
    334364        """
    335365
    336     def setConfiguration(requestor, nodeIdentifier, options):
     366    def setConfiguration(requestor, service, nodeIdentifier, options):
    337367        """
    338368        Called when a node configuration change request has been received.
     
    340370        @param requestor: The entity the request originated from.
    341371        @type requestor: L{jid.JID}
     372        @param service: The entity the request was addressed to.
     373        @type service: L{jid.JID}
    342374        @param nodeIdentifier: The identifier of the node to change the
    343375                               configuration of.
     
    348380        """
    349381
    350     def items(requestor, nodeIdentifier, maxItems, itemIdentifiers):
     382    def items(requestor, service, nodeIdentifier, maxItems, itemIdentifiers):
    351383        """
    352384        Called when a items retrieval request has been received.
     
    354386        @param requestor: The entity the request originated from.
    355387        @type requestor: L{jid.JID}
     388        @param service: The entity the request was addressed to.
     389        @type service: L{jid.JID}
    356390        @param nodeIdentifier: The identifier of the node to retrieve items
    357391                               from.
     
    359393        """
    360394
    361     def retract(requestor, nodeIdentifier, itemIdentifiers):
     395    def retract(requestor, service, nodeIdentifier, itemIdentifiers):
    362396        """
    363397        Called when a item retraction request has been received.
     
    365399        @param requestor: The entity the request originated from.
    366400        @type requestor: L{jid.JID}
     401        @param service: The entity the request was addressed to.
     402        @type service: L{jid.JID}
    367403        @param nodeIdentifier: The identifier of the node to retract items
    368404                               from.
     
    370406        """
    371407
    372     def purge(requestor, nodeIdentifier):
     408    def purge(requestor, service, nodeIdentifier):
    373409        """
    374410        Called when a node purge request has been received.
     
    376412        @param requestor: The entity the request originated from.
    377413        @type requestor: L{jid.JID}
     414        @param service: The entity the request was addressed to.
     415        @type service: L{jid.JID}
    378416        @param nodeIdentifier: The identifier of the node to be purged.
    379417        @type nodeIdentifier: C{unicode}
    380418        """
    381419
    382     def delete(requestor, nodeIdentifier):
     420    def delete(requestor, service, nodeIdentifier):
    383421        """
    384422        Called when a node deletion request has been received.
     
    386424        @param requestor: The entity the request originated from.
    387425        @type requestor: L{jid.JID}
     426        @param service: The entity the request was addressed to.
     427        @type service: L{jid.JID}
    388428        @param nodeIdentifier: The identifier of the node to be delete.
    389429        @type nodeIdentifier: C{unicode}
    390430        """
    391 
    392 
Note: See TracChangeset for help on using the changeset viewer.