Class Node

java.lang.Object
org.jivesoftware.smackx.pubsub.Node
Direct Known Subclasses:
CollectionNode, LeafNode

public abstract class Node extends Object
  • Field Details

  • Method Details

    • getId

      public String getId()
      Get the NodeId.
      Returns:
      the node id
    • getNodeConfiguration

      public ConfigureForm getNodeConfiguration() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Returns a configuration form, from which you can create an answer form to be submitted via the sendConfigurationForm(FillableConfigureForm).
      Returns:
      the configuration form
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • sendConfigurationForm

      public void sendConfigurationForm(FillableConfigureForm configureForm) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Update the configuration with the contents of the new FillableConfigureForm.
      Parameters:
      configureForm - the filled node configuration form with the nodes new configuration.
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • discoverInfo

      public DiscoverInfo discoverInfo() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Discover node information in standard DiscoverInfo format.
      Returns:
      The discovery information about the node.
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • getSubscriptions

      public List<Subscription> getSubscriptions() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Get the subscriptions currently associated with this node.
      Returns:
      List of Subscription
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • getSubscriptions

      public List<Subscription> getSubscriptions(List<org.jivesoftware.smack.packet.XmlElement> additionalExtensions, Collection<org.jivesoftware.smack.packet.XmlElement> returnedExtensions) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Get the subscriptions currently associated with this node.

      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.

      Parameters:
      additionalExtensions - TODO javadoc me please
      returnedExtensions - a collection that will be filled with the returned packet extensions
      Returns:
      List of Subscription
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • getSubscriptionsAsOwner

      public List<Subscription> getSubscriptionsAsOwner() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Get the subscriptions currently associated with this node as owner.
      Returns:
      List of Subscription
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
      Since:
      4.1
      See Also:
    • getSubscriptionsAsOwner

      public List<Subscription> getSubscriptionsAsOwner(List<org.jivesoftware.smack.packet.XmlElement> additionalExtensions, Collection<org.jivesoftware.smack.packet.XmlElement> returnedExtensions) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Get the subscriptions currently associated with this node as owner.

      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.

      Parameters:
      additionalExtensions - TODO javadoc me please
      returnedExtensions - a collection that will be filled with the returned stanza extensions
      Returns:
      List of Subscription
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
      Since:
      4.1
      See Also:
    • modifySubscriptionsAsOwner

      public PubSub modifySubscriptionsAsOwner(List<Subscription> changedSubs) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Modify the subscriptions for this PubSub node as owner.

      Note that the subscriptions are _not_ checked against the existing subscriptions since these are not cached (and indeed could change asynchronously)

      Parameters:
      changedSubs - subscriptions that have changed
      Returns:
      null or a PubSub stanza with additional information on success.
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
      Since:
      4.3
      See Also:
    • getAffiliations

      public List<Affiliation> getAffiliations() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Get the affiliations of this node.
      Returns:
      List of Affiliation
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • getAffiliations

      public List<Affiliation> getAffiliations(List<org.jivesoftware.smack.packet.XmlElement> additionalExtensions, Collection<org.jivesoftware.smack.packet.XmlElement> returnedExtensions) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Get the affiliations of this node.

      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.

      Parameters:
      additionalExtensions - additional PacketExtensions add to the request
      returnedExtensions - a collection that will be filled with the returned packet extensions
      Returns:
      List of Affiliation
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • getAffiliationsAsOwner

      public List<Affiliation> getAffiliationsAsOwner() throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Retrieve the affiliation list for this node as owner.
      Returns:
      list of entities whose affiliation is not 'none'.
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
      Since:
      4.2
      See Also:
    • getAffiliationsAsOwner

      public List<Affiliation> getAffiliationsAsOwner(List<org.jivesoftware.smack.packet.XmlElement> additionalExtensions, Collection<org.jivesoftware.smack.packet.XmlElement> returnedExtensions) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Retrieve the affiliation list for this node as owner.

      Note that this is an optional PubSub feature ('pubsub#modify-affiliations').

      Parameters:
      additionalExtensions - optional additional extension elements add to the request.
      returnedExtensions - an optional collection that will be filled with the returned extension elements.
      Returns:
      list of entities whose affiliation is not 'none'.
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
      Since:
      4.2
      See Also:
    • modifyAffiliationAsOwner

      public PubSub modifyAffiliationAsOwner(List<Affiliation> affiliations) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Modify the affiliations for this PubSub node as owner. The Affiliations given must be created with the Affiliation(org.jxmpp.jid.BareJid, Affiliation.Type) constructor.

      Note that this is an optional PubSub feature ('pubsub#modify-affiliations').

      Parameters:
      affiliations - TODO javadoc me please
      Returns:
      null or a PubSub stanza with additional information on success.
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
      Since:
      4.2
      See Also:
    • subscribe

      public Subscription subscribe(org.jxmpp.jid.Jid jid) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      The user subscribes to the node using the supplied jid. The bare jid portion of this one must match the jid for the connection. Please note that the 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.
      Parameters:
      jid - The jid to subscribe as.
      Returns:
      The subscription
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • subscribe

      public Subscription subscribe(org.jxmpp.jid.Jid jid, FillableSubscribeForm subForm) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      The user subscribes to the node using the supplied jid and subscription options. The bare jid portion of this one must match the jid for the connection. Please note that the 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.
      Parameters:
      jid - The jid to subscribe as.
      subForm - TODO javadoc me please
      Returns:
      The subscription
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • unsubscribe

      public void unsubscribe(String jid) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Remove the subscription related to the specified JID. This will only work if there is only 1 subscription. If there are multiple subscriptions, use unsubscribe(String, String).
      Parameters:
      jid - The JID used to subscribe to the node
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • unsubscribe

      public void unsubscribe(String jid, String subscriptionId) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Remove the specific subscription related to the specified JID.
      Parameters:
      jid - The JID used to subscribe to the node
      subscriptionId - The id of the subscription being removed
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • getSubscriptionOptions

      public SubscribeForm getSubscriptionOptions(String jid) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Returns a SubscribeForm for subscriptions, from which you can create an answer form to be submitted via the sendConfigurationForm(FillableConfigureForm).
      Parameters:
      jid - TODO javadoc me please
      Returns:
      A subscription options form
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • getSubscriptionOptions

      public SubscribeForm getSubscriptionOptions(String jid, String subscriptionId) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Get the options for configuring the specified subscription.
      Parameters:
      jid - JID the subscription is registered under
      subscriptionId - The subscription id
      Returns:
      The subscription option form
      Throws:
      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.
      InterruptedException - if the calling thread was interrupted.
    • addItemEventListener

      public void addItemEventListener(ItemEventListener listener)
      Register a listener for item publication events. This listener will get called whenever an item is published to this node.
      Parameters:
      listener - The handler for the event
    • removeItemEventListener

      public void removeItemEventListener(ItemEventListener listener)
      Unregister a listener for publication events.
      Parameters:
      listener - The handler to unregister
    • addConfigurationListener

      public void addConfigurationListener(NodeConfigListener listener)
      Register a listener for configuration events. This listener will get called whenever the node's configuration changes.
      Parameters:
      listener - The handler for the event
    • removeConfigurationListener

      public void removeConfigurationListener(NodeConfigListener listener)
      Unregister a listener for configuration events.
      Parameters:
      listener - The handler to unregister
    • addItemDeleteListener

      public void addItemDeleteListener(ItemDeleteListener listener)
      Register an listener for item delete events. This listener gets called whenever an item is deleted from the node.
      Parameters:
      listener - The handler for the event
    • removeItemDeleteListener

      public void removeItemDeleteListener(ItemDeleteListener listener)
      Unregister a listener for item delete events.
      Parameters:
      listener - The handler to unregister
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • createPubsubPacket

      protected PubSub createPubsubPacket(org.jivesoftware.smack.packet.IQ.Type type, NodeExtension ext)
    • sendPubsubPacket

      protected PubSub sendPubsubPacket(PubSub packet) throws org.jivesoftware.smack.SmackException.NoResponseException, org.jivesoftware.smack.XMPPException.XMPPErrorException, org.jivesoftware.smack.SmackException.NotConnectedException, InterruptedException
      Throws:
      org.jivesoftware.smack.SmackException.NoResponseException
      org.jivesoftware.smack.XMPPException.XMPPErrorException
      org.jivesoftware.smack.SmackException.NotConnectedException
      InterruptedException