public abstract class Node
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Node.ItemDeleteTranslator
This class translates low level item deletion events into api level objects for
user consumption.
|
static class |
Node.ItemEventTranslator
This class translates low level item publication events into api level objects for
user consumption.
|
static class |
Node.NodeConfigTranslator
This class translates low level node configuration events into api level objects for
user consumption.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.concurrent.ConcurrentHashMap<NodeConfigListener,org.jivesoftware.smack.StanzaListener> |
configEventToListenerMap |
protected java.lang.String |
id |
protected java.util.concurrent.ConcurrentHashMap<ItemDeleteListener,org.jivesoftware.smack.StanzaListener> |
itemDeleteToListenerMap |
protected java.util.concurrent.ConcurrentHashMap<ItemEventListener<Item>,org.jivesoftware.smack.StanzaListener> |
itemEventToListenerMap |
protected PubSubManager |
pubSubManager |
Modifier and Type | Method and Description |
---|---|
void |
addConfigurationListener(NodeConfigListener listener)
Register a listener for configuration events.
|
void |
addItemDeleteListener(ItemDeleteListener listener)
Register an listener for item delete events.
|
void |
addItemEventListener(ItemEventListener listener)
Register a listener for item publication events.
|
protected PubSub |
createPubsubPacket(org.jivesoftware.smack.packet.IQ.Type type,
NodeExtension ext) |
DiscoverInfo |
discoverInfo()
Discover node information in standard
DiscoverInfo format. |
java.util.List<Affiliation> |
getAffiliations()
Get the affiliations of this node.
|
java.util.List<Affiliation> |
getAffiliations(java.util.List<org.jivesoftware.smack.packet.ExtensionElement> additionalExtensions,
java.util.Collection<org.jivesoftware.smack.packet.ExtensionElement> returnedExtensions)
Get the affiliations of this node.
|
java.util.List<Affiliation> |
getAffiliationsAsOwner()
Retrieve the affiliation list for this node as owner.
|
java.util.List<Affiliation> |
getAffiliationsAsOwner(java.util.List<org.jivesoftware.smack.packet.ExtensionElement> additionalExtensions,
java.util.Collection<org.jivesoftware.smack.packet.ExtensionElement> returnedExtensions)
Retrieve the affiliation list for this node as owner.
|
java.lang.String |
getId()
Get the NodeId.
|
ConfigureForm |
getNodeConfiguration()
Returns a configuration form, from which you can create an answer form to be submitted
via the
sendConfigurationForm(Form) . |
SubscribeForm |
getSubscriptionOptions(java.lang.String jid)
Returns a SubscribeForm for subscriptions, from which you can create an answer form to be submitted
via the
sendConfigurationForm(Form) . |
SubscribeForm |
getSubscriptionOptions(java.lang.String jid,
java.lang.String subscriptionId)
Get the options for configuring the specified subscription.
|
java.util.List<Subscription> |
getSubscriptions()
Get the subscriptions currently associated with this node.
|
java.util.List<Subscription> |
getSubscriptions(java.util.List<org.jivesoftware.smack.packet.ExtensionElement> additionalExtensions,
java.util.Collection<org.jivesoftware.smack.packet.ExtensionElement> returnedExtensions)
Get the subscriptions currently associated with this node.
|
java.util.List<Subscription> |
getSubscriptionsAsOwner()
Get the subscriptions currently associated with this node as owner.
|
java.util.List<Subscription> |
getSubscriptionsAsOwner(java.util.List<org.jivesoftware.smack.packet.ExtensionElement> additionalExtensions,
java.util.Collection<org.jivesoftware.smack.packet.ExtensionElement> returnedExtensions)
Get the subscriptions currently associated with this node as owner.
|
PubSub |
modifyAffiliationAsOwner(java.util.List<Affiliation> affiliations)
Modify the affiliations for this PubSub node as owner.
|
PubSub |
modifySubscriptionsAsOwner(java.util.List<Subscription> changedSubs)
Modify the subscriptions for this PubSub node as owner.
|
void |
removeConfigurationListener(NodeConfigListener listener)
Unregister a listener for configuration events.
|
void |
removeItemDeleteListener(ItemDeleteListener listener)
Unregister a listener for item delete events.
|
void |
removeItemEventListener(ItemEventListener listener)
Unregister a listener for publication events.
|
void |
sendConfigurationForm(Form submitForm)
Update the configuration with the contents of the new
Form . |
protected PubSub |
sendPubsubPacket(PubSub packet) |
Subscription |
subscribe(org.jxmpp.jid.Jid jid)
The user subscribes to the node using the supplied jid.
|
Subscription |
subscribe(org.jxmpp.jid.Jid jid,
SubscribeForm subForm)
The user subscribes to the node using the supplied jid and subscription
options.
|
Subscription |
subscribe(java.lang.String jidString)
Deprecated.
use
subscribe(Jid) instead. |
Subscription |
subscribe(java.lang.String jidString,
SubscribeForm subForm)
Deprecated.
use
subscribe(Jid, SubscribeForm) instead. |
java.lang.String |
toString() |
void |
unsubscribe(java.lang.String jid)
Remove the subscription related to the specified JID.
|
void |
unsubscribe(java.lang.String jid,
java.lang.String subscriptionId)
Remove the specific subscription related to the specified JID.
|
protected final PubSubManager pubSubManager
protected final java.lang.String id
protected java.util.concurrent.ConcurrentHashMap<ItemEventListener<Item>,org.jivesoftware.smack.StanzaListener> itemEventToListenerMap
protected java.util.concurrent.ConcurrentHashMap<ItemDeleteListener,org.jivesoftware.smack.StanzaListener> itemDeleteToListenerMap
protected java.util.concurrent.ConcurrentHashMap<NodeConfigListener,org.jivesoftware.smack.StanzaListener> configEventToListenerMap
public java.lang.String getId()
public ConfigureForm getNodeConfiguration() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
sendConfigurationForm(Form)
.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public void sendConfigurationForm(Form submitForm) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Form
.submitForm
- TODO javadoc me pleaseorg.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public DiscoverInfo discoverInfo() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
DiscoverInfo
format.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the server.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.List<Subscription> getSubscriptions() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Subscription
org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.List<Subscription> getSubscriptions(java.util.List<org.jivesoftware.smack.packet.ExtensionElement> additionalExtensions, java.util.Collection<org.jivesoftware.smack.packet.ExtensionElement> returnedExtensions) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
additionalExtensions
can be used e.g. to add a "Result Set Management" extension.
returnedExtensions
will be filled with the stanza extensions found in the answer.
additionalExtensions
- TODO javadoc me pleasereturnedExtensions
- a collection that will be filled with the returned packet
extensionsSubscription
org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.List<Subscription> getSubscriptionsAsOwner() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Subscription
org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.getSubscriptionsAsOwner(List, Collection)
public java.util.List<Subscription> getSubscriptionsAsOwner(java.util.List<org.jivesoftware.smack.packet.ExtensionElement> additionalExtensions, java.util.Collection<org.jivesoftware.smack.packet.ExtensionElement> returnedExtensions) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Unlike getSubscriptions(List, Collection)
, which only retrieves the subscriptions of the current entity
("user"), this method returns a list of all subscriptions. This requires the entity to have the sufficient
privileges to manage subscriptions.
additionalExtensions
can be used e.g. to add a "Result Set Management" extension.
returnedExtensions
will be filled with the stanza extensions found in the answer.
additionalExtensions
- TODO javadoc me pleasereturnedExtensions
- a collection that will be filled with the returned stanza extensionsSubscription
org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public PubSub modifySubscriptionsAsOwner(java.util.List<Subscription> changedSubs) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Note that the subscriptions are _not_ checked against the existing subscriptions since these are not cached (and indeed could change asynchronously)
changedSubs
- subscriptions that have changednull
or a PubSub stanza with additional information on success.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.List<Affiliation> getAffiliations() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Affiliation
org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.List<Affiliation> getAffiliations(java.util.List<org.jivesoftware.smack.packet.ExtensionElement> additionalExtensions, java.util.Collection<org.jivesoftware.smack.packet.ExtensionElement> returnedExtensions) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
additionalExtensions
can be used e.g. to add a "Result Set Management" extension.
returnedExtensions
will be filled with the stanza extensions found in the answer.
additionalExtensions
- additional PacketExtensions
add to the requestreturnedExtensions
- a collection that will be filled with the returned packet
extensionsAffiliation
org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public java.util.List<Affiliation> getAffiliationsAsOwner() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.getAffiliations(List, Collection)
public java.util.List<Affiliation> getAffiliationsAsOwner(java.util.List<org.jivesoftware.smack.packet.ExtensionElement> additionalExtensions, java.util.Collection<org.jivesoftware.smack.packet.ExtensionElement> returnedExtensions) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Note that this is an optional PubSub feature ('pubsub#modify-affiliations').
additionalExtensions
- optional additional extension elements add to the request.returnedExtensions
- an optional collection that will be filled with the returned
extension elements.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public PubSub modifyAffiliationAsOwner(java.util.List<Affiliation> affiliations) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Affiliation
s given must be created with the
Affiliation.Affiliation(org.jxmpp.jid.BareJid, Affiliation.Type)
constructor.
Note that this is an optional PubSub feature ('pubsub#modify-affiliations').
affiliations
- TODO javadoc me pleasenull
or a PubSub stanza with additional information on success.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public Subscription subscribe(org.jxmpp.jid.Jid jid) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Subscription.State
should be checked
on return since more actions may be required by the caller.
Subscription.State.pending
- The owner must approve the subscription
request before messages will be received.
Subscription.State.unconfigured
- If the Subscription.isConfigRequired()
is true,
the caller must configure the subscription before messages will be received. If it is false
the caller can configure it but is not required to do so.jid
- The jid to subscribe as.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.@Deprecated public Subscription subscribe(java.lang.String jidString) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
subscribe(Jid)
instead.Subscription.State
should be checked
on return since more actions may be required by the caller.
Subscription.State.pending
- The owner must approve the subscription
request before messages will be received.
Subscription.State.unconfigured
- If the Subscription.isConfigRequired()
is true,
the caller must configure the subscription before messages will be received. If it is false
the caller can configure it but is not required to do so.jidString
- The jid to subscribe as.org.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.java.lang.IllegalArgumentException
- if the provided string is not a valid JID.public Subscription subscribe(org.jxmpp.jid.Jid jid, SubscribeForm subForm) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
Subscription.State
should be checked
on return since more actions may be required by the caller.
Subscription.State.pending
- The owner must approve the subscription
request before messages will be received.
Subscription.State.unconfigured
- If the Subscription.isConfigRequired()
is true,
the caller must configure the subscription before messages will be received. If it is false
the caller can configure it but is not required to do so.jid
- The jid to subscribe as.subForm
- TODO javadoc me pleaseorg.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.@Deprecated public Subscription subscribe(java.lang.String jidString, SubscribeForm subForm) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
subscribe(Jid, SubscribeForm)
instead.Subscription.State
should be checked
on return since more actions may be required by the caller.
Subscription.State.pending
- The owner must approve the subscription
request before messages will be received.
Subscription.State.unconfigured
- If the Subscription.isConfigRequired()
is true,
the caller must configure the subscription before messages will be received. If it is false
the caller can configure it but is not required to do so.jidString
- The jid to subscribe as.subForm
- TODO javadoc me pleaseorg.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.java.lang.IllegalArgumentException
- if the provided string is not a valid JID.public void unsubscribe(java.lang.String jid) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
unsubscribe(String, String)
.jid
- The JID used to subscribe to the nodeorg.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public void unsubscribe(java.lang.String jid, java.lang.String subscriptionId) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
jid
- The JID used to subscribe to the nodesubscriptionId
- The id of the subscription being removedorg.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public SubscribeForm getSubscriptionOptions(java.lang.String jid) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
sendConfigurationForm(Form)
.jid
- TODO javadoc me pleaseorg.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public SubscribeForm getSubscriptionOptions(java.lang.String jid, java.lang.String subscriptionId) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
jid
- JID the subscription is registered undersubscriptionId
- The subscription idorg.jivesoftware.smack.XMPPException.XMPPErrorException
- if there was an XMPP error returned.org.jivesoftware.smack.SmackException.NoResponseException
- if there was no response from the remote entity.org.jivesoftware.smack.SmackException.NotConnectedException
- if the XMPP connection is not connected.java.lang.InterruptedException
- if the calling thread was interrupted.public void addItemEventListener(ItemEventListener listener)
listener
- The handler for the eventpublic void removeItemEventListener(ItemEventListener listener)
listener
- The handler to unregisterpublic void addConfigurationListener(NodeConfigListener listener)
listener
- The handler for the eventpublic void removeConfigurationListener(NodeConfigListener listener)
listener
- The handler to unregisterpublic void addItemDeleteListener(ItemDeleteListener listener)
listener
- The handler for the eventpublic void removeItemDeleteListener(ItemDeleteListener listener)
listener
- The handler to unregisterpublic java.lang.String toString()
toString
in class java.lang.Object
protected PubSub createPubsubPacket(org.jivesoftware.smack.packet.IQ.Type type, NodeExtension ext)
protected PubSub sendPubsubPacket(PubSub packet) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, java.lang.InterruptedException
org.jivesoftware.smack.SmackException.NoResponseException
org.jivesoftware.smack.XMPPException.XMPPErrorException
org.jivesoftware.smack.SmackException.NotConnectedException
java.lang.InterruptedException