Package rocks.xmpp.extensions.pubsub
Class PubSubNode
- java.lang.Object
-
- rocks.xmpp.extensions.pubsub.PubSubNode
-
public final class PubSubNode extends Object
This class represents a single pubsub node.It allows you to create the node on the pubsub service, subscribe or unsubscribe from the node, retrieve items from it, publish items to it, etc.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AsyncResult<IQ>
configureNode(NodeConfiguration nodeConfiguration)
Configures the node by submitting the configuration form.AsyncResult<IQ>
configureSubscription(SubscribeOptions subscribeOptions)
Configures the subscription options for this node.AsyncResult<String>
create()
Creates the node on the remote pubsub service.AsyncResult<String>
create(NodeConfiguration nodeConfiguration)
Creates and configures this node on the remote pubsub service.AsyncResult<IQ>
delete()
Deletes this node on the pubsub service.AsyncResult<IQ>
delete(URI uri)
Deletes this node and specifies a replacement node.AsyncResult<IQ>
deleteItem(String id, boolean notify)
Deletes an item from this node.AsyncResult<List<Item>>
discoverItems()
Discovers the items for this node.AsyncResult<NodeMetaData>
discoverNodeMetaData()
Discovers the node info, which consists of a node name, type and meta data.AsyncResult<List<PubSubNode>>
discoverNodes()
Discovers the (sub-)nodes, which hierarchically reside under this node, e.g. the "second-level" nodes.AsyncResult<List<Affiliation>>
getAffiliations()
Gets the affiliations for this node.String
getId()
Gets the node id.AsyncResult<List<Item>>
getItems()
Gets all items for this node.AsyncResult<List<Item>>
getItems(int maxItems)
Gets the most recent items.AsyncResult<List<Item>>
getItems(String... ids)
Gets one or more items with a given item id for a specific node.AsyncResult<NodeConfiguration>
getNodeConfiguration()
Gets the node configuration form.AsyncResult<SubscribeOptions>
getSubscriptionOptions()
Gets the subscription options for this node.AsyncResult<SubscribeOptions>
getSubscriptionOptions(boolean defaultOptions)
Gets the (default) subscription options for this node.AsyncResult<SubscribeOptions>
getSubscriptionOptions(String subId)
Gets the subscription options for this node.AsyncResult<List<Subscription>>
getSubscriptions()
Gets the subscriptions for this node.NodeType
getType()
Gets the type of this node.AsyncResult<String>
publish(Object item)
Publishes an item to this node.AsyncResult<String>
publish(Object item, PublishOptions publishOptions)
Publishes an item to this node.AsyncResult<String>
publish(String id, Object item)
Publishes an item to this node.AsyncResult<String>
publish(String id, Object item, PublishOptions publishOptions)
Publishes an item to this node.AsyncResult<IQ>
purge()
Purges this node of all published items.AsyncResult<Subscription>
subscribe()
Subscribes to this node.AsyncResult<Subscription>
subscribe(Jid jid)
Subscribes to this node.AsyncResult<Subscription>
subscribe(Jid jid, SubscribeOptions subscribeOptions)
Subscribes to and configures this node.AsyncResult<Subscription>
subscribe(SubscribeOptions subscribeOptions)
Subscribes to and configures this node.String
toString()
The node id.void
unsubscribe()
Unsubscribes from this node.AsyncResult<IQ>
unsubscribe(String subscriptionId)
Unsubscribes from this node.
-
-
-
Method Detail
-
discoverNodeMetaData
public AsyncResult<NodeMetaData> discoverNodeMetaData()
Discovers the node info, which consists of a node name, type and meta data.- Returns:
- The async result with the node info.
- See Also:
- 5.3 Discover Node Information, 5.4 Discover Node Metadata
-
discoverItems
public AsyncResult<List<Item>> discoverItems()
Discovers the items for this node.- Returns:
- The async result with the items.
- See Also:
- 5.5 Discover Items for a Node
-
getSubscriptions
public AsyncResult<List<Subscription>> getSubscriptions()
Gets the subscriptions for this node.- Returns:
- The async result with the subscriptions for the node.
- See Also:
- 5.6 Retrieve Subscriptions
-
getAffiliations
public AsyncResult<List<Affiliation>> getAffiliations()
Gets the affiliations for this node.- Returns:
- The async result with the affiliations for all nodes.
- See Also:
- 5.7 Retrieve Affiliations
-
subscribe
public AsyncResult<Subscription> subscribe()
Subscribes to this node.- Returns:
- The async result with the subscription.
- See Also:
- 6.1 Subscribe to a Node
-
subscribe
public AsyncResult<Subscription> subscribe(SubscribeOptions subscribeOptions)
Subscribes to and configures this node.- Parameters:
subscribeOptions
- The configuration form.- Returns:
- The async result with the subscription.
- See Also:
- 6.3.7 Subscribe and Configure
-
subscribe
public final AsyncResult<Subscription> subscribe(Jid jid)
Subscribes to this node.- Parameters:
jid
- The JID which is subscribed.- Returns:
- The async result with the subscription.
- See Also:
- 6.1 Subscribe to a Node
-
subscribe
public final AsyncResult<Subscription> subscribe(Jid jid, SubscribeOptions subscribeOptions)
Subscribes to and configures this node.- Parameters:
jid
- The JID which is subscribed.subscribeOptions
- The configuration form.- Returns:
- The async result with the subscription.
- See Also:
- 6.3.7 Subscribe and Configure
-
unsubscribe
public void unsubscribe()
Unsubscribes from this node.- See Also:
- 6.2 Unsubscribe from a Node
-
unsubscribe
public AsyncResult<IQ> unsubscribe(String subscriptionId)
Unsubscribes from this node.- Parameters:
subscriptionId
- The subscription id.- Returns:
- The async result.
- See Also:
- 6.2 Unsubscribe from a Node
-
getSubscriptionOptions
public AsyncResult<SubscribeOptions> getSubscriptionOptions(boolean defaultOptions)
Gets the (default) subscription options for this node.- Parameters:
defaultOptions
- Whether to get the default options or not.- Returns:
- The async result with the data form.
- See Also:
- 6.3.2 Request,
6.4 Request Default
Subscription Configuration Options,
configureSubscription(rocks.xmpp.extensions.pubsub.model.SubscribeOptions)
-
getSubscriptionOptions
public AsyncResult<SubscribeOptions> getSubscriptionOptions()
Gets the subscription options for this node.- Returns:
- The async result with the data form.
- See Also:
- 6.3.2 Request,
configureSubscription(rocks.xmpp.extensions.pubsub.model.SubscribeOptions)
-
getSubscriptionOptions
public AsyncResult<SubscribeOptions> getSubscriptionOptions(String subId)
Gets the subscription options for this node.- Parameters:
subId
- The subscription id.- Returns:
- The async result with the data form.
- See Also:
- 6.3.2 Request,
configureSubscription(rocks.xmpp.extensions.pubsub.model.SubscribeOptions)
-
configureSubscription
public AsyncResult<IQ> configureSubscription(SubscribeOptions subscribeOptions)
Configures the subscription options for this node.- Parameters:
subscribeOptions
- The subscription options form.- Returns:
- The async result.
- See Also:
- 6.3.5 Form Submission
-
getItems
public AsyncResult<List<Item>> getItems()
Gets all items for this node.- Returns:
- The async result with the items.
- See Also:
- 6.5.2 Requesting All Items
-
getItems
public AsyncResult<List<Item>> getItems(String... ids)
Gets one or more items with a given item id for a specific node.- Parameters:
ids
- The item ids.- Returns:
- The async result with the items.
- See Also:
- 6.5.6 Returning Notifications Only, 6.5.8 Requesting a Particular Item
-
getItems
public AsyncResult<List<Item>> getItems(int maxItems)
Gets the most recent items.- Parameters:
maxItems
- The maximal number of items.- Returns:
- The async result with the items.
- See Also:
- 6.5.7 Requesting the Most Recent Items
-
publish
public AsyncResult<String> publish(Object item)
Publishes an item to this node.- Parameters:
item
- The item to be published. Note that this item must be known to the session, so that it can be marshalled into XML.- Returns:
- The async result with the item id, generated by the pubsub service.
- See Also:
- 7.1 Publish an Item to a Node,
XmppSessionConfiguration.Builder.extensions(Extension...)
-
publish
public AsyncResult<String> publish(Object item, PublishOptions publishOptions)
Publishes an item to this node.- Parameters:
item
- The item to be published. Note that this item must be known to the session, so that it can be marshalled into XML.publishOptions
- The optional publish options.- Returns:
- The async result with the item id, generated by the pubsub service.
- See Also:
- 7.1 Publish an Item to a Node,
XmppSessionConfiguration.Builder.extensions(Extension...)
-
publish
public AsyncResult<String> publish(String id, Object item)
Publishes an item to this node.- Parameters:
id
- The item's id.item
- The item to be published. Note that this item must be known to the session, so that it can be marshalled into XML.- Returns:
- The async result with the item id.
- See Also:
- 7.1 Publish an Item to a Node,
XmppSessionConfiguration.Builder.extensions(Extension...)
-
publish
public AsyncResult<String> publish(String id, Object item, PublishOptions publishOptions)
Publishes an item to this node.- Parameters:
id
- The item's id.item
- The item to be published. Note that this item must be known to the session, so that it can be marshalled into XML.publishOptions
- The optional publish options.- Returns:
- The async result with the item id.
- See Also:
- 7.1.5 Publishing Options,
XmppSessionConfiguration.Builder.extensions(Extension...)
-
deleteItem
public AsyncResult<IQ> deleteItem(String id, boolean notify)
Deletes an item from this node.- Parameters:
id
- The item id.notify
- If the pubsub service shall notify the subscribers about the deletion.- Returns:
- The async result.
- See Also:
- 7.2 Delete an Item from a Node
-
create
public AsyncResult<String> create()
Creates the node on the remote pubsub service.- Returns:
- The async result with the node id, if it wasn't already set.
- See Also:
- 8.1 Create a Node
-
create
public AsyncResult<String> create(NodeConfiguration nodeConfiguration)
Creates and configures this node on the remote pubsub service.- Parameters:
nodeConfiguration
- The configuration form.- Returns:
- The async result with the node id.
- See Also:
- 8.1.3 Create and Configure a Node
-
getNodeConfiguration
public AsyncResult<NodeConfiguration> getNodeConfiguration()
Gets the node configuration form.- Returns:
- The async result with the configuration form.
- See Also:
- 8.2.1 Request
-
configureNode
public AsyncResult<IQ> configureNode(NodeConfiguration nodeConfiguration)
Configures the node by submitting the configuration form.- Parameters:
nodeConfiguration
- The configuration form.- Returns:
- The async result.
- See Also:
- 8.2.4 Form Submission
-
delete
public AsyncResult<IQ> delete()
Deletes this node on the pubsub service.- Returns:
- The async result.
- See Also:
- 8.4 Delete a Node
-
delete
public AsyncResult<IQ> delete(URI uri)
Deletes this node and specifies a replacement node.- Parameters:
uri
- The replacement node.- Returns:
- The async result.
- See Also:
- 8.4 Delete a Node
-
purge
public AsyncResult<IQ> purge()
Purges this node of all published items.- Returns:
- The async result.
- See Also:
- 8.5 Purge All Node Items
-
discoverNodes
public AsyncResult<List<PubSubNode>> discoverNodes()
Discovers the (sub-)nodes, which hierarchically reside under this node, e.g. the "second-level" nodes.- Returns:
- The async result with the discovered pubsub nodes.
- See Also:
- 5.2 Discover Nodes
-
getId
public String getId()
Gets the node id.- Returns:
- The node id.
-
getType
public NodeType getType()
Gets the type of this node.- Returns:
- The type.
-
-