public final class PubSubNode extends Object
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 |
|---|---|
void |
configureNode(NodeConfiguration nodeConfiguration)
Configures the node by submitting the configuration form.
|
void |
configureSubscription(SubscribeOptions subscribeOptions)
Configures the subscription options for this node.
|
String |
create()
Creates the node on the remote pubsub service.
|
String |
create(NodeConfiguration nodeConfiguration)
Creates and configures this node on the remote pubsub service.
|
void |
delete()
Deletes this node on the pubsub service.
|
void |
delete(URI uri)
Deletes this node and specifies a replacement node.
|
List<Item> |
discoverItems()
Discovers the items for this node.
|
NodeMetaData |
discoverNodeMetaData()
Discovers the node info, which consists of a node name, type and meta data.
|
List<PubSubNode> |
discoverNodes()
Discovers the (sub-)nodes, which hierarchically reside under this node, e.g. the "second-level" nodes.
|
List<Affiliation> |
getAffiliations()
Gets the affiliations for this node.
|
SubscribeOptions |
getDefaultSubscriptionOptions()
Deprecated.
|
String |
getId()
Gets the node id.
|
List<Item> |
getItems()
Gets all items for this node.
|
List<Item> |
getItems(int maxItems)
Gets the most recent items.
|
List<Item> |
getItems(String... ids)
Gets one or more items with a given item id for a specific node.
|
NodeConfiguration |
getNodeConfiguration()
Gets the node configuration form.
|
List<PubSubNode> |
getNodes()
Deprecated.
Use
discoverNodes() |
SubscribeOptions |
getSubscriptionOptions()
Gets the subscription options for this node.
|
SubscribeOptions |
getSubscriptionOptions(boolean defaultOptions)
Gets the (default) subscription options for this node.
|
SubscribeOptions |
getSubscriptionOptions(String subId)
Gets the subscription options for this node.
|
List<Subscription> |
getSubscriptions()
Gets the subscriptions for this node.
|
NodeType |
getType()
Gets the type of this node.
|
String |
publish(Object item)
Publishes an item to this node.
|
String |
publish(Object item,
PublishOptions publishOptions)
Publishes an item to this node.
|
String |
publish(String id,
Object item)
Publishes an item to this node.
|
String |
publish(String id,
Object item,
PublishOptions publishOptions)
Publishes an item to this node.
|
void |
purge()
Purges this node of all published items.
|
void |
submitNodeConfiguration(DataForm dataForm)
|
void |
submitSubscriptionOptions(DataForm dataForm)
|
Subscription |
subscribe()
Subscribes to this node.
|
Subscription |
subscribe(SubscribeOptions subscribeOptions)
Subscribes to and configures this node.
|
String |
toString()
The node id.
|
void |
unsubscribe()
Unsubscribes from this node.
|
void |
unsubscribe(String subscriptionId)
Unsubscribes from this node.
|
public NodeMetaData discoverNodeMetaData() throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic List<Item> discoverItems() throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic List<Subscription> getSubscriptions() throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic List<Affiliation> getAffiliations() throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic Subscription subscribe() throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic Subscription subscribe(SubscribeOptions subscribeOptions) throws XmppException
subscribeOptions - The configuration form.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic void unsubscribe()
throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic void unsubscribe(String subscriptionId) throws XmppException
subscriptionId - The subscription id.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic SubscribeOptions getSubscriptionOptions(boolean defaultOptions) throws XmppException
defaultOptions - Whether to get the default options or not.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionconfigureSubscription(rocks.xmpp.extensions.pubsub.model.SubscribeOptions)public SubscribeOptions getSubscriptionOptions() throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionconfigureSubscription(rocks.xmpp.extensions.pubsub.model.SubscribeOptions)public SubscribeOptions getSubscriptionOptions(String subId) throws XmppException
subId - The subscription id.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionconfigureSubscription(rocks.xmpp.extensions.pubsub.model.SubscribeOptions)@Deprecated public void submitSubscriptionOptions(DataForm dataForm) throws XmppException
dataForm - The subscription options form.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic void configureSubscription(SubscribeOptions subscribeOptions) throws XmppException
subscribeOptions - The subscription options form.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppException@Deprecated public SubscribeOptions getDefaultSubscriptionOptions() throws XmppException
getSubscriptionOptions(boolean)StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic List<Item> getItems() throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic List<Item> getItems(String... ids) throws XmppException
ids - The item ids.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic List<Item> getItems(int maxItems) throws XmppException
maxItems - The maximal number of items.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic String publish(Object item) throws XmppException
item - The item to be published. Note that this item must be known to the CoreContext, so that it can be marshalled into XML.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic String publish(Object item, PublishOptions publishOptions) throws XmppException
item - The item to be published. Note that this item must be known to the CoreContext, so that it can be marshalled into XML.publishOptions - The optional publish options.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic String publish(String id, Object item) throws XmppException
id - The item's id.item - The item to be published. Note that this item must be known to the CoreContext, so that it can be marshalled into XML.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic String publish(String id, Object item, PublishOptions publishOptions) throws XmppException
id - The item's id.item - The item to be published. Note that this item must be known to the CoreContext, so that it can be marshalled into XML.publishOptions - The optional publish options.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic String create() throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic String create(NodeConfiguration nodeConfiguration) throws XmppException
nodeConfiguration - The configuration form.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic NodeConfiguration getNodeConfiguration() throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppException@Deprecated public void submitNodeConfiguration(DataForm dataForm) throws XmppException
dataForm - The configuration form.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic void configureNode(NodeConfiguration nodeConfiguration) throws XmppException
nodeConfiguration - The configuration form.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic void delete()
throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic void delete(URI uri) throws XmppException
uri - The replacement node.StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic void purge()
throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic List<PubSubNode> discoverNodes() throws XmppException
StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppException@Deprecated public List<PubSubNode> getNodes() throws XmppException
discoverNodes()StanzaException - If the entity returned a stanza error.NoResponseException - If the entity did not respond.XmppExceptionpublic String getId()
public NodeType getType()
Copyright © 2014–2015 XMPP.rocks. All rights reserved.