public final class PubSubNode
extends java.lang.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.
Modifier and Type | Method and 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<java.lang.String> |
create()
Creates the node on the remote pubsub service.
|
AsyncResult<java.lang.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(java.net.URI uri)
Deletes this node and specifies a replacement node.
|
AsyncResult<IQ> |
deleteItem(java.lang.String id,
boolean notify)
Deletes an item from this node.
|
AsyncResult<java.util.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<java.util.List<PubSubNode>> |
discoverNodes()
Discovers the (sub-)nodes, which hierarchically reside under this node, e.g. the “second-level” nodes.
|
AsyncResult<java.util.List<Affiliation>> |
getAffiliations()
Gets the affiliations for this node.
|
java.lang.String |
getId()
Gets the node id.
|
AsyncResult<java.util.List<Item>> |
getItems()
Gets all items for this node.
|
AsyncResult<java.util.List<Item>> |
getItems(int maxItems)
Gets the most recent items.
|
AsyncResult<java.util.List<Item>> |
getItems(java.lang.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(java.lang.String subId)
Gets the subscription options for this node.
|
AsyncResult<java.util.List<Subscription>> |
getSubscriptions()
Gets the subscriptions for this node.
|
NodeType |
getType()
Gets the type of this node.
|
AsyncResult<java.lang.String> |
publish(java.lang.Object item)
Publishes an item to this node.
|
AsyncResult<java.lang.String> |
publish(java.lang.Object item,
PublishOptions publishOptions)
Publishes an item to this node.
|
AsyncResult<java.lang.String> |
publish(java.lang.String id,
java.lang.Object item)
Publishes an item to this node.
|
AsyncResult<java.lang.String> |
publish(java.lang.String id,
java.lang.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.
|
java.lang.String |
toString()
The node id.
|
void |
unsubscribe()
Unsubscribes from this node.
|
AsyncResult<IQ> |
unsubscribe(java.lang.String subscriptionId)
Unsubscribes from this node.
|
public AsyncResult<NodeMetaData> discoverNodeMetaData()
Discovers the node info, which consists of a node name, type and meta data.
public AsyncResult<java.util.List<Item>> discoverItems()
Discovers the items for this node.
public AsyncResult<java.util.List<Subscription>> getSubscriptions()
Gets the subscriptions for this node.
public AsyncResult<java.util.List<Affiliation>> getAffiliations()
Gets the affiliations for this node.
public AsyncResult<Subscription> subscribe()
Subscribes to this node.
public AsyncResult<Subscription> subscribe(SubscribeOptions subscribeOptions)
Subscribes to and configures this node.
subscribeOptions
- The configuration form.public final AsyncResult<Subscription> subscribe(Jid jid)
Subscribes to this node.
jid
- The JID which is subscribed.public final AsyncResult<Subscription> subscribe(Jid jid, SubscribeOptions subscribeOptions)
Subscribes to and configures this node.
jid
- The JID which is subscribed.subscribeOptions
- The configuration form.public void unsubscribe()
Unsubscribes from this node.
public AsyncResult<IQ> unsubscribe(java.lang.String subscriptionId)
Unsubscribes from this node.
subscriptionId
- The subscription id.public AsyncResult<SubscribeOptions> getSubscriptionOptions(boolean defaultOptions)
Gets the (default) subscription options for this node.
defaultOptions
- Whether to get the default options or not.configureSubscription(rocks.xmpp.extensions.pubsub.model.SubscribeOptions)
public AsyncResult<SubscribeOptions> getSubscriptionOptions()
Gets the subscription options for this node.
configureSubscription(rocks.xmpp.extensions.pubsub.model.SubscribeOptions)
public AsyncResult<SubscribeOptions> getSubscriptionOptions(java.lang.String subId)
Gets the subscription options for this node.
subId
- The subscription id.configureSubscription(rocks.xmpp.extensions.pubsub.model.SubscribeOptions)
public AsyncResult<IQ> configureSubscription(SubscribeOptions subscribeOptions)
Configures the subscription options for this node.
subscribeOptions
- The subscription options form.public AsyncResult<java.util.List<Item>> getItems()
Gets all items for this node.
public AsyncResult<java.util.List<Item>> getItems(java.lang.String... ids)
Gets one or more items with a given item id for a specific node.
ids
- The item ids.public AsyncResult<java.util.List<Item>> getItems(int maxItems)
Gets the most recent items.
maxItems
- The maximal number of items.public AsyncResult<java.lang.String> publish(java.lang.Object item)
Publishes an item to this node.
item
- The item to be published. Note that this item must be known to the session, so that it can be marshalled into XML.XmppSessionConfiguration.Builder.extensions(Extension...)
public AsyncResult<java.lang.String> publish(java.lang.Object item, PublishOptions publishOptions)
Publishes an item to this node.
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.XmppSessionConfiguration.Builder.extensions(Extension...)
public AsyncResult<java.lang.String> publish(java.lang.String id, java.lang.Object item)
Publishes an item to this node.
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.XmppSessionConfiguration.Builder.extensions(Extension...)
public AsyncResult<java.lang.String> publish(java.lang.String id, java.lang.Object item, PublishOptions publishOptions)
Publishes an item to this node.
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.XmppSessionConfiguration.Builder.extensions(Extension...)
public AsyncResult<IQ> deleteItem(java.lang.String id, boolean notify)
Deletes an item from this node.
id
- The item id.notify
- If the pubsub service shall notify the subscribers about the deletion.public AsyncResult<java.lang.String> create()
Creates the node on the remote pubsub service.
public AsyncResult<java.lang.String> create(NodeConfiguration nodeConfiguration)
Creates and configures this node on the remote pubsub service.
nodeConfiguration
- The configuration form.public AsyncResult<NodeConfiguration> getNodeConfiguration()
Gets the node configuration form.
public AsyncResult<IQ> configureNode(NodeConfiguration nodeConfiguration)
Configures the node by submitting the configuration form.
nodeConfiguration
- The configuration form.public AsyncResult<IQ> delete()
Deletes this node on the pubsub service.
public AsyncResult<IQ> delete(java.net.URI uri)
Deletes this node and specifies a replacement node.
uri
- The replacement node.public AsyncResult<IQ> purge()
Purges this node of all published items.
public AsyncResult<java.util.List<PubSubNode>> discoverNodes()
Discovers the (sub-)nodes, which hierarchically reside under this node, e.g. the “second-level” nodes.
public java.lang.String getId()
Gets the node id.
public NodeType getType()
Gets the type of this node.
public java.lang.String toString()
The node id.
toString
in class java.lang.Object
Copyright © 2014–2019 XMPP.rocks. All rights reserved.