No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0248.xml 45KB

  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. <!ENTITY ITEM "&lt;item/&gt;">
  6. <!ENTITY ITEMS "&lt;items/&gt;">
  7. ]>
  8. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  9. <xep>
  10. <header>
  11. <title>PubSub Collection Nodes</title>
  12. <abstract>This specification defines the nature and handling of collection nodes in the XMPP publish-subscribe extension.</abstract>
  14. <number>0248</number>
  15. <status>Deferred</status>
  16. <type>Standards Track</type>
  17. <sig>Standards</sig>
  18. <approver>Council</approver>
  19. <dependencies>
  20. <spec>XMPP Core</spec>
  21. <spec>XEP-0060</spec>
  22. </dependencies>
  23. <supersedes/>
  24. <supersededby/>
  25. <shortname>NOT_YET_ASSIGNED</shortname>
  26. &stpeter;
  27. &ralphm;
  28. <author>
  29. <firstname>Brian</firstname>
  30. <surname>Cully</surname>
  31. <email></email>
  32. <jid></jid>
  33. </author>
  34. <revision>
  35. <version>0.2</version>
  36. <date>2010-09-28</date>
  37. <initials>bjc</initials>
  38. <remark>
  39. <p>Completely reworked from initial version. To wit:</p>
  40. <ul>
  41. <li>Normalized layout</li>
  42. <li>Added required sections</li>
  43. <li>Renamed "multi-collection" disco feature to "multi-collections" for consistency with "collections" feature</li>
  44. <li>Added associate request</li>
  45. <li>Added dissociate request</li>
  46. <li>Added ability to request items on a collection node</li>
  47. <li>Removed "Node Relationship Models" section</li>
  48. </ul>
  49. </remark>
  50. </revision>
  51. <revision>
  52. <version>0.1</version>
  53. <date>2008-08-11</date>
  54. <initials>psa</initials>
  55. <remark><p>Initial version, split from XEP-0060.</p></remark>
  56. </revision>
  57. </header>
  58. <section1 topic='Introduction' anchor='introduction'>
  59. <p>&xep0060; defines an XMPP protocol extension for generic publish-subscribe features. However, it only allows notifications from nodes to which an entity is directly subscribed. It is useful in some circumstances to describe a relationship between nodes so that a publish on one node may be delivered via another node. For instance, if an entity is interested in notifications from a set of nodes the entity would discover each node somehow and then subscribe to them. With collection nodes, the entity would subscribe only to the collection which links the desired nodes, simplifying the subscription process.</p>
  60. <p>In addition to simplifying the subscriber's usage, collection nodes also allow the owner to describe almost any type of relationship between nodes. Using various access models on different nodes the owner can also create almost any desired authorization semantics on a set of leaf nodes.</p>
  61. <p class='em'>Note: Any use cases not described herein are described in <cite>XEP-0060</cite>. Also, this document does not show error flows related to the generic publish-subscribe use cases referenced herein, since they are exhaustively defined in <cite>XEP-0060</cite>. The reader is referred to <cite>XEP-0060</cite> for all relevant protocol details related to the XMPP publish-subscribe extension.</p>
  62. </section1>
  63. <section1 topic='Scope' anchor='scope'>
  64. <p>This documents addresses the common requirements regarding configuration, publishing, subscribing, and notification semantics of collection nodes.</p>
  65. </section1>
  66. <section1 topic='Glossary' anchor='glossary'>
  67. <p>The following terms are used in this document to refer to collection node-specific features.</p>
  68. <p class='em'>Note: some of these terms are specified in greater detail within the body of this document.</p>
  69. <dl>
  70. <di>
  71. <dt>Collection Node</dt>
  72. <dd>A type of node that contains other nodes but no published items (<em>c.f.</em> Leaf Node).</dd>
  73. </di>
  74. <di>
  75. <dt>Leaf Node</dt>
  76. <dd>A type of node that contains published items but no other nodes (<em>c.f.</em> Collection Node).</dd>
  77. </di>
  78. <di>
  79. <dt>Node Graph</dt>
  80. <dd>The network of nodes emitting from a given node which contains all its descendants.</dd>
  81. </di>
  82. <di>
  83. <dt>Root Node</dt>
  84. <dd>An anonymous collection node used as the <em>de facto</em> beginning of a service's node graph.</dd>
  85. </di>
  86. <di>
  87. <dt>Subscription Depth</dt>
  88. <dd>How deep the collection node graph will be traversed when determining whether notifications will be sent. May be any integer, 0 or greater, or "all".</dd>
  89. </di>
  90. <di>
  91. <dt>Subscription Type</dt>
  92. <dd>The type of notification, either "nodes", "items", or "all" which the subscriber is interested in.</dd>
  93. </di>
  94. </dl>
  95. </section1>
  96. <section1 topic='Preliminaries' anchor='preliminaries'>
  97. <section2 topic='Collection Nodes' anchor='collection-nodes'>
  98. <p>Collection nodes link nodes together to unify notifications from a set of collection or leaf nodes. An entity can subscribe to the collection and receive notifications of any associated leaf nodes.</p>
  99. <p>A collection node can link with any other node in order to create a directed acyclic graph (DAG). Collection nodes MUST NOT be linked in such a way as to produce a cyclic graph (<em>i.e.</em>, they cannot link to nodes that eventually link back to the initial node).</p>
  100. <p>Collection nodes only contain other nodes and MUST NOT contain published items (therefore a collection MUST NOT support the "publish" feature or related features such as "persistent-items").</p>
  101. </section2>
  102. </section1>
  103. <section1 topic='Entity Use Cases' anchor='entity'>
  104. <section2 topic='Discovering Support for Collection Nodes' anchor='disco-support'>
  105. <p>An entity might wish to discover if a service implements collection nodes; in order to do so, it sends a service discovery information ("disco#info") query to the component's JID using &xep0030;. If a service supports collection nodes it MUST return a "pubsub#collections" feature. In addition, if the service supports associating a node with more than one collection it MUST return a feature of "pubsub#multi-collections".</p>
  106. <example caption='Entity requests features from a service'><![CDATA[
  107. <iq type='get'
  108. from='francisco@denmark.lit/barracks'
  109. to='pubsub.shakespeare.lit'
  110. id='info1'>
  111. <query xmlns=''/>
  112. </iq>
  113. ]]></example>
  114. <example caption='Service responds with support for collections'><![CDATA[
  115. <iq type='result'
  116. from='pubsub.shakespeare.lit'
  117. to='francisco@denmark.lit/barracks'
  118. id='info1'>
  119. <query xmlns=''>
  120. ...
  121. <feature var=''/>
  122. <feature var=''/>
  123. ...
  124. </query>
  125. </iq>
  126. ]]></example>
  127. </section2>
  128. <section2 topic='Discover Nodes' anchor='disco-nodes'>
  129. <p>The service discovery items ("disco#items") protocol enables an entity to query a service for a list of associated items, which, in the case of collection nodes would consist of the children associated with a given node.</p>
  130. <section3 topic='Request' anchor='disco-nodes-request'>
  131. <example caption='Entity requests child node discovery'><![CDATA[
  132. <iq type='get'
  133. from='francisco@denmark.lit/barracks'
  134. to='pubsub.shakespeare.lit'
  135. id='disco1'>
  136. <query xmlns=''
  137. node='blogs'/>
  138. </iq>
  139. ]]></example>
  140. </section3>
  141. <section3 topic='Success Case' anchor='disco-nodes-success'>
  142. <example caption='Service responds with child nodes'><![CDATA[
  143. <iq type='result'
  144. from='pubsub.shakespeare.lit'
  145. to='francisco@denmark.lit/barracks'
  146. id='disco1'>
  147. <query xmlns=''
  148. node='blogs'>
  149. <item node='Romeoance'
  150. name='Letters to my Beloved'
  151. jid='pubsub.shakespeare.lit'/>
  152. <item node='Julliennui'
  153. name='A Rose by Another Name'
  154. jid='pubsub.shakespeare.lit'/>
  155. </query>
  156. </iq>
  157. ]]></example>
  158. </section3>
  159. </section2>
  160. <section2 topic='Notifications' anchor='notifications'>
  161. <section3 topic='Generating Notifications for Collections' anchor='notify'>
  162. <p>If a notification on a child node is created and then delivered via the collection then the notifications generated by the service MUST contain additional information. The 'node' attribute of the &ITEM; or &lt;node/&gt; element contained in the notification message MUST specify the node identifier of the node that generated the notification (not the collection) and the &MESSAGE; stanza MUST contain &xep0131; that specifies the node identifier of the collection.</p>
  163. <p class='em'>Note: The delivery options (such as "pubsub#deliver_payloads") are determined by the publishing leaf node, not by the collection node. If the owner of a collection node sets delivery options for a collection node, the service SHOULD ignore those options and apply the options set for the leaf node that publishes an item.</p>
  164. <section4 topic='Notifications about Items' anchor='notify-items'>
  165. <p>Item notifications are notifications about the contents of a leaf node, and are generated by a publish, retract, or purge request.</p>
  166. <example caption='Subscriber receives a publish notification from a collection'><![CDATA[
  167. <message to='francisco@denmark.lit' from='pubsub.shakespeare.lit'>
  168. <event xmlns=''>
  169. <items node='princely_musings'>
  170. <item id='ae890ac52d0df67ed7cfdf51b644e901'>
  171. ...
  172. </item>
  173. </items>
  174. </event>
  175. <headers xmlns=''>
  176. <header name='Collection'>blogs</header>
  177. </headers>
  178. </message>
  179. ]]></example>
  180. </section4>
  181. <section4 topic='Notifications about Nodes' anchor='notify-items'>
  182. <p>Node notifications are notifications about nodes themselves, and are generated by a create, delete, or configure request.</p>
  183. <example caption='Subscriber receives a creation notification from a collection'><![CDATA[
  184. <message to='francisco@denmark.lit' from='pubsub.shakespeare.lit'>
  185. <event xmlns=''>
  186. <create node='princely_musings'/>
  187. </event>
  188. <headers xmlns=''>
  189. <header name='Collection'>blogs</header>
  190. </headers>
  191. </message>
  192. ]]></example>
  193. </section4>
  194. </section3>
  195. <section3 topic='Node Association and Dissociation' anchor='notify-associate-dissociate'>
  196. <p>If a collection node is configured to send notification of node associations and disassociations, the service shall send an event that contains a &lt;collection/&gt; element whose 'node' attribute specifies the NodeID of the collection; this element in turn contains an &lt;associate/&gt; or &lt;dissociate/&gt; element whose 'node' attribute specifies the NodeID of node that has been associated with the collection.</p>
  197. <example caption='Notification of node association'><![CDATA[
  198. <message from='pubsub.shakespeare.lit'
  199. to='francisco@denmark.lit'
  200. id='newnode1'>
  201. <event xmlns=''>
  202. <collection node='some-collection'>
  203. <associate node='new-node-id'>
  204. </collection>
  205. </event>
  206. </message>
  207. ]]></example>
  208. <example caption='Notification of node dissociation'><![CDATA[
  209. <message from='pubsub.shakespeare.lit'
  210. to='francisco@denmark.lit'
  211. id='newnode1'>
  212. <event xmlns=''>
  213. <collection node='some-collection'>
  214. <dissociate node='old-node-id'>
  215. </collection>
  216. </event>
  217. </message>
  218. ]]></example>
  219. <section4 topic='Including Node Meta-Data' anchor='notify-metadata'>
  220. <p>The notification event MAY also include the node meta-data, formatted using the &xep0004; protocol.</p>
  221. <example caption='Notification of node association'><![CDATA[
  222. <message from='pubsub.shakespeare.lit'
  223. to='francisco@denmark.lit'
  224. id='newnode2'>
  225. <event xmlns=''>
  226. <collection node='some-collection'>
  227. <associate node='new-node-id'>
  228. <x xmlns='jabber:x:data' type='result'>
  229. <field var='FORM_TYPE' type='hidden'>
  230. <value></value>
  231. </field>
  232. <field var='pubsub#creation_date'>
  233. <value>2003-07-29T22:56Z</value>
  234. </field>
  235. <field var='pubsub#creator'>
  236. <value>hamlet@denmark.lit</value>
  237. </field>
  238. <field var='pubsub#description'>
  239. <value>Atom feed for my blog.</value>
  240. </field>
  241. <field var='pubsub#language'>
  242. <value>en</value>
  243. </field>
  244. <field var='pubsub#contact'>
  245. <value>bard@shakespeare.lit</value>
  246. </field>
  247. <field var='pubsub#owner'>
  248. <value>hamlet@denmark.lit</value>
  249. </field>
  250. <field var='pubsub#title'>
  251. <value>Princely Musings (Atom).</value>
  252. </field>
  253. <field var='pubsub#type'
  254. ><value></value>
  255. </field>
  256. </x>
  257. </node>
  258. </collection>
  259. </event>
  260. </message>
  261. ]]></example>
  262. </section4>
  263. </section3>
  264. </section2>
  265. </section1>
  266. <section1 topic='Subscriber Use Cases' anchor='subscriber'>
  267. <section2 topic='Subscribe to a Collection Node' anchor='subscribe'>
  268. <p>A service that implements collection nodes SHOULD allow entities to subscribe to collection nodes (subject to access models and local security policies).</p>
  269. <p>In addition to the subscription configuration options already defined in <cite>XEP-0060</cite>, there are two subscription configuration options specific to collection nodes:</p>
  270. <ul>
  271. <li>
  272. <p><strong>pubsub#subscription_type</strong></p>
  273. <p>This subscription option enables the subscriber to subscribe either to notifications about items or notifications about nodes.</p>
  274. <p>If the subscription type is "items", the subscriber shall be notified whenever any node contained in the collection has an item published to it, retracted from it, or the node is purged, as modified by the value of the "pubsub#subscription_depth" option.</p>
  275. <p>If the subscription type is "nodes", the subscriber shall be notified whenever a new node is added to the collection, removed from the collection, or the configuration of a node within the collection has changed, as modified by the value of the "pubsub#subscription_depth" option.</p>
  276. <p>If the subscription type is "all", the subscriber shall be notified about both "items" and "nodes" types of events, as modified by the value of the "pubsub#subscription_depth" option.</p>
  277. <p>The default value of this subscription option SHOULD be "nodes".</p>
  278. </li>
  279. <li>
  280. <p><strong>pubsub#subscription_depth</strong></p>
  281. <p>This subscription option enables the subscriber to specify how far to traverse the node graph when determining whether a notification will be sent. It may be any integer value, 0 or greater, or the value "all" which means that any node within the collection will generate a notification.</p>
  282. <p>The default value of this subscription option SHOULD be "1".</p>
  283. </li>
  284. </ul>
  285. <p>In order to subscribe to a collection node, an entity MUST send a subscription request to the node; the subscription request MAY include subscription options, but this is not strictly necessary (especially if the entity does not wish to override the default settings for the "pubsub#subscription_type" and "pubsub#subscription_depth" options).</p>
  286. <section3 topic='Request' anchor='subscribe-request'>
  287. <example caption='Entity subscribes to a collection node (no configuration)'><![CDATA[
  288. <iq type='set'
  289. from='francisco@denmark.lit/barracks'
  290. to='pubsub.shakespeare.lit'
  291. id='collsub1'>
  292. <pubsub xmlns=''>
  293. <subscribe jid='francisco@denmark.lit'
  294. node='blogs'/>
  295. </pubsub>
  296. </iq>
  297. ]]></example>
  298. <p>The subscriber will now receive notification of new first-level nodes created within the "blogs" collection.</p>
  299. <example caption='Entity subscribes to a collection node (with configuration)'><![CDATA[
  300. <iq type='set'
  301. from='francisco@denmark.lit/barracks'
  302. to='pubsub.shakespeare.lit'
  303. id='collsub1'>
  304. <pubsub xmlns=''>
  305. <subscribe jid='francisco@denmark.lit'
  306. node='blogs'/>
  307. <options>
  308. <x xmlns='jabber:x:data' type='submit'>
  309. <field var='FORM_TYPE' type='hidden'>
  310. <value></value>
  311. </field>
  312. <field var='pubsub#subscription_type'>
  313. <value>items</value>
  314. </field>
  315. <field var='pubsub#subscription_depth'>
  316. <value>all</value>
  317. </field>
  318. </x>
  319. </options>
  320. </pubsub>
  321. </iq>
  322. ]]></example>
  323. </section3>
  324. <section3 topic='Success Case' anchor='subscribe-success'>
  325. <p>If the service allows the subscription it MUST inform the requesting entity that it is now subscribed.</p>
  326. <example caption='Service responds with success'><![CDATA[
  327. <iq type='result'
  328. from='pubsub.shakespeare.lit'
  329. to='francisco@denmark.lit/barracks'
  330. id='collsub1'>
  331. <pubsub xmlns=''>
  332. <subscription node='blogs'
  333. jid='francisco@denmark.lit'
  334. subscription='subscribed'/>
  335. </pubsub>
  336. </iq>
  337. ]]></example>
  338. </section3>
  339. <section3 topic='Error Cases' anchor='subscribe-errors'>
  340. <p>A service MAY allow an entity to subscribe to a collection node in two ways, once with a subscription of type "nodes" (to receive notification of any new nodes added to the collection or the entire tree) and once with a subscription of type "items" (to receive all items published within the tree). However, a service SHOULD NOT allow an entity to subscribe twice to a collection node (once with a subscription depth of "1" and once with a subscription depth of "all") for the same subscription type, since two such subscriptions are unnecessary (a depth of "all" includes by definition a depth of "1"); in this case the service SHOULD return a &conflict; error to the requesting entity.</p>
  341. <example caption='Service does not allow mulitple subscriptions to the same node'><![CDATA[
  342. <iq type='error'
  343. from='pubsub.shakespeare.lit'
  344. to='francisco@denmark.lit/barracks'
  345. id='collsub1'>
  346. <error type='cancel'>
  347. <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  348. </error>
  349. </iq>
  350. ]]></example>
  351. <p>Depending on the nature of the node graph, a subscription type of "items" and depth of "all" may result in an extremely large number of notifications. Therefore, a service MAY disallow such a combination of subscription options, in which case it MUST return a &notallowed; error to the requesting entity.</p>
  352. <example caption='Service does not allow requested options'><![CDATA[
  353. <iq type='error'
  354. from='pubsub.shakespeare.lit'
  355. to='francisco@denmark.lit/barracks'
  356. id='collsub1'>
  357. <error type='cancel'>
  358. <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  359. </error>
  360. </iq>
  361. ]]></example>
  362. </section3>
  363. </section2>
  364. <section2 topic='Retrieving Items on Collection Nodes' anchor='retrieve-items'>
  365. <p>When an entity requests items on a collection node the service SHOULD return the items on any leaf nodes associated with it subject to the access model of the collection node.</p>
  366. <section3 topic='Request' anchor='retrieve-request'>
  367. <example caption='Subscriber requests all items on a collection'><![CDATA[
  368. <iq type='get'
  369. from='francisco@denmark.lit/barracks'
  370. to='pubsub.shakespeare.lit'
  371. id='items1'>
  372. <pubsub xmlns=''>
  373. <items node='blogs'/>
  374. </pubsub>
  375. </iq>
  376. ]]></example>
  377. </section3>
  378. <section3 topic='Success Case' anchor='retrieve-request'>
  379. <p>When a collection contains multiple nodes with items it MUST return multiple &ITEMS; elements, one per node.</p>
  380. <example caption='Service returns items on leaf nodes'><![CDATA[
  381. <iq type='result'
  382. from='pubsub.shakespeare.lit'
  383. to='francisco@denmark.lit/barracks'
  384. id='items1'>
  385. <pubsub xmlns=''>
  386. <items node='Romeoance'>
  387. <item id='368866411b877c30064a5f62b917cffe'>
  388. ...
  389. </item>
  390. </items>
  391. <items node='Julliennui'>
  392. <item id='3300659945416e274474e469a1f0154c'>
  393. ...
  394. </item>
  395. </items>
  396. </pubsub>
  397. </iq>
  398. ]]></example>
  399. </section3>
  400. <section3 topic='Error Cases' anchor='retrieve-errors'>
  401. <p>Depending on the nature of the node graph it may be expensive to allow item retrieval from a collection node. Therefore the service MAY disallow item retrieval via collection nodes, in which case it MUST return a &feature; error to the requesting entity.</p>
  402. <example caption='Service cannot fulfil request'><![CDATA[
  403. <iq type='error'
  404. from='pubsub.shakespeare.lit'
  405. to='francisco@denmark.lit/barracks'
  406. id='items1'>
  407. <error type='cancel'>
  408. <feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  409. </error>
  410. </iq>
  411. ]]></example>
  412. </section3>
  413. </section2>
  414. </section1>
  415. <section1 topic='Owner Use Cases' anchor='owner'>
  416. <section2 topic='Create a New Collection Node' anchor='createnode'>
  417. <p>To create a new collection node, the requesting entity MUST include a Data Form containing a "pubsub#node_type" field whose &lt;value/&gt; element contains "collection". The default value for "pubsub#node_type" SHOULD be "leaf".</p>
  418. <section3 topic='Request' anchor='createnode-request'>
  419. <example caption='Entity requests a new collection node'><![CDATA[
  420. <iq type='set'
  421. from='francisco@denmark.lit/barracks'
  422. to='pubsub.shakespeare.lit'
  423. id='create3'>
  424. <pubsub xmlns=''>
  425. <create node='announcements'/>
  426. <configure>
  427. <x xmlns='jabber:x:data' type='submit'>
  428. <field var='FORM_TYPE' type='hidden'>
  429. <value></value>
  430. </field>
  431. <field var='pubsub#node_type'><value>collection</value></field>
  432. </x>
  433. </configure>
  434. </pubsub>
  435. </iq>
  436. ]]></example>
  437. </section3>
  438. <section3 topic='Success Case' anchor='createnode-success'>
  439. <example caption='Service responds with success'><![CDATA[
  440. <iq type='result'
  441. from='pubsub.shakespeare.lit'
  442. to='francisco@denmark.lit/barracks'
  443. id='create3'/>
  444. ]]></example>
  445. </section3>
  446. <section3 topic='Error Cases' anchor='createnode-errors'>
  447. <p>In addition to the errors already defined for leaf node creation, there are several reasons why the collection node creation request might fail:</p>
  448. <ol>
  449. <li>The service does not support collection nodes.</li>
  450. <li>The service does not support creation of collection nodes.</li>
  451. <li>The requesting entity does not have sufficient privileges to create collection nodes.</li>
  452. </ol>
  453. <p>These error cases are described more fully in the following sections.</p>
  454. <section4 topic='Collection Nodes Unsupported' anchor='error-create-unsupported'>
  455. <p>If the service does not support collection nodes, it MUST respond with a &feature; error, specifying a pubsub-specific error condition of &lt;unsupported/&gt; and a feature of "collections".</p>
  456. <example caption='Service does not support collection nodes'><![CDATA[
  457. <iq type='error'
  458. from='pubsub.shakespeare.lit'
  459. to='francisco@denmark.lit/barracks'
  460. id='create3'>
  461. <error type='cancel'>
  462. <feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  463. <unsupported xmlns=''
  464. feature='collections'/>
  465. </error>
  466. </iq>
  467. ]]></example>
  468. </section4>
  469. <section4 topic='Collection Nodes Can&apos;t be Created' anchor='error-create-notallowed'>
  470. <p>If the service supports collection nodes but does not allow new collection nodes to be created, it MUST respond with a &notallowed; error.</p>
  471. <example caption='Service does not allow creation of collection nodes'><![CDATA[
  472. <iq type='error'
  473. from='hamlet@denmark.lit/elsinore'
  474. to='pubsub.shakespeare.lit'
  475. id='create3'>
  476. <error type='cancel'>
  477. <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  478. </error>
  479. </iq>
  480. ]]></example>
  481. </section4>
  482. <section4 topic='Entity is not Authorized' anchor='error-create-forbidden'>
  483. <p>If the requesting entity has insufficient privileges to create new collections, the service MUST respond with a &forbidden; error.</p>
  484. <example caption='Requesting entity has insufficient privileges to create collection nodes'><![CDATA[
  485. <iq type='error'
  486. from='pubsub.shakespeare.lit'
  487. to='francisco@denmark.lit/barracks'
  488. id='create3'>
  489. <error type='auth'>
  490. <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  491. </error>
  492. </iq>
  493. ]]></example>
  494. </section4>
  495. </section3>
  496. </section2>
  497. <section2 topic='Configuring a Collection Node' anchor='configure-collection'>
  498. <section3 topic='Request' anchor='configure-request'>
  499. <p>In addition to the node configuration options specified in <cite>XEP-0060</cite>, there are three additional node configuration options that a service which supports collection nodes MUST supply.</p>
  500. <ul>
  501. <li><strong>pubsub#node_type</strong>
  502. <p>Whether this is a "leaf" or "collection" node.</p></li>
  503. <li><strong>pubsub#collection</strong>
  504. <p>The parents of this node.</p></li>
  505. <li><strong>pubsub#children</strong>
  506. <p>The children of this node.</p></li>
  507. </ul>
  508. <p>To associate the root node to the collection the &lt;value/&gt; element MUST be empty.</p>
  509. <p>A service MAY offer some node configuration options that are specific to collection nodes and SHOULD NOT be provided in configuration forms related to leaf nodes. The following are RECOMMENDED:</p>
  510. <ul>
  511. <li><strong>pubsub#children_association_policy</strong>
  512. <p>The policy regarding who may associate child nodes with the collection (values: all, owner, whitelist).</p></li>
  513. <li><strong>pubsub#children_association_whitelist</strong>
  514. <p>The whitelist of entities that may associate child nodes with the collection.</p></li>
  515. <li><strong>pubsub#children_max</strong>
  516. <p>The maximum number of child nodes that may be associated with a collection.</p></li>
  517. </ul>
  518. <example caption='Entity configures a collection node'><![CDATA[
  519. <iq type='set'
  520. from='francisco@denmark.lit/barracks'
  521. to='pubsub.shakespeare.lit'
  522. id='config1'>
  523. <pubsub xmlns=''>
  524. <configure node='blogs'>
  525. <x xmlns='jabber:x:data' type='submit'>
  526. <field var='FORM_TYPE' type='hidden'>
  527. <value></value>
  528. </field>
  529. <field var='pubsub#node_type'>
  530. <value>collection</value>
  531. </field>
  532. <field var='pubsub#children'>
  533. <value>Romeoance</value>
  534. <value>Julliennui</value>
  535. </field>
  536. <field var='pubsub#collection'>
  537. <value/>
  538. </field>
  539. </x>
  540. </configure>
  541. </pubsub>
  542. </iq>
  543. ]]></example>
  544. </section3>
  545. <section3 topic='Success Case' anchor='configure-success'>
  546. <example caption='Service successfully updates configuration'><![CDATA[
  547. <iq type='result'
  548. from='pubsub.shakespeare.lit'
  549. to='francisco@denmark.lit/barracks'
  550. id='config1'/>
  551. ]]></example>
  552. </section3>
  553. <section3 topic='Error Cases' anchor='configure-errors'>
  554. <section4 topic='Configuring a Leaf Node with Children' anchor='error-children-on-leaf'>
  555. <p>Leaf nodes only contain published items and MUST NOT have any children. If an entity attempts to add children to a leaf node (either via "pubsub#children" on the leaf node or "pubsub#collection" on another node) the service MUST return a &notallowed; error with a pubsub-specific error condition of &lt;invalid-options/&gt;.</p>
  556. <example caption='Attempt to add a leaf node as the parent of another node'><![CDATA[
  557. <iq type='error'
  558. from='pubsub.shakespeare.lit'
  559. to='francisco@denmark.lit/barracks'
  560. id='config1'>
  561. <error type='cancel'>
  562. <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  563. <invalid-options xmlns=''/>
  564. </error>
  565. </iq>
  566. ]]></example>
  567. </section4>
  568. <section4 topic='Entity is not Authorized' anchor='error-config-not-authorized'>
  569. <p>If the requesting entity is not authorized to add the node to a collection then the service MUST return a &forbidden; error.</p>
  570. <example caption='Entity is not authorized to add node to a collection'><![CDATA[
  571. <iq type='error'
  572. from='pubsub.shakespeare.lit'
  573. to='francisco@denmark.lit/barracks'
  574. id='config1'>
  575. <error type='cancel'>
  576. <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  577. </error>
  578. </iq>
  579. ]]></example>
  580. </section4>
  581. <section4 topic='Maximum Number of Children Exceeded' anchor='error-max-children'>
  582. <p>If the configuration would exceed the maximum number of children allowed on a node, either because the node's "pubsub#children" exceeds it's own "pubsub#children_max" value or because adding this node to a parent via "pubsub#collection" would exceed the parent's "pubsub#children_max" value, the service MUST return a &notallowed; error with a pubsub-specific error condition of &lt;max-nodes-exceeded/&gt;.</p>
  583. <example caption='Node would contain too many children'><![CDATA[
  584. <iq type='error'
  585. from='pubsub.shakespeare.lit'
  586. to='francisco@denmark.lit/barracks'
  587. id='config1'>
  588. <error type='cancel'>
  589. <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  590. <max-nodes-exceeded xmlns=''/>
  591. </error>
  592. </iq>
  593. ]]></example>
  594. </section4>
  595. <section4 topic='Changing Node Types' anchor='error-node-type'>
  596. <p>The service MUST NOT allow the node type to be changed. If it is attempted the service MUST return a &notallowed; error, specifying a pubsub-specific error condition of &lt;invalid-options/&gt;</p>
  597. <example caption='Attempt to change node type'><![CDATA[
  598. <iq type='error'
  599. from='pubsub.shakespeare.lit'
  600. to='francisco@denmark.lit/barracks'
  601. id='config1'>
  602. <error type='cancel'>
  603. <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  604. <invalid-options xmlns=''/>
  605. </error>
  606. </iq>
  607. ]]></example>
  608. </section4>
  609. <section4 topic='Creating a Cycle in the Collection' anchor='error-collection-cycle'>
  610. <p>The service MUST NOT allow a cycle to be created in the node graph (<em>e.g.</em>, node A to B to C to A). If an entity attempts to submit a configuration that would create a cycle the service MUST return a &notallowed; error, specifying a pubsub-specific error condition of &lt;invalid-options/&gt;.</p>
  611. <example caption='Cycle created in node graph'><![CDATA[
  612. <iq type='error'
  613. from='pubsub.shakespeare.lit'
  614. to='francisco@denmark.lit/barracks'
  615. id='config1'>
  616. <error type='cancel'>
  617. <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  618. <invalid-options xmlns=''/>
  619. </error>
  620. </iq>
  621. ]]></example>
  622. </section4>
  623. </section3>
  624. </section2>
  625. <section2 topic='Deleting a Collection Node' anchor='delete-node'>
  626. <section3 topic='Request' anchor='delete-node-request'>
  627. <p>If a service supports collection node creation it MUST support collection node deletion.</p>
  628. <example caption='Owner attempts to delete a collection node'><![CDATA[
  629. <iq type='set'
  630. from='francisco@denmark.lit/barracks'
  631. to='pubsub.shakespeare.lit'
  632. id='delete1'>
  633. <pubsub xmlns=''>
  634. <delete node='blogs'/>
  635. </pubsub>
  636. </iq>
  637. ]]></example>
  638. </section3>
  639. <section3 topic='Success Case' anchor='delete-node-success'>
  640. <p>If no error occurs, the service MUST inform the owner of success.</p>
  641. <example caption='Collection node was deleted'><![CDATA[
  642. <iq type='result'
  643. from='pubsub.shakespeare.lit'
  644. to='francisco@denmark.lit/barracks'
  645. id='delete1'/>
  646. ]]></example>
  647. </section3>
  648. <section3 topic='Error Cases' anchor='delete-node-errors'>
  649. <section4 topic='Deleting the Root Node' anchor='delete-root-node'>
  650. <p>If the requesting entity attempts to delete the root node, the service MUST return a &notallowed; error.</p>
  651. <example caption='Node is the root'><![CDATA[
  652. <iq type='error'
  653. from='pubsub.shakespeare.lit'
  654. to='francisco@denmark.lit/barracks'
  655. id='delete1'>
  656. <error type='cancel'>
  657. <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  658. </error>
  659. </iq>
  660. ]]></example>
  661. </section4>
  662. </section3>
  663. </section2>
  664. <section2 topic='Associating a Node to a Collection' anchor='associate-node'>
  665. <section3 topic='Request' anchor='associate-request'>
  666. <p>A service MAY allow collection nodes to have children associated with them without changing the rest of the configuration. If the service allows this an entity can send and &lt;associate/&gt; element with a 'node' attribute that contains the child node within a &lt;collection/&gt; element that posesses a 'node' attribute containing the parent node to the service.</p>
  667. <example caption='Entity requests node association'><![CDATA[
  668. <iq type='set'
  669. from='francisco@denmark.lit/barracks'
  670. to='pubsub.shakespeare.lit'
  671. id='assoc1'>
  672. <pubsub xmlns=''>
  673. <collection node='some-collection'>
  674. <associate node='new-child-node'/>
  675. </collection>
  676. </pubsub>
  677. </iq>
  678. ]]></example>
  679. </section3>
  680. <section3 topic='Success Case' anchor='associate-success'>
  681. <p>If the service allows the node association then it MUST confirm the association with an empty result.</p>
  682. <example caption='Service associates the node'><![CDATA[
  683. <iq type='result'
  684. from='pubsub.shakespeare.lit'
  685. to='francisco@denmark.lit'
  686. id='assoc1'/>
  687. ]]></example>
  688. </section3>
  689. <section3 topic='Error Cases' anchor='associate-errors'>
  690. <section4 topic='Entity is not Authorized' anchor='error-assoc-auth'>
  691. <example caption='Entity is not authorized to associate the node'><![CDATA[
  692. <iq type='error'
  693. from='pubsub.shakespeare.lit'
  694. to='francisco@denmark.lit/barracks'
  695. id='assoc1'>
  696. <error type='cancel'>
  697. <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  698. </error>
  699. </iq>
  700. ]]></example>
  701. </section4>
  702. <section4 topic='Maximum Number of Children Exceeded' anchor='error-assoc-too-many-nodes'>
  703. <p>If the configuration would exceed the maximum number of children allowed on a node, either because the node's "pubsub#children" exceeds it's own "pubsub#children_max" value or because adding this node to a parent via "pubsub#collection" would exceed the parent's "pubsub#children_max" value, the service MUST return a &notallowed; error with a pubsub-specific error condition of &lt;max-nodes-exceeded/&gt;.</p>
  704. <example caption='Node would contain too many children'><![CDATA[
  705. <iq type='error'
  706. from='pubsub.shakespeare.lit'
  707. to='francisco@denmark.lit/barracks'
  708. id='assoc1'>
  709. <error type='cancel'>
  710. <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  711. <max-nodes-exceeded xmlns=''/>
  712. </error>
  713. </iq>
  714. ]]></example>
  715. </section4>
  716. <section4 topic='Creating a Cycle in the Collection' anchor='error-assoc-cycle'>
  717. <p>The service MUST NOT allow a cycle to be created in the node graph (<em>e.g</em>., node A to B to C to A). If an entity attempts to submit a configuration that would create a cycle the service MUST return a &notallowed; error, specifying a pubsub-specific error condition of &lt;invalid-options/&gt;.</p>
  718. <example caption='Cycle created in node graph'><![CDATA[
  719. <iq type='error'
  720. from='pubsub.shakespeare.lit'
  721. to='francisco@denmark.lit/barracks'
  722. id='assoc1'>
  723. <error type='cancel'>
  724. <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  725. <invalid-options xmlns=''/>
  726. </error>
  727. </iq>
  728. ]]></example>
  729. </section4>
  730. </section3>
  731. </section2>
  732. <section2 topic='Dissociating a Node from a Collection' anchor='associate-node'>
  733. <section3 topic='Request' anchor='dissociate-request'>
  734. <p>A service MAY allow collection nodes to have children dissociated from them without changing the rest of the configuration. If the service allows this an entity can send and &lt;dissociate/&gt; element with a 'node' attribute that contains the child node within a &lt;collection/&gt; element that posesses a 'node' attribute containing the parent node to the service.</p>
  735. <example caption='Entity requests node dissociation'><![CDATA[
  736. <iq type='set'
  737. from='francisco@denmark.lit/barracks'
  738. to='pubsub.shakespeare.lit'
  739. id='dissoc1'>
  740. <pubsub xmlns=''>
  741. <collection node='some-collection'>
  742. <dissociate node='old-child-node'/>
  743. </collection>
  744. </pubsub>
  745. </iq>
  746. ]]></example>
  747. </section3>
  748. <section3 topic='Success Case' anchor='dissociate-success'>
  749. <p>If the service allows the node dissociation then it MUST confirm the association with an empty result.</p>
  750. <example caption='Service dissociates the node'><![CDATA[
  751. <iq type='result'
  752. from='pubsub.shakespeare.lit'
  753. to='francisco@denmark.lit'
  754. id='dissoc1'/>
  755. ]]></example>
  756. </section3>
  757. <section3 topic='Error Cases' anchor='dissociate-errors'>
  758. <section4 topic='Node is not Associated' anchor='error-dissoc-not-assoc'>
  759. <p>If a dissociation is requested between two nodes that are not already associated then the service MUST return a &badrequest; error.</p>
  760. <example caption='Node is not associated'><![CDATA[
  761. <iq type='error'
  762. from='pubsub.shakespeare.lit'
  763. to='francisco@denmark.lit'
  764. id='dissoc1'>
  765. <error type='modify'>
  766. <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  767. </error>
  768. </iq>
  769. ]]></example>
  770. </section4>
  771. <section4 topic='Entity is not Authorized' anchor='error-dissoc-auth'>
  772. <example caption='Entity is not authorized to dissociate the node'><![CDATA[
  773. <iq type='error'
  774. from='pubsub.shakespeare.lit'
  775. to='francisco@denmark.lit/barracks'
  776. id='dissoc1'>
  777. <error type='cancel'>
  778. <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  779. </error>
  780. </iq>
  781. ]]></example>
  782. </section4>
  783. </section3>
  784. </section2>
  785. </section1>
  786. <section1 topic='Implementation Notes' anchor='impl-notes'>
  787. <section2 topic='Root Node' anchor='root'>
  788. <p>To provide a starting point for service discovery a service SHOULD support a root node. A root node represents the node belonging to a given service and MUST be identified by the lack of a node identifier (<em>i.e.</em>, the address of the pubsub service itself, such as "pubsub.shakespeare.lit"). Because the root node is owned by the service itself an entity SHOULD NOT be allowed create, delete, or configure the root node.</p>
  789. <p>If a node is created or configured without any parents specified, a service MAY automatically associate otherwise orphaned nodes directly to the root node. If a service automatically associates a node with the root it MUST reflect that in the node configuration data form.</p>
  790. <example caption='Entity subscribes to the root node'><![CDATA[
  791. <iq type='set'
  792. from='francisco@denmark.lit/barracks'
  793. to='pubsub.shakespeare.lit'
  794. id='root1'>
  795. <pubsub xmlns=''>
  796. <subscribe jid='francisco@denmark.lit'/>
  797. </pubsub>
  798. </iq>
  799. ]]></example>
  800. </section2>
  801. <section2 topic='Handling Collection Node Deletion' anchor='imple-delete'>
  802. <p>Deletion of collection nodes can have a number of side effects due to implementation. Depending on the nature of the collection any of the following MAY happen when a collection node is deleted:</p>
  803. <ul>
  804. <li>When the collection node is deleted and the child nodes have no other parents the child nodes are orphaned; meaning that they will have no parent node, but continue to exist.</li>
  805. <li>When the collection node is deleted and the child nodes have no other parents the child nodes are re-assigned as children of the root node.</li>
  806. <li>When the collection node is deleted and the child nodes have no other parents the child nodes are also deleted.</li>
  807. <li>When the collection node is deleted and the child nodes have at least one other node the child nodes MUST remain associated with remaining parent nodes.</li>
  808. </ul>
  809. </section2>
  810. <section2 topic='Updating Node Configuration When Associating or Dissociating Nodes' anchor='impl-config'>
  811. <p>Node configuration MUST always reflect the current state of the node graph. Because node configuration contains both a pointer to its parents as well as its children an update to a primary node's "pubsub#collection" value will change the value of the secondary node's "pubsub#children" value, and vice-versa. A service MAY send a notification of the configuration change on the secondary node to subscribers if "pubsub#notify_config" is enabled on the secondary node.</p>
  812. </section2>
  813. </section1>
  814. <section1 topic='Security Considerations' anchor='security'>
  815. <section2 topic='Access Models' anchor='security-access'>
  816. <p>Collection nodes can be used to associate almost any node within the service, but only the access model of the collection node itself is used to determine what an entity is allowed to see. Therefore care should be taken that nodes are not linked in such a way as to leak private data (e.g., from a "closed" leaf node through an "open" collection) unless that behavior is specifically desired.</p>
  817. </section2>
  818. </section1>
  819. <section1 topic='IANA Considerations' anchor='iana'>
  820. <p>This document requires no interaction with &IANA;.</p>
  821. </section1>
  822. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  823. <p class='em'>Note: These options are in addition to the standard options described in <cite>XEP-0060</cite> and related XEPs.</p>
  824. <section2 topic='Service Discovery Features' anchor='registrar-features'>
  825. <code><![CDATA[
  826. <var>
  827. <name>pubsub#collections</name>
  828. <desc>Support for collection nodes</desc>
  829. <doc>XEP-0248</doc>
  830. </var>
  831. <var>
  832. <name>pubsub#multi-collections</name>
  833. <desc>Support for multiple collections on a node</desc>
  834. <doc>XEP-0248</doc>
  835. </var>
  836. ]]></code>
  837. </section2>
  838. <section2 topic='Field Standardization' anchor='registrar-formtypes'>
  839. <code><![CDATA[
  840. <form_type>
  841. <name></name>
  842. <doc>XEP-0248</doc>
  843. <desc>Options for collection node subscription</desc>
  844. <field
  845. var='pubsub#subscription_depth'
  846. type='text-single'>
  847. label='How far to traverse the node graph for notifications'/>
  848. <field
  849. var='pubsub#subscription_type'
  850. type='list-single'>
  851. <option label='Receive notification of items only'>
  852. items
  853. </option>
  854. <option label='Receive notification of nodes only'>
  855. nodes
  856. </option>
  857. <option label='Receive notification of items and nodes'>
  858. all
  859. </option>
  860. </field>
  861. </form_type>
  862. <form_type>
  863. <name></name>
  864. <doc>XEP-0248</doc>
  865. <desc>Options for collection node configuration</desc>
  866. <field
  867. var='pubsub#node_type'
  868. type='list-single'>
  869. <option label='The node contains items'>
  870. leaf
  871. </option>
  872. <option label='The node contains other nodes'>
  873. collection
  874. </option>
  875. </field>
  876. <field
  877. var='pubsub#collection'
  878. type='text-multi'
  879. label='The collections of which this node is a child'/>
  880. <field
  881. var='pubsub#children'
  882. type='text-multi'
  883. label='The nodes of which this node is a parent'/>
  884. <field
  885. var='pubsub#children_association_policy'
  886. type='list-single'>
  887. <option label='Only the owners of this node may associate other nodes to this collection'>
  888. owners
  889. </option>
  890. <option label='Only those on the children association whitelist may associate other nodes to this collection'>
  891. whitelist
  892. </option>
  893. <option label='Anyone may associate nodes with this collection'>
  894. all
  895. </option>
  896. </field>
  897. <field
  898. var='pubsub#children_association_whitelist'
  899. type='jid-multi'
  900. label='JIDs who can associate nodes to this collection'/>
  901. <field
  902. var='pubsub#children_max'
  903. type='text-single'
  904. label='The maximum number of children for this collection'/>
  905. </form_type>
  906. ]]></code>
  907. </section2>
  908. <section2 topic='SHIM Headers' anchor='registrar-shim'>
  909. <code><![CDATA[
  910. <header>
  911. <name>Collection</name>
  912. <desc>The node of subscription that sent a notification</desc>
  913. <doc>XEP-0248</doc>
  914. </header>
  915. ]]></code>
  916. </section2>
  917. </section1>
  918. <section1 topic='XML Schema' anchor='schema'>
  919. <p>REQUIRED.</p>
  920. </section1>
  921. <section1 topic='Acknowledgements' anchor='acknowledgements'>
  922. <p>Many thanks to Dave Cridland for his feedback and advice.</p>
  923. </section1>
  924. </xep>